from pygaze import eyetracker

# # # # #
# experiment setup

# create display object
disp = libscreen.Display()

# create eyetracker object
tracker = eyetracker.EyeTracker(disp)

# create keyboard object
keyboard = libinput.Keyboard(keylist=['space'], timeout=None)

# create logfile object
log = liblog.Logfile()
log.write(["trialnr", "trialtype", "endpos", "latency", "correct"])

# create screens
inscreen = libscreen.Screen()
inscreen.draw_text(
    text=
    "When you see a cross, look at it and press space. Then make an eye movement to the black circle when it appears.\n\n(press space to start)",
    fontsize=24)
fixscreen = libscreen.Screen()
fixscreen.draw_fixation(fixtype='cross', pw=3)
targetscreens = {}
targetscreens['left'] = libscreen.Screen()
targetscreens['left'].draw_circle(pos=(int(constants.DISPSIZE[0] * 0.25),
                                       constants.DISPSIZE[1] / 2),
                                  fill=True)
Esempio n. 2
0
        stimulus = trial_items[int(itemNr)]["Stimulus"].format(
            *trial_items[int(itemNr)][condition].split(","))
    stimuli.append(Stimulus(stimulus))
shuffle(stimuli)  # make it random

### experiment setup ###

# start timing
libtime.expstart()

disp = libscreen.Display()
tracker = eyetracker.EyeTracker(disp)
keyboard = libinput.Keyboard(keylist=["space"], timeout=None)

# local log (mainly for debugging)
log = liblog.Logfile(filename=os.path.join(
    RESULT_FOLDER, "participant_{:04d}".format(participant_id)))
log.write([
    "time",
    "trialnr",
    "stimulus",
    "fixation_start",
    "fixation_pos",
    "within_aoi",
])

inscreen = libscreen.Screen()
inscreen.draw_text(
    text=("On the next screen look at the center of the cross on the left."
          " Then read the sentence and after reading it, look at the dot"
          " in the bottom right corner and press [SPACE] on the keyboard."
          "\n\n(press [SPACE] to start)"),