| Reference | Downloads | Github

Calibrating EyeLink on main window (iohub) and strange sound related error using eye tracker

OS (e.g. Win10): OSX 10.11.6 on a new Mac Mini
PsychoPy version (e.g. 1.84.x): 1.84.2
Standard Standalone? (y/n) If not then what?: Yes.

I have some undergraduate students in my laboratory trying to implement an eye tracking study using our new EyeLink 1000 Plus in PsychoPy with Builder view. They managed to find a demonstration script based on the Stroop demo that uses iohub to interface with the eye tracker and – by copying the relevant code component from trial Routine of that script – they managed to generate a working experiment. The code component they added to implement tracking seems to follow the general recipe provided here (Python crashing with eyetracking experiment). If needed, I will post an example either tomorrow or Tuesday when I am back in the laboratory. The experiment runs for the most part, but there are two issues we have been unable to iron out. I was hoping someone here could point us in the right direction.

  1. The approach linked above generally works, but it requires the experiment not be in full-screen mode. This is because iohub wants to use its own window for the calibration process. If you try to run the code with the experiment in full screen mode, it does not work. I tried a variety of tricks I found online to swap between full-screen and windowed mode such as are found here ( I integrated the relevant snippet into the portion of code wherein the eye tracker does its calibration, trying to change to windowed mode, minimize, calibrate and then change back; however, these tricks do not appear to work. If the experiment starts in full screen mode, it does not appear responsive to changing to windowed mode. I know one way to make this work using the Coder view – by moving the tracker initialization code to the period of the script preceding definition of the experiment window, sidestepping the issue – but I am looking for a solution I could give to my students, who are not ready to deal with the Coder view. Plus, it would be good to be able to incorporate the calibration process later in the experiment, which would require swapping from full screen. Is there any way to get iohub to use the same window as the experiment? Or is there any way to change between full screen and windowed mode in PsychoPy using OSX?

  2. My experiment uses tones. These are represented by a sound component in the Builder view, with the frequency set at each repeat (alternating between 280 and 1170 Hz, each repeated 60 times). I noticed today that on some trials, the tone appears to double up (instead of BEEP you get a somewhat noisy BEEPBEEP) after which the trial ends prematurely (it is meant to last 3 s following the tone but ends immediately after). I spent two days trying to figure out what was wrong with the sound drivers, etc. However, I determined today that this issue only happens if iohub is loaded and the eye tracker is recording. If I keep all of the code from the above example in place but merely comment out the line wherein the tracker is turned on/off (at the start/end of the routine) this error does not occur. It also does not occur if all of the tracker code is removed. Further, it occurs at a shockingly regular interval. The tone bugs out for the first time on Trial 7 and then every 6 trials after that (each trial is around 7.5 s long). I am at a loss and really have no idea how to even trouble shoot this one. Is there anyone with experience using iohub that could suggest where to start? Would it even be possible for iohub to interact with a sound component in this manner?

As I said above, I do not have a copy of the code with me just now but I wanted to get these questions out there in case the issues are already known and a fix available. I will post a demo of the issue sometime tomorrow or Tuesday if needed.

PS: I technically cross-posted this issue with the Google Group before I noticed the deprecation notice. Sorry!

Not sure whether I am “screaming into the void”, but I wanted to update that I solved the latter problem (#2). As it turns out, using sound is not necessary for the glitch to occur. I created a toy example wherein the sound was replaced by a text component and found that the occasional trial would still glitch and end prematurely – it was only far less frequent. However, by slowly removing various components and testing for the bug I managed to isolate it to the inclusion of an ISI component at the end of my trial. If the ISI component is present, I get these occasional glitches (which are more common if I include a tone), if I remove the ISI, they go away. I have no idea why this would be the case, but that part of my post has been resolved.

The issue of calibration for different eye trackers has always been an issue. They often have their own windows for this that we can’t control (we can’t just draw the stimulus in the psychopy window) so the key is trying to close or minimize the psychopy experiment window.

The workaround that used to work for this was to run this in a code component during begin routine (assuming you configured your device to be called eyetracker using iohub):


PS I suspect the reason your post received no replies is the length of it. People here are volunteering and busy so a post that needs more than a minute to read/reply will be ignored by most people.

Just to add to this (hopefully of benefit to anyone searching for a solution to a similar problem relating to switching screens between calibration and experiment):

I was using the code Jon wrote above too, which successfully loaded calibration. However, after calibrating, validating and pressing ‘Exit Setup’, the setup screen (correctly) vanished, but only to reveal the desktop view of the screen - and not the Experimental View (i.e., the Psychopy experiment). After reading this thread (!topic/psychopy-users/aq3XgtuWeiI), I tried commenting out the three “win” lines, and it worked: the experiment immediately proceeded once I left the camera setup. As Sol and Jon say, I think the calibration process works differently for different PCs and Eyetrackers. For the record, I use Psychopy v1.85.3, Eyelink 1000 plus, and Linux 4.4.0-21-generic #37-Ubuntu SMP. Thanks everyone.


1 Like