Gabriella Levine

ongoing and past work
RWET

The Human Repeater performance, !s!w at 319 scholes gallery

http://319scholes.org/nsnw3/

RWET Performance: The Human Repeater


Lost in translation and Urgency.

The Human Baud Repeater

My wish is to be inside a pixel.
I also want to translate ascii to baudot.
I also want to translate nonverbal communication into code.

The earliest standard character encoding to facilitate the transmission of data (basic text messages)
baudot – (1870, Emile Baudot, International Telegraph Alphatbet 1)
-a bit ironic to use because as soon as ascii was invented (which sent 7 or 8 bits per character) a keyboard was more suited than a five key system (similar to a piano keyboard).
-transmitters typed at 30 words per minute
-radio based teleprinters, 20th C
-US Army (1940s), weather transmission, Western Union teletype

A character set, to represent each character in the alphabet as a series of 5 bits, with a shift symbol to represent capitals/special characters, and control characters characters (carriage returns and linefeeds). It is made to transmit information over radio signal or telegraph tower.

Baudot keyboard:

perforated copy of the message on tape

Baud rate:
number of symbol changes made to the transmission medium per second (measured in symbols/second)

Carriage return 00100
Line feed 11011
Shift to figures 11111
Shift to letters 00010

ASCII: 1963 – 7 bit encoding scheme

human relay / repeater:
Swan Lake repeater, Winema NF

RWEL Homework – another approach – playing around with email and ngrams

I sometimes have crazy email interactions with my mother, and I decided to take her emails and write some ngrams with them – and see how they fare

When I was just starting out I figured out how to pull in the body text from emails from specific people (in the process I accidentally deleted 12,000 unread messages (it took about 20 minutes) but… I realize my gmail box needs some sorting


import sys
import imaplib, re

conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
conn.login('gabriella.levine', 'qwewqwe1!')
output = conn.select("INBOX")
print "new messages", output
unread=conn.search(None, 'UnSeen')
print unread
unreadCount = re.search("UNSEEN (\d+)", conn.status("INBOX", "(UNSEEN)")[1][0]).group(1)
print "unread", unreadCount


def get_emails_from_ruth():

ruth = conn.search(None, 'FROM', '"Ruth"')
print "ruth", ruth
#have to write a functioin that outputs ruth then run it in a nother function below ruthmsg
#output ruth

ruthmsg = conn.fetch('149', '(BODY.PEEK[TEXT])')
print ruthmsg
#msgdata = conn.fetch(num, "(BODY.PEEK[HEADER.FIELDS (FROM TO CC DATE SUBJECT MESSAGE-ID)] UID)")

This gave me each number of her emails in a list, as well as how many I had from her, as well as a large mass of text from one of her emails. Then I wrote it better so I got all of her emails, as a text, and only the body text of her email (so I split the text on “7BIT\r\n\r\nhi” and “\r\n\r\n–Boundary” which surrounded the body text of every email I extracted and printed out.

I wasn’t able to get all of her emails but here is some of what I output:

thought you might like to you can breathe a good time together: i thought you can babble on and on like the one who i\’ve been back in a good time didn\’t pass. we\’re together. what a good time together: in our lives in a good time didn\’t pass. have so much fun when we\’re together. we feel great depths for us.\r\n it\’s wonderful for us.\r\n these are SOOOOO different in our lives in touch with her last night. it\’s like my dinner with her last night. schook – the man she lives now can breathe a good time together: i knew all the man she married, and uncles and brother and have such a different world realistically and aunts and emotionally and intellectually, but we can babble on and i thought you when you when we\’re together. mom
hi gabby,, we feel great depths for each other and brother and aunts and have such a good time together: we have so much fun when we\’re together. i thought you might like the one who i\’ve been back in a relief afterwards, hopefully. it\’s like the same about me. noone in tons of relief afterwards, hopefully. it\’s like my dinner with her parents and have you can breathe a sigh of course, there\’s history: mom

So I have to clean it up a lot, and take out the line break symbols. But It is something I will work with. My first step is to get every email in the list (I was getting an error when I was trying to pass in all the emails from her, as opposed to a few at a time)

RWEL – smtp and IMAP libraries

I used this code to send an email:

import smtplib  
  
fromaddr = 'gabriella.levine@gmail.com'  
toaddrs  = 'gabriella.levine@gmail.com'  
msg = 'There was a terrible error that occured and I wanted you to know!'  
  
# Credentials (if needed)  
username = 'gabriella.levine@gmail.com'  
password = 'qwewqwe1!'  
  
# The actual mail send  
server = smtplib.SMTP('smtp.gmail.com:587')  
server.starttls()  
server.login(username,password)  
server.sendmail(fromaddr, toaddrs, msg)  
server.quit()

I would like to be able to monitor a project I’m doing for Sustainable energy (where I will be monitoring the voltage input from a solar panel), and send myself an email if any of the components (the Arduino, the Xbee, the Real time clock, the sd card / shield) stops functioning properly

I thought using this code and the smtp library would send an email but I KEEP getting an error(see below), and I’m not quite sure why yet:

import smtplib
from email.mime.text import MIMEText

sender = 'gabriella.levine@gmail.com'
recipients = 'gl715@nyu.edu'

msg = MIMEText('hi my name is gabby')
msg['Subject'] =  'test'
msg['gabriella levine'] = sender
msg['you'] = recipients

smtpserver = 'smtp.gmail.com'
smtpuser = 'gabriella.levine'         # set SMTP username here
smtppass = 'qwewqwe1!'   # set SMTP password here

session = smtplib.SMTP("smtp.gmail.com", 587)
session.ehlo()
session.starttls()
session.ehlo()

session.login(smtpuser, smtppass)

smtpresult = session.sendmail(sender, [recipients], msg.as_string())

if smtpresult:
  errstr = ""
  for recip in smtpresult.keys():
      errstr = """Could not delivery mail to: %s

Server said: %s
%s

%s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
  raise smtplib.SMTPException, errstr

session.close()

ERROR:

Traceback (most recent call last):
File “1151.py”, line 1, in
import smtplib
File “/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/smtplib.py”, line 46, in
import email.utils
File “/Users/administrator/Desktop/pyEmail/email.py”, line 25, in
conn.login( “putemailhere”, “putpasswordhere” )
File “/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/imaplib.py”, line 501, in login
raise self.error(dat[-1])
imaplib.error: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

I also started trying to sort through email using the IMAP library – I haven’t gotten very far, and have to look at the documentation some more, but this is what I have:

import sys
import imaplib



conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
conn.login('gabriella.levine', 'qwewqwe1!')
output = conn.select("INBOX")
print "new messages", output
#toaddress = msg['to']
#output1 = conn.select("SENT MAIL")
#print output1
output1=conn.select('Sent')
print output1

RWEL HW- rideshare data (also messing around with sound)

city state
playing around with python’s ability to write .wav file – I’d like to redo my midterm in python, writing two different sin waves, as well as reading through a text’s binary data and having a tone play on 1 and nothing on 0… here’s the start

import sys
import math
import wave
import struct

freq = 440.0
data_size = 40000
fname = "WaveTest.wav"
frate = 11025.0  # framerate as a float
amp = 64000.0     # multiplier for amplitude

sine_list_x = []
for x in range(data_size):
    sine_list_x.append(math.sin(2*math.pi*freq*(x/frate)))

wav_file = wave.open(fname, "w")

nchannels = 1
sampwidth = 2
framerate = int(frate)
nframes = data_size
comptype = "NONE"
compname = "not compressed"

wav_file.setparams((nchannels, sampwidth, framerate, nframes,
    comptype, compname))

for s in sine_list_x:
    # write the audio frames to file
    wav_file.writeframes(struct.pack('h', int(s*amp/2)))

wav_file.close()

Additionally, I’m doing more with the code to extract zip code data: I had not been printing the city and state in my processing sketch earlier, but now I am-
[‘43068’, ‘43215’] (zip codes, origin and destination of rideshare requests)
82.803454 39.955145 83.004383 39.967106 (data of gps lats / longs from the zip codes – I had been using after cleaning it with python)
80.281567 40.604424 MACARTHUR PA 80.073393 40.438045 CRAFTON PA (data I will now use, using the new code – see below)

where the first zip code is the origin of a rideshare request, and the latter is a destination point: gps lat., gps long., city name, state name, from a zip code

Now I just need to figure out how to do this through processing (in other words, I don’t want to have to run this code to pull the data from online in order to generate the text file that processing can use)

import sys
import urllib

#define a function
def len(array):
	i=0
	for entry in array:
		i=i+1
	return i
	
def clean(line):
		line = line.replace("\'", "")
		line = line.replace(" ", "")
		line = line.replace(",", ".")
		line = line.replace("(", "")
		line = line.replace(")", "")
		line = line.replace("...", ",")
		line = line.strip("(),'\"")
		return line
		
def zipToLat(origin, destination, zipCodeMap):
	#for each origin and destination zipcode that exists in the zipCodeMap, print it out in the format : (latOrigin, lonOrigin; latDestination, lonDestination)
	

	if zipCodeMap.has_key(origin) and zipCodeMap.has_key(destination):
		#print zipCodeMap[origin][0], zipCodeMap[origin][1], zipCodeMap[destination][0], zipCodeMap[destination][1]
		print zipCodeMap[origin][0],",", zipCodeMap[origin][1],",", zipCodeMap[origin][2], zipCodeMap[origin][3],",", zipCodeMap[destination][0],",", zipCodeMap[destination][1],",",zipCodeMap[destination][2], zipCodeMap[destination][3]
		
		#print "yes"
		#print zipCodeMap[origin]+zipCodeMap[destination]
		#print origin
			
		
		
def maxloc(locationsDict,zipmap):
#return string of both values - location and how many times it appears
	tmp_max_count = -1
	tmp_max_value = ''
	zipMapRF={}
	for entry in locationsDict:
		if len(entry)>1:
			zipcode = entry[0]
			count = entry[1]
			if zipmap.has_key(zipcode):
				#print zipmap[zipcode] + " , " , count
				#print "%s %s" % (zipmap[entry[0]],entry[1])
				
				zipMapRF[entry[0]] = entry[1]
	
				if tmp_max_count <  count:
					tmp_max_count = count
					tmp_max_value  = zipmap[zipcode]
	
			#entry 1 num times apprs, 0 is name of location
			#chek beforehand - does zipmap have this key..

#	print locationsDict
	print "popular location is " + tmp_max_value + " which was visited " , tmp_max_count , " times."
	return tmp_max_value
	#now get value and the map
	


zipNames = {}
zipCoordinates = {}
starts = {}
destinations= {}
locations={}



for line in open('zips.txt'):#can i just load it from http://www.census.gov/tiger/tms/gazetteer/zips.txt
		tup = line.split(",")
		#print tup              
		if len(tup)>=4:
			zip=tup[1][1:-1]
			state=tup[2][1:-1]
			town=tup[3][1:-1]
			lon=tup[4]
			lat=tup[5]
			point = lon,lat
			point = lon,lat, town, state
			
			#print point
			#zipmap[zip]=pair
			#print zip + " (" + pair[0] + "," + pair[1] + ")" 
			zipNames[zip] = town + ", " + state		
			
			zipCoordinates[zip] = point
#print zipCoordinates #this Now stores most of what I need		


#print zipmap
#print zipNames
#print zipCoordinates
#f = urllib.urlopen('http://www.erideshare.com/!!.php')
#s = f.read()
#f.close()

f = urllib.urlopen('http://www.erideshare.com/!!.php')
lines = f.readlines()
f.close()

for line in lines:#open('phpErid.txt'):#figure this out
	for pointPair in line.split("|"):
		#build concordence
		pointPair = pointPair.strip()
		points = pointPair.split(",")
		#print  points
		#print "points!"
		#print points
		if len(points)>=2:
			
			dest = points[1]#the second zip code is the dest
			loc = points[0]#first zip code of the pair
			
			destinations[dest]=destinations.get(dest,0) +1
			starts[loc] = starts.get(loc,0) +1
			
			
			locations[dest] = locations.get(dest,0) +1
			locations[loc] = locations.get(loc,0) +1
			
			

			zipToLatValue = zipToLat(loc,dest, zipCoordinates)
	
		
l=len(locations)
topZipCode = maxloc(locations,zipNames)
locations = locations.items()
maxloc(locations,zipNames)
locations.sort
#print locations
if len(locations)>1:
	locations.sort()
#	print locations[0]
#	print locations[l-1]
maxloc(locations,zipNames)
#{'M': 1, 's': 4, 'p': 2, 'i': 4}

#print zipNames
#print zipmap



#60647,60120| 60647,60120| L1X2W8,M5S1N5| L1X2W8,M5S1N5| 22601,20041| 22601,20041| 19446,19477| 19446,19477| 19446,19477| 19446,19477| 21224,20019| 90840,92660| 02114,02132| 17047,17128| 94612,94903| 94612,94903| 94612,94903| 62034,62035| 62034,62035| 94110,94403| 94110,94403| 07306,07059|

So here is an image of the processing sketch I have when I write this text file inside of the processing folder
(and here is the sketch in early phases, running sort of slowly)

RWEL poems turned sound

(see project site here)

The quality of digital representation is somewhat arbitrary, and always bits.

With three short texts: Yeats’ The Second Coming and Squirrel at Kyle-No-No, and the quote at the beginning of Nabokov’s Pale Fire, I made a new form of poetry: that in the form of sound. I generated binary data using Python, then attempted to use Python’s sound libraries in order to write my own sound files. However, instead, I ended up reading the text files representing the original ASCII in binary, I generated sound files in Processing. I experimented by using different sample rates to read in the data and play the sound, in order to start understanding how sample rate from digital data leads to affects the audio outputs. I used both a sin wave and a Audio Out pulse to show two different sound outputs possible. I also used the data to represent color gradients…

Listen to the text:
sample rate: 1, 256, 1024
2 sin waves

Look at the text:
Sample rate at 1024, 512, 256, and 1:




Here is my code in Python:

Here is a snippet example

Using sine waves and black / white, rgb

This reminds me of the ludicrous account he gave Mr. Langston, of the despicable state of a young gentleman of good family. “Sir, when I heard of him last, he was running about town shooting cats.” And then in a sort of kindly reverie, he bethought himself of his own favorite cat, and said, “But Hodge shan’t be shot: no, no, Hodge shall not be shot.

1bit
samplerate 1024
rgb
256 sample rate

some of what I was working with to write a sound file:

HW RWET: until I figure out to do what I was trying to do…

(extracting all the words that are used in a newspaper article and in a few emails that are only in the OED as of this year, to sort of see who uses “new” words and where they are most prevalent)

I took a story that I really love, from my friend, and got rid of all the vowels. It is just as readable, and I can read it faster now. I might do this before doing any readings for class from now on:

The code was super simple:
#code to take out the vowels:
import sys

for letter in sys.stdin:
letter = letter.replace(“a”, “”)
letter = letter.replace(“e”, “”)
letter = letter.replace(“i”, “”)
letter = letter.replace(“i”, “”)
letter = letter.replace(“u”, “”)

print letter

And some of the story is here:

My gn pg s Amrcn. It mght b fnny to thnk bot t tht wy bt h lvs n cg n Amrc, whch s n my hos, whch s lso n Amrc. In ordr from smllst to lrgst, my gn pg’s world looks lk ths: cg, bdroom, hos, strt, town, stt, Amrc, North Amrc, world, Mlky Wy, nvrs. So h s ctzn of Msschstts nd ctzn of th nvrs, bt bng n Amrcn s th mddl pont of hs prsonl dntty.

Whn popl mt my gn pg thy rfr to hm s Mr. Fostr ntl thy gt to know hm. At crtn pont, whch I dtrmn, thy cn cll hm Pl. If h poops n yor hnd t conts s knowng hm. If h ps n yor hnd (nd yo forgot to pt th towl down), tht conts s knowng hm, too. Yo cold forgt th towl vn thogh th stck s rght thr by th cg, nd popl sy ll th tm, Hllry, pt th towl down, jst sprd t ot, t’s sy. Th p fls wrm t frst bt thn cold nd stcky, nd t cn vn mk yo cry. Not fll-on cry, bt yor ys mght brn. If yo go to th ktchn to gt strng chs nd my gn pg hrs yo nd strts sqkng lk fr lrm for lprchns, nd thn nstd of strng chs yo opn th crspr nd gt hndfl of kl, nd tk th kl to Mr. Fostr, wll I’d consdr tht knowng hm too nd yo cold cll hm Pl.

I’m stndng n front of my whol forth grd clss, nd I’m tllng vryon ll bot ths stff. It’s my trn to do prsntton on On Kd’s Lf Lvn’ In Amrc nd How Tht Kd Gts By. I don’t know f tht’s th tr nm of th ssgnmnt, bt t’s nr nogh to t.

replacing New Words in the media

I am writing a script that allows you to read in a text and if it contains a word that was only put into the English Language (ie, entered into the Oxford English Dictionary as of 2010), I print out that. This is the latest update for the OED, and contains a list of new words. I created a text file from all the new words of 2010.

In order to start to mess around with Python and see if I could pick out a certain word from a list, I just tried to replace every letter in a text file with a number : a–>z corresponded to 1–>26.

I am still working on this code (shouldn’t be too complicated…). I am also still working on conceptually, what to do… or why this might be interesting. More to come…

Here is the code: (I will shortly upload the plugin to allow me to write in legible code)

i=0
num = len(alphabet)
#print num
alphadict = {}
while i

What I have been working on mostly for the past week is to take a file of carpool data consisting of two zip codes, in for format |origin, destination|
and getting this: (FINALLY I cleaned up the data and got lat/longitude points
[origin_latitude origin_longitude destination_latitude destination_longitude]

See the code:
(more…)

more python work

Just fooling around, and trying to learn Python: Super trivial stuff, I’m mostly putting it here as a reference to myself, but hopefully I’ll have something more complex, soon
INPUT:

OUTPUT:

First Assignment HW

I made a simple program that reads in zip code data that pertains to carpool requests throughout the US and outputs the city and state name. The data I input (which I have from a wiki of a friend, and it contains about 40000 pairs of zips) is formatted as so: | zip, zip|


input:
19446,19477| 19446,19477| 21224,20019| 90840,92660| 02114,02132| 17047,17128| 94612,94903| 94612,94903| 94612,94903| 62034,62035| 62034,62035| 94110,94403| 94110,94403| 07306,07059|

The first zip code is the origin point, the second is the destination. Lastly, I print out the location that occurred the most number of times, and how many times that location occurred.

Questions I have: How can I embed it online?
Next: Clean up the output. Get the lats / longs from the zips, and export it to a map of sorts.

Check out the is the python code on the next page:
(more…)

my first (and most banal) madlib – beginning of assignment one

my first stab at learning Python:

hi my name is gabby and i like to go junk sorting

madlib

madLib.py document:

name=raw_input(“name: “);
activity = raw_input(“activity: “)
print “hi my name is “, name, “and I like to “, activity

RWET