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 https://github.com/psychopy/psychopy/blob/master/psychopy/demos/coder/iohub/eyetracking/simple.py
'''
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('100.1.1.1')
r = tracker.runSetupProcedure()
#tracker.sendCommand(['d'])
#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',
units='pix')
run_trial=True
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)
gazeDot.setPos([gpos[0],gpos[1]])
gazeDot.draw()
window.flip()
keys=event.getKeys()
if keys !=[]:# press any keys to quit
run_trial=False
tracker.setConnectionState(False)
io.quit()