Exemplo n.º 1
0
# screen objects
screen = Screen()
blankscreen = Screen()
hitscreen = Screen()
hitscreen.clear(colour=(0,255,0))
misscreen = Screen()
misscreen.clear(colour=(255,0,0))

# create eyelink objecy
eyetracker = EyeTracker(disp)

# eyelink calibration
eyetracker.calibrate()

# display surface
disp.fill(screen=blankscreen)
disp.show()

# # # # #
# game

# run several rounds
for trialnr in range(0,TRIALS):
	
	# start eye tracking
	eyetracker.start_recording()
	eyetracker.log("start_trial %d" % trialnr)
	trialstart = libtime.get_time()

	# run game
	points = 0
Exemplo n.º 2
0
# screen objects
screen = Screen()
blankscreen = Screen()
hitscreen = Screen()
hitscreen.clear(colour=(0,255,0))
misscreen = Screen()
misscreen.clear(colour=(255,0,0))

# create eyelink objecy
eyetracker = EyeTracker(disp)

# eyelink calibration
eyetracker.calibrate()

# display surface
disp.fill(screen=blankscreen)
disp.show()

# # # # #
# game

# run several rounds
for trialnr in range(0,TRIALS):
	
	# start eye tracking
	eyetracker.start_recording()
	eyetracker.log("start_trial %d" % trialnr)
	trialstart = libtime.get_time()

	# run game
	points = 0
Exemplo n.º 3
0
scr = Screen()

# eye tracking
tracker = EyeTracker(disp, trackertype='dummy')
frl = FRL(pos='center', dist=125, size=200)

# input collection and storage
kb = Keyboard(keylist=['escape', 'space'], timeout=None)
log = Logfile()
log.write(["trialnr", "trialstart", "trialend", "duration", "image"])

# run trials
tracker.calibrate()
for trialnr in range(0, len(IMAGES)):
    # blank display
    disp.fill()
    disp.show()
    libtime.pause(1000)
    # prepare stimulus
    scr.clear()
    scr.draw_image(IMAGES[trialnr])
    # start recording eye movements
    tracker.drift_correction()
    tracker.start_recording()
    tracker.status_msg("trial %d" % trialnr)
    tracker.log("start trial %d" % trialnr)
    # present stimulus
    response = None
    trialstart = libtime.get_time()
    while not response:
        gazepos = tracker.sample()
Exemplo n.º 4
0
    LOGFILENAME = basename + '_eyetracker'
    director = os.getcwd()
    LOGFILE = os.path.join(director,LOGFILENAME)
    
    FGC = cst.FGC
    BGC = cst.BGC
    SACCVELTHRESH = cst.SACCVELTHRESH
    SACCACCTHRESH = cst.SACCACCTHRESH
    TRACKERTYPE = cst.TRACKERTYPE
    
# In[Tracker - Calibrate]:

if withTracker and run == 0:
    
    scr.draw_text(text='tracker instructions')
    disp.fill(scr)
    disp.show()
    
    kb.get_key(keylist = None, timeout = None, flush = True)
    
    if TRACKERTYPE != 'dummy':
        tracker.calibrate()
    
    scr.clear()
    
elif withTracker:
    scr.clear()

# In[Initiate PsychoPy Objects]:

psychopy.event.clearEvents()
from pygaze.defaults import *
from pygaze import libtime
from pygaze.libscreen import Display, Screen
from pygaze.libinput import Keyboard

# start timing
libtime.expstart()

# objects
disp = Display()
scr = Screen()
kb = Keyboard(keylist=['space'], timeout=1)

# run annoying message
while kb.get_key()[0] == None:
    # colour
    col = (random.randint(0, 255), random.randint(0,
                                                  255), random.randint(0, 255))
    # position
    pos = (random.randint(0, DISPSIZE[0]), random.randint(0, DISPSIZE[1]))
    # text
    scr.draw_text(text=MESSAGE, colour=col, pos=pos, fontsize=84)
    # display
    disp.fill(scr)
    disp.show()
    # reset screen
    scr.clear()

# stop the madness
disp.close()
Exemplo n.º 6
0
        red = 0
    elif red > 255:
        red = 255
    # The other colour values will be 0
    green = 0
    blue = 0
    # Now set the background colour to the new colour.
    bgc = (red, green, blue)

    # Fill the Screen with the new background colour...
    scr.clear(colour=bgc)
    # ...and write the new sample text (white letters).
    scr.draw_text(text=sampletext, colour=(255,255,255), fontsize=100)

    # Now fill the Display with the updated Screen...
    disp.fill(scr)
    # ...and update the monitor!
    disp.show()

    # Don't forget to check if there is a keypress.
    key, presstime = kb.get_key()


# Close the connection with the MP150.
mp.close()
 
# End the experiment.
disp.close()
plt.plot(T,Y);
plt.show();
#print Y
Exemplo n.º 7
0
# make the sets of images
image_set = generate()
#shuffle our image sets
shuffle(image_set)

# give instuctions first
instruction_screen = Screen()
instruction_screen.draw_text(
    text=
    "You will watch a short clip. After, the trials will begin. \n Press space to continue",
    pos=center_of_screen,
    colour=(255, 255, 255),
    fontsize=22)
while keyboard.get_key()[0] != "space":
    disp.fill(instruction_screen)
    disp.show()

instruction_screen.clear()

#call movie function - will need to switch betwwen neutral and sad
#INSERT CODE HERE

# start trials
for trialnr in range(len(image_set)):
    # make trial screens
    fixation_cross_screen = Screen()
    fixation_cross_screen.draw_fixation(fixtype='cross',
                                        pos=center_of_screen,
                                        colour=(255, 255, 255),
                                        pw=5,
Exemplo n.º 8
0
    screen1.draw_image(image_pair[0],
                       pos=(center_of_screen[0] - 300, center_of_screen[1]),
                       scale=None)  #need screen width
    screen1.draw_image(image_pair[1],
                       pos=(center_of_screen[0] + 300, center_of_screen[1]),
                       scale=None)  #need screen width

    #space (replace with 3 seconds)
    #current time
    pairstart = libtime.get_time()

    if (image_pair[2] == True
        ):  # if we have the addition, wait for fixation. REPLACE THE NEXT LINE
        while keyboard.get_key(
        )[0] == None:  #Replace this with wait for fixation code
            disp.fill(screen1)
            disp.show()
    else:
        while libtime.get_time() - pairstart < 3000:
            disp.fill(screen1)
            disp.show()

    #image pair index 2 tells us if we need to draw a circle/square.
    if (image_pair[2] == True):

        neutral_image_index = 0
        if ("NE" in image_pair[1]):
            neutral_image_index = 1

        new_suffix = circle_suffix
        if (random.choice([True, False]) == True):