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
pygletandpygameare supported. Support forpsychopyis 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
- Download and install the SR-Research development kit. You need to register an account to access the page.
- Create your conda environment with its own python version. For example
conda create -n eyeLinkEnv --python=3.12
- Activate it and install pylink with pip.
conda activate eyeLinnkEnv
pip install pylink
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyelink_connector-0.1.0.tar.gz.
File metadata
- Download URL: pyelink_connector-0.1.0.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e80c88b21051a4031a3390d5056ddd434026476c14be12b33b9f7360f3db317
|
|
| MD5 |
efbb7779e0bfd4912ba8c88395229cf0
|
|
| BLAKE2b-256 |
a571fb76ffb1b3ffd39a6ddf1e36e445876d1fd5f99005e1b2a141d42be9310a
|
File details
Details for the file pyelink_connector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyelink_connector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a211d7bd342a448832ad13b86da8c724cae1da2c6666edf280a554cff3ebae48
|
|
| MD5 |
f39dbbc6abd227f405f41d8c76a2cf8f
|
|
| BLAKE2b-256 |
90f9b8a32317344d69e81b45ad19ccbe0cb42acfde97a44ef69e88b7471a2a58
|