EyeLink and OpenSesame

Last modified by Elio Sjak-Shie on 2022/02/01 14:07

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

If you want to use EyeLink and OpenSesame on an FSW PC, you can request support via labsupport@fsw.leidenuniv.nl.

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

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.

Launching the installed OpenSesame by running it from a desktop shortcut or from the start menu, or by double-clicking an osexp file, will not launch the OpenSesame version inside of the new environment. Instead, the OpenSesame version installed on the PC will launch in its own bundled Python runtime.

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)

If you need Anaconda/Miniconda or the EyeLink Developers Kit to be installed on an FSW PC, you can request support via labsupport@fsw.leidenuniv.nl.

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 create -n opensesame-py3 python=3.8
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 config --add channels cogsci --add channels conda-forge
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 soundfile pygame yolk3k opensesame-extension-osf python-qtpip http://files.cogsci.nl/expyriment-0.10.0+opensesame2-py3-none-any.whl
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:

opensesame

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:

conda activate opensesame-py3
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:

!pip install pygaze –upgrade

Or if that doesn’t work, update directly from the Git repository (Git required):

!pip install git+https://github.com/esdalmaijer/PyGaze.git

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). 

Tags:
   
solo
XWiki 14.10.13
contact@xwiki.com