psychopy.org | Reference | Downloads | Github

Using Tobii eyetrackers with PsychoPy

I am trying to get our Tobii eyetracker to work with an experiment I have made on Builder in Psychopy. I followed the materials from Jon Pierce and Sol Simpson’s ECEM workshop, and I seem to have the eye tracking mostly working, but with the issues below:

1 - There is no calibration screen. The task just starts and eye-movements seem to be recorded, but as there is no calibration, I expect the movements are not accurate. I would like to run a fresh calibration at the start of each routine. I see this on the output at the end of the study, with no further information.

########### Running: E:\fourChoiceOddity_lastrun.py ###########
pyo version 0.6.6 (uses single precision)
Error during runSetupProcedure

2 - The eye tracking data is just saved to the same folder in the format of ‘events.hdf5’. I would like the data to be specific to the participant and saved in the ‘data’ folder, so that it is not overwritten each time.

3 - There doesn’t seem to be any field in the hdf5 file to tell me which trial or stimuli was being presented at the time, and in the data output from PsychoPy there is no stim onset time, so I have no way of finding out which trial is which.

Any help would be greatly appreciated!!

This is the code I have inserted. It is edited slightly from the workshop stroop demo, as I am not interested in showing the gaze or recording if a fixation is held.

Begin Experiment:

eyetracker =False #will change if we get one!

if expInfo[‘Eye Tracker’]:
from psychopy.iohub import EventConstants,ioHubConnection,load,Loader
from psychopy.data import getDateStr
# Load the specified iohub configuration file converting it to a python dict.
io_config=load(file(expInfo[‘Eye Tracker’],‘r’), Loader=Loader)

# Add / Update the session code to be unique. Here we use the psychopy getDateStr() function for session code generation
session_info=io_config.get('data_store').get('session_info')
session_info.update(code="S_%s"%(getDateStr()))
# Create an ioHubConnection instance, which starts the ioHubProcess, and informs it of the requested devices and their configurations.
io=ioHubConnection(io_config)
iokeyboard=io.devices.keyboard
mouse=io.devices.mouse
eyetracker=io.getDevice('tracker')

win.winHandle.minimize()
eyetracker.runSetupProcedure()
win.winHandle.activate()
win.winHandle.maximize()
x,y=0,0

Begin Routine:

if eyetracker:
io.clearEvents(‘all’)
eyetracker.setRecordingState(True)

Begin Frame:
This is empty

End Routine:

if eyetracker:
eyetracker.setRecordingState(False)

End Experiment:

if eyetracker:
eyetracker.setConnectionState(False)
io.quit()

Hi James,

Can’t help re the calibration. But for data, you need to link ioHub to your TrialHandler in PsychoPy so it knows about stimulus conditions, keyboard responses and so on. See this message here, with link to the ioHub docs:

https://groups.google.com/d/msg/psychopy-users/TNPaoptsMCU/ZHKAhdfcFAAJ

Re the HDF file, have you inspected it with HDFView? I wonder if each session gets appended to the file rather than getting a separate file per session. HDF is a sort of database format and it is much more effective it all data is nested within a single file.