esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
671 stars 211 forks source link

Missing Data with New Tobii Pro SDK #104

Closed bruno2git closed 6 years ago

bruno2git commented 6 years ago

With the new Tobii Pro SDK (TRACKERTYPE = 'tobii') PyGaze's output misses a lot of eye-tracking data.

Running the (adapted) slideshow example, with a Tobii Pro X2-60 eye-tracker (60 Hz sampling rate), I obtain 4245 samples using TRACKERTYPE = 'tobii-legacy', which is expected, and only 2030 samples with TRACKERTYPE = 'tobii'. Additionally, the image display takes on average 50 ms longer with the new Tobii tracker type. See slideshow.zip.

This behaviour is also observed in OpenSesame (see this comment and the forum conversation).

(Pinging Tobii developers @grebdems and @pedrotari7)

Note: I'm using Windows 10.

arnohakk commented 6 years ago

We have observed that during data collection at least the infrared lights go on and off every couple of seconds and gaze data is not available when the lights are off. I assume that the eyetracker starts and stops recording (TX300). So far we haven't gotten into anymore detail of this and stayed with tobii-legacy but will do at the beginning on next year.

@bruno2git, have you checked whether either a) the sampling rate is too low or b) are chucks missing in PyGaze's output? If b) we might be observing the same problem. We are using Windows 7 and Threading.

bruno2git commented 6 years ago

Hi @arnohakk, the sampling rate appears to be correct (~60 Hz) but there are indeed chunks of data missing in PyGaze's output.

(My apologies but I accidentally closed the issue.)

arnohakk commented 6 years ago

I got into contact with the Tobii Support, if I get any news I will keep you updated.

grebdems commented 6 years ago

Hi @bruno2git (and @arnohakk), Sorry for a bit delay in answering. X-mas holidays coming up...

I've had a quick look at the data you attached. It looks really strange that there's big chunks of data missing! I really have no explanation for how/why this happens. Based just on the data it looks like the tracker simply stops sending data, something I've never seen happen myself. Have you ever noticed any similar behavior with this particular eye tracker before? (when using "legacy" SDK or other applications)

We will have a closer look at this (I'll try to sync with Support as well).

~For now, though, you could try changing the experiment to not start/stop recording for every stimuli/image (unless you have a really strong reason for doing so). Not sure if this will solve your problem, but in my experience most issues with the tracker (and data) tends to happen at the very start of the session and if you just start/stop it once per recording/experiment you'd at least minimize this.~ Edit: Sorry didn't read your previous comment in the other thread...

@arnohakk, have you only noticed the behavior with the IR illuminators turning on/off when using PyGaze/OpenSesame with "new" Tobii Pro SDK, or at other times as well?

arnohakk commented 6 years ago

@grebdems Thanks for coming back to us! We are currently using the old SDK ('tobii-legacy')with PyGaze and everything is working fine.

As we have a gaze-contingent paradigm, we also observed that during the times when the "lights are off" nothing happens in our paradigm, so I assume that no gaze data is available. Perhaps @scattenlaeufer has a little more information as well.

grebdems commented 6 years ago

@arnohakk, When the lights (a.k.a. IR illuminators) are off the tracker cannot gather any data. This should not happen during a recording. So, I assume, the issues you've been having was only with PyGaze + "new" TRACKERTYPE = 'tobii'? What OS are you using, btw?

bruno2git commented 6 years ago

Hi @grebdems, thank you for looking into this issue. As far as I could determine, this happens only with PyGaze (or OpenSesame) + TRACKERTYPE = 'tobii'. With TRACKERTYPE = 'tobii-legacy' it works as expected. Recording the whole experiment instead of on a stimulus basis doesn't solve the issue (as you noted from my previous comment). I'm using a Windows 10 OS. The PyGaze's backend is PsychoPy but I've tried other backends in PyGaze and OpenSesame without success.

arnohakk commented 6 years ago

Yes, this is what I thought with the lights off. But you never know what you don't know :)

For all of our research so far we have just used the old SDK and a little bit of Tobii Studio. We never encountered this issue. So yes @grebdems , we only had this problem with PyGaze + "new" TRACKERTYPE = 'tobii'. We are also using the Threadclass from Python, but as @bruno2git also has this problem I now assume that this is not due to this fact.

We are running on Win7 currently, at the beginning of next year we might also be able to try out Win 10 and Linux.

grebdems commented 6 years ago

Thanks a lot for all info! Really helps for troubleshooting! We'll have a closer look at this, first trying to reproduce the behavior. Probably won't have time before X-mas though... :-/ I'll keep you posted! If you, or anyone else, figures out anything more - let me know!

arnohakk commented 6 years ago

Thank you, if you need any other info, just ask! We are off for xmas as well now :)

grebdems commented 6 years ago

Hi again. Got some time today to look into this, and did at least manage to reproduce it. Could not get it to happen with the X2-60 tracker, but when switching up (a lot) to the Spectrum at 600Hz it happened to me too. Current hypothesis is that it's related to (computer) resources. I'm (probably) using a faster computer (and/or hdd) than @bruno2git and hence it doesn't happen to me unless I get data at a higher frequency. Need @pedrotari7's help to troubleshoot this further, and he's not yet back from x-mas vacations.

Regarding the 50ms extra time for the images; I too get times longer than the expected 10 s, but in my case around 15 ms. The weird thing is that it doesn't seem to be related to the tracker lib (or which tracker lib is used). If I comment out all everything related to the tracker, and just show the images, I still get the same values. Did you run the "old" and "new" tests on the same computer, and with the same version of PyGaze, @bruno2git?

bruno2git commented 6 years ago

Hi @grebdems , thank you for looking into this. I did run the "old" and "new" tests on the same computer and with the same version of PyGaze. Actually I have tried this in two different laptops and this issue occurred consistently. The specs of the laptops are in the following files: vaio.system.txt asus.system.txt

esdalmaijer commented 6 years ago

Pull request #106 is supposed to fix this issue. Would anyone be able to download the current code of GitHub, and test whether their missing data issues still persist? Thanks!

bruno2git commented 6 years ago

Hi @grebdems and @esdalmaijer, I'm very glad to know that there is a fix for this, already. Thank you @grebdems! I don't have access to the eye-tracker right now but I'll try to test this in the next few days.

scattenlaeufer commented 6 years ago

Thanks for the fix and I should be able to test this code on Thursday. I'll let you know of the results.

scattenlaeufer commented 6 years ago

This fix seems to work.

I created a small script to test it and everyone, who wants to test it for themself, can find it here. It just records data for 60 seconds and plots the time difference between data samples against the experiment time. For us this looks like this: plot_time_diffence We see a time difference of (3.33±0.09)ms, which is the expected value for a sample rate of 300Hz.

bruno2git commented 6 years ago

I apologise but only today got the time to test the new fix. As far as I can tell, this fix works. The results obtained with the old SDK and the new one seem to be consistent. I guess we can close this issue. Thank you @grebdems and everybody!