Zeven Rodriguez

Spring 2010

Python HW Feb 19 Reddit Headlines

Reading and Writing Text

Comments Closed


Share this post

Read more

Solar Presentation

Sustainable Energy

Comments Closed


Share this post

Solar Presentation

Read more

Wildlife Tracking: RFID research

Wildlife Tracking

Comments Closed


Share this post

So I was interested in RFID for tracking monkeys. RFID comes in two flavors: passive and active. For tracking monkeys the preferable would be an active RFID chip.

Active vs Passive

Active
Power: Battery powered, average 7000 hrs *depending on receiver
Signal Strength needed: Low Signal
Range: up to 100m
Data Storage: 128kb read/write search and access to data

Passive
Power: comes from RF reader
Signal Strength needed: High signal

Range: 3-5m or less

Data Storage: 128 bytes of read/write

Depending on models active RFID could have high operating temperature, between -35c and 50c. This is important for the high temperatures in the amazon. Another advantage is the size and weight. Ranging around 14 grams and 2.4 in x 1.2 in x 0.4 in to big ones that are around 2in x 3in x 0.5 in

This link is a diy aduino based RFID reader

http://pimm.wordpress.com/2008/03/09/first-rfid-experience-arduino-controlled-parallax-reader/

This is a couple of data sheets from different companies

http://www.ananiahelectronics.com/RF40315T-s.htm

http://www.activewaveinc.com/products_datasheets.php

http://cliste.sailwhatcom.com/catalog/1

This link has standard pricing options

http://www.rfidexchange.com/purchasing.aspx

Tracking Cows

http://www.zigbeef.com/index.html

Read more

Reading and Writing Text Homework 1

Reading and Writing Text

Comments Closed


Share this post

For this homework I wanted to mashup 3 Charles Bukowski programs and make them adorable. I started with 3 poems: Death wants more Death, The Riot, and Two Kinds of Hell.

I started with

cat deathwantsmoredeath.txt theriot.txt twokindsofhell.txt

This is how I combined multiple files.

I ran python hwfeb05.py <charles#.txt>charles#.txt with the pound being increasing numbers from 0-5

This is the code for hwfeb05.py this code divides the poem in half

import sys

count = 0

for line in sys.stdin:

line = line.strip()

if count % 2 == 0:

output = line

else:

output = ""

print output

count += 1

Then I ran python  hwfeb05replace.py< charles5.txt>charlesreplace.txt

Here is  the code for hwfeb05replace.py. This replace code is what looks for the words I want to make adorable.

]
import sys

for line in sys.stdin:
  line = line.strip()
  line = line.replace('death', 'pandas')
  line = line.replace('corpses', 'puppies')
  line = line.replace('corpse', 'puppy')
  line = line.replace('drink', 'hug')
  line = line.replace('dark', 'puppy-eyed')
  line = line.replace('drinks', 'hugs')
  line = line.replace('ladies', 'unicorns')
  line = line.replace('lady', 'unicorn')
  line = line.replace('crime','party')
  line = line.replace('enemy','buddy')
  line = line.replace('enemies','buddies')
  line = line.replace('bar','playground')
  line = line.replace('alone','holding hands')
  line = line.replace('body','kitten')
  line = line.replace('bodies','kittens')
  print line

Finally I ran python hwfeb05finder.py<charlesreplace.txt>charlesfinder.txt

import sys
for line in sys.stdin:
  line = line.strip()
  offset = line.find("pandas")
  if offset != -1:
    print line
  offset = line.find("puppies")
  if offset != -1:
    print line
  offset = line.find("puppy")
  if offset != -1:
    print line
  offset = line.find("hug")
  if offset != -1:
    print line
  offset = line.find("puppy-eyed")
  if offset != -1:
    print line
  offset = line.find("hugs")
  if offset != -1:
    print line
  offset = line.find("unicorns")
  if offset != -1:
    print line
  offset = line.find("unicorn")
  if offset != -1:
    print line
  offset = line.find("party")
  if offset != -1:
    print line
  offset = line.find("buddy")
  if offset != -1:
    print line
  offset = line.find("buddies")
  if offset != -1:
    print line
  offset = line.find("playground")
  if offset != -1:
    print line
  offset = line.find("holding hands")
  if offset != -1:
    print line
  offset = line.find("kitten")
  if offset != -1:
    print line
  offset = line.find("kittens")
  if offset != -1:
    print line

That gave me this output:

pandas wants more pandas, and its webs are full:
I would brush the puppies of flies
their sticky, ugly, vibrant kittens
their sticky, ugly, vibrant kittens
towards some puppy-eyed corner
towards some puppy-eyed corner
I sat in the same playground for 7 years, from 5 a.m.
I had no money but the hugs kept
I had no money but the hugs kept
to them I wasn’t the playground clown
and I began to hug holding hands and I found the company
and I began to hug holding hands and I found the company
heart, knocks began upon my door: unicorns
heart, knocks began upon my door: unicorns
and the unicorns arrived one at a time and when it ended with
and the unicorns arrived one at a time and when it ended with
but I remembered the 7 years in the playground, I hardly ever bedded
his simple strength and salvation, they will send the unicorn
and then you remember the playground
somekitten in the playground saying: “hey, sir, forget it, he’s a mental
somekitten in the playground saying: “hey, sir, forget it, he’s a mental
gods arranged to get all those unicorns knocking and you went for
gods arranged to get all those unicorns knocking and you went for
the puff of kitten swelling
looking for the buddy
saw or sensed my party

The only thing that I need to figure out now is how not to print out duplicate lines

Read more

Pan-Ball Flute

Sustainable Energy

Comments Closed


Share this post

The Pan-Ball Flute is a hand crank device the pulls back a pinball style lever. Once the lever is let go a magnet advances passing through the coils and hitting a piezo. The crank has crowbar style forks that pull back the lever. The intention is that with combination of generators my hope is to power some piezo buzzers

Read more

Wildlife/People Observation

Wildlife Tracking

Comments Closed


Share this post

We went to Coles gym to observe people playing basketball. Tracking targets that move fast was difficult. The most important part was generating the short hand codes to be able to properly track the subjects. During our exercise, our code evolved to better track the game. An example of that was originally we only had a contact event. We added a grab event because we noticed that their were more times that contact was people trying to go for the ball. Here is all the info I collected

Monkey observation

Read more

Hospitable Room: Initial Pitch

Hospitable Room

Comments Closed


Share this post

Katherine and I created this processing sketch to illustrate how the user would navigate through the world. In the next version the mouse will be replaced by a wheel chair. The idea is that the user will use the wheel chair to navigate around the world.

http://www.zevenrodriguez.com/blog/hospitableroom/ZoomInViewer_Feb02/

Read more

Hospitable Room – Assignment 1

Hospitable Room

Comments Closed


Share this post

So tracking the red color of the iphone red light from the flashlight app, this code moves the cursor(the cow) around,

import processing.video.Capture;
Capture video;// regular processing libary
PFont f;
int threshold = 150; //255 is white, 0 is black
int aveX, aveY; //this is what we are trying to find
int objectR =255;
int objectG = 0;
int objectB = 0;
boolean debug = true;
int lastTime, ellapsedTime; //for checking performance
PImage cow;
PImage grass;
String message;
void setup() {
size(640, 480);
println(Capture.list());
video = new Capture(this,width,height);
//video.settings();
cow = loadImage(“cowsmall.png”);
grass = loadImage(“grass.png”);
f = createFont(“Arial”, 32);
}
void draw(){
if (video.available()){
ellapsedTime = millis() – lastTime;  //find time since last time, only print it out if you press “t”
lastTime = millis();  //reset timer for checking time next fram
video.read();
int totalFoundPixels= 0;  //we are going to find the average location of change pixes so
int sumX = 0;  //we will need the sum of all the x find, the sum of all the y find and the total finds
int sumY = 0;
//enter into the classic nested for statements of computer vision
for (int row = 0; row < video.height; row++) {
for (int col = 0; col < video.width; col++) {
//the pixels file into the room long line you use this simple formula to find what row and column the sit in
int offset = row * width + col;
//pull out the same pixel from the current frame
int thisColor = video.pixels[offset];
//pull out the individual colors for both pixels
float r = red(thisColor);
float g = green(thisColor);
float b = blue(thisColor);
//in a color “space” you find the distance between color the same whay you would in a cartesian space, phythag or dist in processing
float diff = dist(r, g, b, objectR, objectG, objectB);
if (diff < threshold) {  //if it is close enough in size, add it to the average
sumX = sumX + col;
sumY= sumY + row;
totalFoundPixels++;
if (debug) video.pixels[offset] = 0xff000000;//debugging
}
}
}
// look here
if (debug){
image(video,0,0);
}
image(grass, 0,0);
if (totalFoundPixels > 0){
aveX = sumX/totalFoundPixels;
aveY = sumY/totalFoundPixels;
// noStroke();
// fill(255 , 200,200);
// ellipse(aveX-10,(aveY-10),20,20);
image(cow,aveX-10,aveY-10);
}
}
// This is how to get a hot area
if(aveX > 450 && aveX < 650 && aveY >300 && aveY < 470){
//  noStroke();
//  fill(255,0,0);
//  ellipse(100,100,100,100);
message = “The cow jumped over the moon”;
textFont(f);
text(message, 75,75);
}
else{
message = ” “;
textFont(f);
text(message, 75,75);
}
}
void mousePressed(){
//if they click, use that picture for the new thing to follow
int offset = mouseY * width + mouseX;
//pull out the same pixel from the current frame
int thisColor = video.pixels[offset];
//pull out the individual colors for both pixels
float objectR = red(thisColor);
float objectG = green(thisColor);
float objectB = blue(thisColor);
println(“Chasing new color  ” + objectR + ” ” + objectG + ” ” + objectB);
}
void keyPressed() {
//for adjusting things on the fly
if (key == ‘s’) {
video.settings();
}
else if (key == ‘-’) {
threshold–;
println(“Threshold ” + threshold);
}
else if (key == ‘=’) {
threshold++;
println(“Threshold ” + threshold);
}
else if (key == ‘d’) {
background(255);
debug = !debug;
println(“Debug ” + debug);
}
else if (key == ‘t’) {
println(“Time Between Frames ” + ellapsedTime);
}
}

Read more