Using Gazepoint GP3 HD with PyGaze and OpenSesame
Hi there!
I have very recently bought a GazePoint tracker and I have been trying to test/use it with Opensesame and PyGaze. I have seen that PyGaze supports GazePoint (and that was also one of the main reason I decided to buy it).
I had a look at the page where @Edwin very kindly explains the use of his wonderful code, so I have tried to use it (attached an opensesame file with just that code fitted in).
I have already solved a couple of issues due to missing modules (lxml and pylink) as well as used the latest version of pygaze, which contains also the modification for using GazePoint.
It seems that I am almost there, but I have now hit a wall.
When trying to run the program, it is saying that:
Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
Inline script, line 20, in
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 64, in init
from pygaze._eyetracker.libeyelink import libeyelink
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze_eyetracker\libeyelink.py", line 29, in
from pygaze._eyetracker.eyelinkgraphics import EyelinkGraphics
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze_eyetracker\eyelinkgraphics.py", line 44, in
custom_display = pylink.EyeLinkCustomDisplay
AttributeError: 'module' object has no attribute 'EyeLinkCustomDisplay'
I found other people discussing such issue online, and I have not clearly understood whether it is a problem of the version of pylink used, and if yes, which one I am suppose to use.
I thank you in advance for your kind support!
Moreno
Comments
... just some follow up on things I did that have changed the problem slightly, although not solved my situation. I have downloaded the package pylink from SR Research Forum, because, apparently the one available on pip is not the correct one. I have copied it in the site-packages inside of OpenSesame. Now, when I run the code (provided above) I get this other error message:
Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
Inline script, line 20, in
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 68, in init
self.class.init(self, display, **args)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze_eyetracker\libeyelink.py", line 158, in __init__
"Error in libeyelink.libeyelink.__init__(): Failed to "
Exception: Error in libeyelink.libeyelink.init(): Failed to connect to the tracker!
what seems to be happening is that the eyetracker pygaze function is believing that the ET I am using is an SR, which is not .
I am, in fact, specifying in the inline_script that:
Display properties
DISPSIZE = (1920, 1080)
DISPTYPE = 'psychopy'
Eye tracker properties
TRACKERTYPE = 'opengaze'
This is an example script to go with the above constants.py
from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.eyetracker import EyeTracker
import pygaze.libtime as timer
Initialise the Display and a Screen.
disp = Display()
scr = Screen()
Show a waiting message.
scr.draw_text("Preparing experiment...", fontsize=20)
disp.fill(scr)
disp.show()
Open a connection to the eye tracker.
tracker = EyeTracker(disp)
Note, I am using the last version of pygaze, which allows for a gazepoint tracker:
--
if trackertype not in [u'dumbdummy', u'dummy', u'eyelink', u'smi', u'eyetribe', u'opengaze', u'tobii', u'tobii-legacy', u'tobiiglasses']:
I have also tried to give as input
tracker = EyeTracker(disp, TRACKERTYPE)
but the PC crushes (i.e., it blocks and I have to reboot).
@Edwin I am sure you are unbelievably busy, but I would truly appreciate any hint on solving this issue ... I bet if GP HD3 becomes a popular low-cost ET ... this post will be a useful guide to set it up.
thanks a lot
Hi Moreno,
we have also bought a GP3 for our lab and thanks to Edwin's help I got it running smoothly. I guess that the issue with your code is that you're not actually changing the trackertype to "opengaze" (even though you're defining the constant).
If you're setting the constants in a separate constants.py file that is in the same folder as your .osexp file, don't forget to import the constants at the beginning of your script by using:
from constants import *
does it work now?
Cheers,
Ivan
Hi Ivan,
thanks a lot for your response!
yes, it was a problem about addressing the right eye-tracker, and I needed to modify the example script provided by Edwin such that:
tracker = EyeTracker(disp, TRACKERTYPE)
I also had to update psychopy to 1.85.3 and manually install the modules: future and json_tricks, to make it work. (I am using the latest release of Opensesame 3.1.9)
Now, it did start the calibration, but it is definitely not going ok.
(1) it only displays three points on the screen on the horizontal central line; even if, in the libopengaze.py script, the default should be 9 points [line 204-206].
(2) it takes an incredible amount of time to start the calibration on the first place, and furthermore, the time between those three points is incredibly variable and unrealistically long.
(3) when I get back the visualized accuracy for R and L eyes, the errors are quite huge, but when using the Gazepoint Controller software, the calibration looks reasonably ok. (so, it should not be something to do with the hardware).
I was wondering ... would you be so kind to share here with me/us a very very simple opensesame "experiment" where we do an initial calibration, and record fixation data on 1/2 images at most? As you have a GP3 smoothly operating, it would be great if I could have a look at something that would work for you ... and see whether it does or it does not work for me.
As side notes -- and looking inside the libopengaze.py script -- there are a couple of parameters of the calibration that I believe have to be manually adjusted:
1) [line 147] self.samplerate = 60 -> I am tracking at 150Hz so this has to be changed right?
2) [line 200] caldur = {'animation':1.5, 'point':1.5, 'timeout':10.0} -> whereby (if I understood it):
is there anything else that you had to do to make it work? There are also several other parameters that may be tweaked in that script ... not sure what to touch though.
The specs of my machine are:
Windows 10 Home
Processor: Intel Core i7-6600U CPU @ 2.6 GHz 2.81 GHz
RAM: 16 GB
System type: 64-bit operating system, x64-based processor
Screen resolution: 1900x1080
Thanks a lot in advance for any help!
Hi Moreno,
I'm sorry that you haven't heard from me until now. I was very busy lately and did not check the forum again. I'm glad that you could get the GP3 running, even though you're still facing some issues.
(1) that's very weird. I have used your OpenSesame script that you provided above ("test_gazepoint.osexp") and I get a "normal" 9-point calibration. At this point, I have no clue what causes this issue, I'm sorry.
(2) and (3) Using my computer (Windows 7 Enterprise, Intel Core i7-5600U CPU @ 2.6 GHz 2.6 GHz, 8GB RAM, 64-bit operating system, screen resolution 1920x1080), it also takes some time to start with calibration (around 10seconds). However, once the screen is there, the calibration dots change quickly and with (more or less) consistent delay. Again, I'm sorry, I don't know what the problem is, especially because your computer specs seem to be better than mine.
I suggest you try another thing and start the GP3 using an OpenSesame eye-tracking element instead of an inline_script: Download pygaze-master.zip from Edwin's github page (https://github.com/esdalmaijer/PyGaze/archive/master.zip) if you haven't already. Navigate to the OpenSesame installation on your computer and then go to "/Lib/site-packages/share/opensesame_plugins" and replace the existing pygaze plugins:
pygaze_drift_correct
pygaze_init
pygaze_log
pygaze_start_recording
pygaze_stop recording
pygaze_wait
with the ones that you downloaded.
Then (re-)start OpenSesame and now you should be able to choose Gazepoint (i.e., OpenGaze) as an eyetracker when adding a pygaze_init element to your experiment. Hopefully, you can now run any existing eye-tracking experiment with your GP3 by simply changing the trackertype. Does it work? Or did you come up with another solution in the meantime? I can provide a sample script, however I'm not sure whether this really fixes your problem with the calibration.
Ivan
PS: I'm recording with a 60 Hz GP3 so I didn't change the settings. However, since you're using the GP3 HD you should change self.samplerate to 150 as you suggested.
thanks Ivan for the response!
I suspect the problem is related to the Windows 10 environment ... I am investigating the issue together with the technical support team here, I would hopefully be able to upload a simple opensesame experiment here using Gazepoint in the near future ... and provide further hints as what it is exactly happening ... I would keep you and the community posted!
thanks again,
Moreno
Thanks for helping out, @i_van!
If you've gotten any further, @moreno, please do let us know. I can only agree with Ivan: There doesn't seem to be a straightforward issue here.
Hi,
I am working with @moreno, and managed to get this working. Here are the steps I used, in case they are of use to others. This has been tested on Windows 7 and Windows 10.
Uninstall OpenSesame, and reinstall the latest version (at the moment, 3.1.9).
Install git from here: https://git-scm.com/downloads . Accept all the defaults in the installer.
Run OpenSesame as Administrator (right-click in Start Menu and "Run as Administrator")
In the Debug window, type the commands:
import pip
pip.main(['install','git+git://github.com/esdalmaijer/PyGaze','--upgrade'])
pip.main(['install','lxml','--upgrade'])
This will upgrade PyGaze to the latest development version, which has OpenGaze in it, using the built-in Python packaging system. (The newest PyGaze depends on lxml, hence the extra line).
Quit OpenSesame and restart it (this time not as administrator).
Create a minimal experiment, in the sequence there should be, in order:
Start the Gazepoint Control app and make sure your eyes are detected. You must leave this running for eye tracking to work.
Now start the OpenSesame experiment. It does take a while to start -- I don't see any way around that, unfortunately.
It will do calibration, then go on to the rest of the experiment. When you see your sketchpad item, move your eyes a bit, then press a key and wait for the experiment to end.
Next to the OpenSesame output, e.g. subject-0.csv, there will also be a PyGaze log (subject-0_log.txt) with info about the eyetracking, and then a gaze data file (subject-0.tsv). The latter is a tab-separated data file. For a key to the columns, see page 14 of the Open Gaze API docs: http://www.gazept.com/dl/Gazepoint_API_v2.0.pdf
The delay at the start is the GazePoint tracker starting up. Unfortunately, there is indeed no way around it. (It's part of the Open Gaze API, so can't be helped on our end. Sorry!)
Thanks for providing such elaborate instructions!