| Reference | Downloads | Github

Specify calibration, validation, and drift correction individually using IOHub with eyelink II


Hi there,

Windows 7
Psychopy 1.84.2 Coder

We have successfully implemented eyelink II eyetracking (code at the bottom). All of the calibration, validation, and drift correction happens through the tracker.runSetupProcedure() command, which essentially brings up a menu of things that can be done.

What I would like is, rather than specify the full menu of things, to separately specify just a calibration procedure, or just a validation procedure, or just a drift correction, without having to bring up the full menu.

Something like:

tracker.runSetupProcedure() #initial procedure

while Experiment == running

   #Do some trials of an experiment

   tracker.doValidation() #validate after some trials to make sure things still okay
   if validation == poor:
      tracker.runSetupProcedure() #if bad validation, do another full calibration
   elif validation == fine:
      tracker.doDriftCorrection() #if validation is fine, just do a drift correction

What commands would allow something like this? My current eyetracking code is below, along with commented-out attempts to implement something like the above.

Thank you in advance for any guidance!

tracking with ioHub framework.
Simplification of
from psychopy import visual,event
import math
from psychopy.iohub.client import launchHubServer
#import pylink
#from EyeLinkCoreGraphicsPsychopy import EyeLinkCoreGraphicsPsychopy
#from eyetracker.hw.sr_research.eyelink.EyeTracker import _doDriftCorrect, _applyDriftCorrect
#iohub configuration
iohub_tracker_class_path = 'eyetracker.hw.sr_research.eyelink.EyeTracker'
eyetracker_config = dict()
eyetracker_config['name'] = 'tracker'
eyetracker_config['model_name'] = 'EYELINK 2'
eyetracker_config['runtime_settings'] = dict(enable= True,name= "tracker",monitor_event_types= "[BinocularEyeSampleEvent, ]")
io = launchHubServer(**{iohub_tracker_class_path: eyetracker_config})
keyboard = io.devices.keyboard
display = io.devices.display
tracker = io.devices.tracker

#tk = pylink.EyeLink('') 

r = tracker.runSetupProcedure()

#r = tracker._addCommandFunctions()
#r= tracker.doTrackerSetup()
#r=tk._doDriftCorrect(640, 450, 1, 1) 
#drift= tracker._addCommandFunctions(self)

tracker.setRecordingState(True)# Start Recording Eye Data

window = visual.Window(fullscr=True,monitor='myScreen',size=(1280,900),units='pix', allowGUI=False)

gazeDot =visual.GratingStim(window,tex=None, mask="gauss",
                             pos=(0,0 ),size=(66,66),color='green',

while run_trial :
    gpos=tracker.getPosition() #sample eye position

    if type(gpos) in [tuple,list]: #if possible, draw the eye position
        dist = math.sqrt((gpos[0] - fixation.pos[0])**2 + (gpos[1] - fixation.pos[1])**2)
    if keys !=[]:# press any keys to quit

As a general note, a psychopy experiment can use either iohub or the pylink module directly to interface with an eyelink, but both can not be used at the same time.

For eyelink, the iohub runSetupProcedure puts it into camera setup mode, which allows calibration / validation by using the ā€˜cā€™ and ā€˜vā€™ keys.

The iohub eyelink class also has a sendCommand method, which you might be able to use to do online / runtime DC if there is a text command equivalent to the pylink._doDriftCorrect (which I do not recall from memory right now).