Sunday, December 27, 2009

Python help with the coding or advice?

Hi





Ive recently tried to move a python code from a mac version to a version of Psychopy IDE. Now the code wont work on the pc it tells me there a syntax error. Is there something different that mac uses in the python code then the pc? if not any other suggestions why it wouldnt be working











from psychopy import visual, core, misc, event


import numpy #for maths on arrays


from numpy.random import random, shuffle #we only need these two commands from this lib


from random import *


import math





win = visual.Window([1024,768], units='pix', monitor='testMonitor',rgb=(-1,-1,-1))





numbers = range(100) #range of stimuli to be generated or how many to generate





#Choose N, elementsize and filenames





for x in numbers:





N=85 #number to generate0


#To choose which stimuli to generate uncomment the appropriate line


#Contour length


#elemSize = 2000/((N)*math.pi*2)#contour lentgth


#elemSize = 2000/((50)*math.pi*2)#50CLcontrol





#Brightness controls


# elemSize=math.sqrt(70000/((N)*math.pi))#鈥?br>

elemSize=math.sqrt(70000/((50)*math.pi))鈥?br>




#create empty list of locations


locations=[]





i=1


while i%26lt;=N :


locations.append([randrange(int(elemSize鈥?br>

i=i+1





#build an array of circles according to the parameters


globForm = visual.ElementArrayStim(win, nElements=N, units='pix',sizes=elemSize,fieldShape='s鈥?br>




globForm.draw()


win.flip(clearBuffer=False)#redraw the buffer


win.getMovieFrame()


win.flip(clearBuffer=True)





#adjustfilename as appropriate


win.saveMovieFrames('B085.jpg')


core.quit()


event.clearEvents()#keep the event buffer from overflowingPython help with the coding or advice?
Paste the code on http://codepad.org so you may preserve the indentation. (Select python).Python help with the coding or advice?
Kud u post the error message?

No comments:

Post a Comment