Skip to main content

A small EyeLink 1000+ connector class using pylink and supporting pygame and pyglet applications.

Project description

EyeLink Connector Class for Pygame and Pyglet

pylink is an awesome interface and offers great flexibility.
However, when setting up an eye-tracking application, you may want something with a bit higher-level interface.

Also, it seems it only supports calibration for the backends psychopy and pygame, and not for pyglet.

So, here we go: An EyeLink Connector Class developed for and tested on the EyeLink 1000+ with python>=3.10 on Windows.


Current limitations

  • Currently pyglet and pygame are supported. Support for psychopy is coming soon.

Installation

If you want to use it only for pygame OR pyglet, see below.

Install the package

pip install pyelink-connector

If you want to install only the dependencies for pygame use

pip install pyelink-connector[pygame]

If you want to install only the dependencies for pyglet use

pip install pyelink-connector[pyglet]

If you have no running pylink version for your EyeLink 1000 + yet, also see Installing pylink below.

Dependencies

The pylink_connector was built for the following packages

  • pygame-ce==2.5.3
  • pyglet==2.0.15

Other versions might work as well.

It further requires software by SR-Research.

Installing pylink

System wide python

You can find some support for installing pylink for communicating with an EyeLink, for example, on the SR-Research forum.

I have not tested their suggestion, because I was using a conda python environment.

Using conda or other virtual python environments

When working with a conda environment, only installing pylink with pip to was not sufficient to communicate with the EyeLink 1000 + in my case. I figured out the following procedure to install pylink for communicating with an EyeLink

  1. Download and install the SR-Research development kit. You need to register an account to access the page.
  2. Create your conda environment with its own python version. For example
conda create -n eyeLinkEnv --python=3.12
  1. Activate it and install pylink with pip.
conda activate eyeLinnkEnv
pip install pylink
  1. Windows specific: Copy the pylink files that came with the development kit to the site-packages folder of pylink of your environment. You can adapt the example below to your needs.

Example: Assuming - you installed the SR development kit to C:\Program Files (x86)\SR Research\ - the python packages of your conda environment are located at C:\Users\USERNAME\.conda\envs\eyeLinkEnv\Lib\site-packages - and you are using 3.12... then you can copy the contents of C:\Program Files (x86)\SR Research\EyeLink\SampleExperiments\Python\64\3.12\pylink to C:\Users\USERNAME\.conda\envs\eyeLinkEnv\Lib\site-packages\pylink\

Usage

Minimum example with pygame

from pyelink_connector.pygameConnector.pygame import EyeConnector

settings = {
        "render_fps": 60,
        }

pygame.init()

surface = pygame.display.set_mode(depth=0, display=0, vsync=1, flags=pygame.FULLSCREEN)

eyeConnector = EyeConnector(win=surface, prefix="TEST")
eyeConnector.openFile(file_name="pga")

# Perform calibration and validation
eyeConnector.runSetup(settings=settings)

self.eyeConnector.startRecording(msg="test trial start")

# show your stimuli
...

self.eyeConnector.stopRecording()

self.eyeConnector.downloadFile()
eyeConnector.close()

You can find more examples for pygame or pyglet on github.

Contact & Support

I am happy for any bug reports or feature requests! Please use github for these.

If the pyelink-connector was helpful to you and you feel like supporting, you are welcome to buy me a coffee or simply reach out and tell me how you made use of this package!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyelink_connector-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyelink_connector-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page