#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Error with Tobii during "Visual world" experiment

edited February 2018 in PyGaze

Hello!
We connected a Tobii eyetracker and tried to run the eyetracker template (we aim at running then the Visual World experiment). We are used the self-standing Opensesame 3.2 and Python 2.7. (the installer version does not seem to exist) and we get this error: Tuple index out of range.
This error does not appear if we use Opensesame 3.1.9 (the calibration in the eyetracker template works fine).
Here is the script in the debug window:

Python 2.7.13

* Use the "print([msg])" function in inline_script items to print to this debug window.
* Inspect inline_script variables when an experiment is finished.

Starting experiment as ExperimentProcess-1
Expyriment 0.9.1b2 (Python 2.7.13)
Scripts/safelaunch-opensesame.py
openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
experiment.run(): experiment started at Fri Feb 02 13:26:22 2018
experiment.run(): disabling garbage collection
experiment.end(): enabling garbage collection

Unexpected error

item-stack: experiment[run].pygaze_init[run]
exception type: IndexError
exception message: tuple index out of range
time: Fri Feb 02 13:26:39 2018

Traceback:
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libqtopensesame\misc\process.py", line 154, in run
exp.run()
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\experiment.py", line 410, in run
self.items.execute(self.var.start)
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 96, in execute
self.run(name)
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 227, in run
self.experiment.pygaze_eyetracker.calibrate()
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 366, in calibrate
calibration_result = calibration.compute_and_apply()
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\tobiiresearch\implementation\ScreenBasedCalibration.py", line 248, in compute_and_apply
interop_result = tobii_pro.screen_based_calibration_compute_and_apply(self.__core_eyetracker)
File "C:\Users\Daniela\Desktop\OPENSESAME3.2 PY2.7\New folder\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\tobiiresearch\interop\tobii_pro.py", line 268, in screen_based_calibration_compute_and_apply
return (status[1], [TobiiProCalibrationPoint(x) for x in result[1]])
IndexError: tuple index out of range


Can anybody help?
Thank you
Daniela

• edited February 2018

@Edwin Do you know where this comes from? It looks like it has to do with the updated Tobii support. (Or maybe even a bug in the Tobii SDK itself.)

• Hi, I'm experiencing the same problem: calibration with tobii X2-60 worked fine with Opensesame 3.1.9.
Then I updated to v.3.2, Python 2.7, and now calibration stops at the end: the sequence of fixation dots correctly appears on screen (the one in the middle, and the ones in the four corners) but then I got the same error message reported by Dani.rnc.

• Hi all,

That seems to be an issue with the underlying Tobii Pro SDK... Unfortunately, I don't do the Tobii development myself anymore, due to not having access to a Tobii tracker. I've opened an issue on GitHub to make them aware of it, and ask for advice from the Tobii developers that maintain the Pro SDK support in PyGaze.

Please keep an eye out on the issue page to keep up to date with the most recent developments. (I'll try to keep people updated here as well.)

Cheers,
Edwin

• Hi Edwin,
many thanks!

Just to understand my problem: calibration with my tobii was working fine previously, when I first downloaded Pygaze (a couple of months ago, under Opensesame 3.1.9).

Now I upgraded to OpenSesame 3.2 and re-copied the pygaze folder into the site-packages. This leads to the calibration problems. If I get it right, this is due to some update. Can I just use some older version, perhaps the same I was using before?

Cheers,
enzo

• The Tobii devs say that they've fixed the issue in 1.3.1 of the tobii-research package. You can update this package within OpenSesame through Menu → Tools → Python package manager. Does that solve the issue?

• @Enzo: The issue was probably introduced in an upgrade in Tobii's software, so it might well be that downgrading the Tobii Pro Python module would have worked. However, the issue seems to have been sorted already, so please do try upgrading instead

• Thanks Edwin and Sebastiaan, tobii-research succesfully updated and calibration seems ok now.

• edited February 2018

Hello! I did the upgrade too, and calibration does in fact work fine. Now I get this error when I try to use the eye tracking template, right after the calibration has been done and the experiment should start:

Python 2.7.13

* Use the "print([msg])" function in inline_script items to print to this debug window.
* Inspect inline_script variables when an experiment is finished.

Starting experiment as ExperimentProcess-4
openexp._canvas.psycho.init_display(): waitblanking = True
openexp._canvas.psycho.init_display(): monitor = testMonitor
openexp._canvas.psycho.init_display(): screen = 0
openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
experiment.run(): experiment started at Wed Feb 07 13:46:37 2018
experiment.run(): disabling garbage collection
Compute and apply returned calibration_status_success and collected at 5 points.
experiment.end(): enabling garbage collection

Unexpected error

item-stack: experiment[run].practice_loop[run].block_sequence[run].block_loop[run].trial_sequence[run].pygaze_drift_correct[run]
exception type: IndexError
exception message: list index out of range
time: Wed Feb 07 13:48:03 2018

Traceback:
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libqtopensesame\misc\process.py", line 154, in run
exp.run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\experiment.py", line 410, in run
self.items.execute(self.var.start)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 96, in execute
self.run(name)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\loop.py", line 325, in run
self.experiment.items.execute(self._item)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 96, in execute
self.run(name)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\loop.py", line 325, in run
self.experiment.items.execute(self._item)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 96, in execute
self.run(name)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\libopensesame\item_store.py", line 115, in run
self[name].run()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\share\opensesame_plugins\pygaze_drift_correct\pygaze_drift_correct.py", line 93, in run
fix_triggered=self.var.fixation_triggered==u'yes')
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 653, in drift_correction
gazepos = self.sample()
File "C:\Users\Daniela\Desktop\OpenSesame 3.2 PY2.7\opensesame_3.2.0a30-py2.7-win32-1\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 222, in sample
gaze_sample = copy.copy(self.gaze[-1])
IndexError: list index out of range


Ideas?
Thank you
Daniela

• Hi Daniela,

Although I don't have a Tobii to test, looking at the code it's quite clear where the error comes from. I made a temporary package that should fix the issue. Could you try upgrading PyGaze and let us know if this fixes the issue?

You can do this by typing the following in the debug window:

import pip


Cheers!
Sebastiaan

I followed your advice and now both the eye tracking template and the Visual world experiment work!
I have encountered some smaller problems though:
-Python crashes quite often right at the start of the experiment, and I have to restart it.
-It seems that to move from one slide to the other, I always have to fixate the fixation dot, even when it is not present (for example to switch from the instructions to the first slide, and to switch from a slide to the next one once I have fixated the relevant referent.)

Great result overall! Thanks.
Daniela

• Hi Daniela,

Python crashes quite often right at the start of the experiment, and I have to restart it

Those types of crashes are very difficult to debug because they originate from somewhere deep down in the underlying libraries, and there's no clear error message to go by. If this is problematic for you, you can try switching to a different backend.

It seems that to move from one slide to the other, I always have to fixate the fixation dot, even when it is not present (for example to switch from the instructions to the first slide, and to switch from a slide to the next one once I have fixated the relevant referent.)

That sounds like there's a drift-correct item.

Cheers!
Sebastiaan

• Hello!
You were right about the drift_correct item, I just had to eliminate it! And it seems that Psychopy is the best backend to use.

Now I am trying to implement the last part of the roi_analysis (TODO list of the tutorial), in order to classify the data I get from Tobii in the ROIs. At the moment I only get 0s everywhere: I assume the xy coordinates from Tobii are out of the range of the ROIs defined in the Visual_World tutorial.
As the tutorial says, it is a challenging part! I'm kind of stuck...

Thank you
Daniela