I’ve run into an issue with stimulus timing while recording data from an eyelink eye tracker via iohub. Namely, when we collect eye tracking data for a reward learning task, some of the components of the task are presented for either too much or not enough time (or there’s no change). There are no issues when the same code is run without eye tracking.
Following are the observed deviations:
Main stimulus: ~.5 seconds shorter
ISI: ~1.0 seconds shorter
Feedback image: No change
ITI: ~1.5 seconds longer
I troubleshooted the code by commenting out the various eye tracking-related chunks (e.g. code that sends messages to eyewink, code that saves output in case of a quit, code that starts calibration, etc.), and it seems like the only thing that makes a difference is having the eye tracker record continuously. When we do not set the recording state on and off at the beginning/end of each trial, the timing is fine, but we then lose the ability to easily demarcate trials in the EDF.
I’m wondering if anyone might know what’s going on in the code that would so drastically and differentially affect the timing of the various trial components. The basic structure of each trial is: (recording on) stimulus presentation --> ISI --> feedback (recording off)–> ITI, Below is the code I’m using to turn the recording state on and off:
# start recording # ------Prepare to start Routine "trial"------- t = 0 trialClock.reset() # clock frameN = -1 continueRoutine = True routineTimer.add(1.000000+ISI) # update component parameters for each repeat face_img.setImage(ImageName) key_resp_trial = event.BuilderKeyResponse() # keep track of which components have finished trialComponents = [face_img, txtAccept, txtReject, key_resp_trial, fixation_ISI] for thisComponent in trialComponents: if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED if eyetracker: heldFixation = True #unless otherwise io.clearEvents('all') eyetracker.setRecordingState(True) io.sendMessageEvent(text="tStart %i" %(trialsLoop.thisN)) tracker.sendMessage("tStart %i" %(trialsLoop.thisN)) # stop recording # -------Ending Routine "feedback"------- for thisComponent in feedbackComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) if eyetracker: eyetracker.setRecordingState(False) io.sendMessageEvent(text="tEnd %i" %(trialsLoop.thisN)) tracker.sendMessage("tEnd %i" %(trialsLoop.thisN)) trialsLoop.addData("heldFixation",heldFixation) trialsLoop.addData("position",gpos)
As far as I know, this is the default code to alternate between recording states, and I have no idea why that would mess with some (but not all) of the trial components times. Does anyone know what might be going on here? I’d be happy to provide more code from the experiment if that would help.
Thanks so much!