EyeLink and OpenSesame
Introduction
OpenSesame uses the PyGaze library to enable eye tracking. With this library eye tracking is possible with many eye trackers, including EyeLink. PyGaze uses PyLink, which consists of Python bindings for EyeLink to communicate with the EyeLink eye tracker. The PyGaze library is automatically installed with the OpenSesame Windows version. PyLink is however not installed automatically, and also the EyeLink Developers Kit needs to be installed, see more information below.
Setting up OpenSesame for EyeLink
Installation instructions
Follow the instructions below to set up an existing OpenSesame installation for EyeLink. For official OpenSesame instructions, see here.
- Download the EyeLink Developers Kit (can be downloaded here, an SR-research account is necessary to be able to view the thread).
- Install the PyLink package from the OpenSesame Python Console (see here for more elaborate instructions from SR research):
!pip install --index-url=https://pypi.sr-support.com sr-research-pylink
OpenSesame Conda environment with EyeLink
If you do not want to install the necessary EyeLink libraries in an existing OpenSesame installation, you can also set up a virtual OpenSesame environment through Conda, which includes all EyeLink necessities.
To run OpenSesame through Conda, a new Python environment must be created and configured. Subsequently, the OpenSesame code and all its dependencies must be downloaded and installed inside that environment.
Once the environment has been set up, the OpenSesame installed inside of it can be launched by first activating that environment, then running the opensesame command.
First, make sure that the following is installed:
- Anaconda or Miniconda
- EyeLink Developers Kit (can be downloaded here, an SR-research account is necessary to be able to view the thread)
The full process of creating a new environment, activating it and launching OpenSesame is described below.
Creating the OpenSesame Python environment
Once either Anaconda (preferred) or Miniconda has been installed, launch the “Anaconda Prompt” by clicking the Windows Start Menu icon, then typing “anaconda prompt”. Once the “Anaconda Prompt” app option has appeared, launch it by clicking it.
Now, create a new Python environment for OpenSesame and activate it (info):
conda activate opensesame-py3
Next, add the relevant channels (cogsci) and (conda-forge) and install all relevant packages. Make sure that pyqode.core and pyqode.python are >= 3.2 from the cogsci channel, and not the older versions from the conda-forge channel.
conda install python-opensesame opensesame-extension-osweb opensesame-plugin-psychopy psychopy rapunzel python-pygaze
Some packages are not available through Conda. You can use pip install for these.
pip install --index-url=https://pypi.sr-support.com sr-research-pylink
The environment has now been created, activated, configured and populated. You can now run OpenSesame (while the new environment is still active) by running:
Launching OpenSesame in the Python 3.8 Environment
To launch OpenSesame, open the “Anaconda Prompt” by clicking the Windows Start Menu icon, then typing “anaconda prompt”. Once the “Anaconda Prompt” app option has appeared, launch it by clicking it.
Now, activate the correct environment and launch OpenSesame in it by running the following commands:
opensesame
Setting up the EyeLink eye tracker
Set up the EyeLink eye tracker, make sure the EyeLink host PC is connected to the stimulus PC (on which OpenSesame is running) and set up the EyeLink network connection on the stimulus PC (see instructions here).
Common errors/issues
When you encounter the error: module 'pylink.__version__' has no attribute 'split’, the PyGaze Init does not work properly for EyeLink. See here for more info. Updating PyGaze (through the OpenSesame Python console) should fix the issue:
Or if that doesn’t work, update directly from the Git repository (Git required):
Configuring PyGaze for EyeLink
For more general information about using the PyGaze library in OpenSesame, check the PyGaze and OpenSesame page and the official OpenSesame documentation. Below, some information when working specifically with EyeLink are given.
Initialize PyGaze
Make sure to configure the pygaze_init object so that it communicates with an EyeLink eye-tracker (Select tracker type: EyeLink). Also, it is highly advised to check the Calibrate tracker option, so that the eye-tracker is calibrated at the start of the task. Finally, make sure the Pupil-size mode is set to the same mode as set on the EyeLink host PC.
Running an OpenSesame task with EyeLink
When running an OpenSesame task with EyeLink, you are presented with a menu at the start of the task. To proceed with calibration/validation or the task, use the keys described in the menu. It should be possible to use both the stimulus PC keyboard and the EyeLink PC keyboard. However, controls through the stimulus PC sometimes seem unreliable, so it is advised to use the EyeLink PC to control the calibration and validation process.
After running the task, it can take a while before all data is transferred. The EyeLink data is saved in an .edf file located in the same directory as the OpenSesame task. This type of data can be analyzed with the EyeLink Data Viewer, or custom software/scripts (limited support from SOLO research support).