Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # example script for using PyGaze
- # # # # #
- # importing the relevant libraries
- import random
- from pygaze import libscreen, libtime, liblog, defaults
- # # # # #
- # setup the experiment
- # start timing
- libtime.expstart()
- # create display object
- disp = libscreen.Display()
- # create logfile object
- log = liblog.Logfile()
- log.write(["count", "rt"])
- # create screens
- x = 0
- y = 0
- w = defaults.DISPSIZE[0]
- h = defaults.DISPSIZE[1]
- black = libscreen.Screen()
- black.draw_rect(colour=(0,0,0), x=x, y=y, w=w, h=h, fill=True)
- white = libscreen.Screen()
- white.draw_rect(colour=(255,255,255), x=x, y=y, w=w, h=h, fill=True)
- # # # # #
- # run the experiment
- # run 20 trials
- for count in range(1,5):
- # prepare trial
- trialtype = random.choice(['left','right'])
- # present fixation
- disp.fill(black)
- disp.show()
- libtime.pause(500)
- disp.fill(white)
- t1 = disp.show()
- libtime.pause(500)
- t2 = libtime.get_time()
- rt = t2 - t1
- # log stuff
- log.write([count, rt])
- # end the experiment
- log.close()
- disp.close()
- libtime.expend()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement