A package to import eye tracking recording generated by SR Research Eyelink eye tracker from EDF-files.
Project description
eyelink_reader
eyelink_reader is a Python library to import eye tracking recording from EDF-files generated by SR Research EyeLink eye tracker. It includes options to import events and/or recorded samples and pasring of individual events such as saccades, fixations, blinks, recorded variables, triggers, and areas-of-interest. Please read documentation at eyelink-reader.readthedocs.io.
Installation
Please note that these instructions may be outdate, i.e., if SR Research changes its software. If that is the case, please raise an issue.
Install SR Research EyeLink Developers Kit
This package relies on edfapi library that is as part of the EyeLink Developers Kit, which can be downloaded from www.sr-research.com/support website. Note that you need to register and wait for your account to be activated. Next, follow instructions to install EyeLink Developers Kit for your platform. The forum thread should be under SR Support Forum › Downloads › EyeLink Developers Kit / API › Download: EyeLink Developers Kit / API Downloads (Windows, macOS, Linux).
Please note that this package will not work without Eyelink Developers Kit!
Specify location of the edfapi library
The package looks for edfapi either in the global environment (i.e., the folder is added to the PATH) or in a typical path for the OS. The typical locations are:
- For Windows:
c:/Program Files (x86)/SR Research/EyeLink/libs/x64 - For Mac OSX:
/Library/Frameworks - For Linux:
edpapilibrary is install in/usr/lib, so is in the global path.
If you installed EyeLink Developers Kit using defaults, the typical paths should work. However, you may have used a different folder for installation (relevant primarily for Windows) or it is possible that SR Research changed the defaults. In this case, you can specify path to the library as a parameter or set EDFAPI_LIB environment variable.
Install package via pip
pip install eyelink_reader
Usage
All the functionality in encapsulated in the EDFFile class. The minimal call that imports events but not samples and parses all possible events is
from eyelink_reader import EDFFile
gaze = EDFFile("test.edf")
Importing samples
To import samples with all fields use
gaze = EDFFile("test.edf", loadsamples=True)
In most cases, you probably only want a subset of fields, which you can specify via sample_fields parameter (for the list of fields see Samples). For example, you can only import sample time and eye position in screen coordinates, as shown below. For binocular fields, such as gx that are split into gxL and gxR in Samples table, you only need to specify the common name gx.
gaze = EDFFile("test.edf", loadsamples=True, sample_fields=["time", "gx", "gy"])
Specifying custom trial start and end messages
By default, the library assumes that trial start and end are marked by standard messages "TRIALID" and "TRIAL_RESULT", respectively. However, you can pass custom messages via start_marker_string and end_marker_string parameters.
gaze = EDFFile("test.edf", start_marker_string="TRIALID", end_marker_string="TRIAL_RESULT")
Verbose loading
For large files loading may take some seconds. If you want to monitor the process, you can enable a progress bar via verbose=True:
gaze = EDFFile("test.edf", loadsamples=True, verbose=True)
Specifying edfapi library path
As described in the section above, EDFFile searches for edfapi library in the global path, path in EDFAPI_LIB environtment library, and a typical path for the OS. However, you can also pass the path via libpath parameter:
gaze = EDFFile("test.edf", libpath="c:/Program Files (x86)/SR Research/EyeLink/libs/x64")
Parsing specific events
The events attrbiute of EDFFile is a table that contains all recorded events. For convenience, they can be parsed into
- saccades
- fixations
- blinks
- variables, see also Parsing variables section for details.
- triggers, see also Parsing triggers section for details.
- aois (areas-of-interest), see also Parsing AOIs section for details.
A specific set of events to be parsed and extract is specified via parse_events parameter. Use parse_events="all" to extract all event types (default behavior) and parse_events=None, if you do not want events to be parsed. If you only want a subset of events to be parse, pass their names as a list.
# does not parse any event
gaze = EDFFile("test.edf", parse_events=None)
# parses all events
gaze = EDFFile("test.edf", parse_events="all")
# also parses all events, as default is parse_events="all"
gaze = EDFFile("test.edf")
# also parses all events, as all are included in the list
gaze = EDFFile("test.edf",
parse_events=("saccades", "fixations", "blinks", "variables", "triggers", "aois"))
# only extracts gaze events: saccades, fixations, and blinks
gaze = EDFFile("test.edf", parse_events=("saccades", "fixations", "blinks"))
Parsing variables
Trial variabels are recorded using messages in !V TRIAL_VAR <variable> <value> format. Note that value can contain white spaces, but variable name cannot. For example, message !V TRIAL_VAR Filename Face 01.png will be parsed into Filename="Face 01.png". If wide_variables=True (default), the library pivots table, so that each trial corrresponds to a single row with column trial and one column per variable. Note that the library does not attempt to guess column types, so all values are represented as strings. If wide_variables=False or there was an exception generated by pivot opeation, the table is in the long format with columns trial, variable, and value.
Parsing triggers
Triggers are custom messages with format <trigger-marker> <label>. The marker can be specified via trigger_marker parameter and its default value is "TRIGGER".
gaze = EDFFile("test.edf", trigger_marker="TRIGGER")
The label can contain white space but marker cannot, so the label for the message "TRIGGER Initial exposure" will be "Initial exposure". The triggers are stored in a table with columns trial, sttime, sttime_rel, and label, see also triggers output table.
Parsing AOIs
Rectangular areas of interest are described via a message with format "!V IAREA RECTANGLE <aoi_index> <left> <top> <right> <bottom> <label>", the label can contain white spaces. For output table details see areas-of-interest table.
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 eyelink_reader-0.2.0.tar.gz.
File metadata
- Download URL: eyelink_reader-0.2.0.tar.gz
- Upload date:
- Size: 95.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb910cc91c4330db92555ad53e9dde3bb197b329197fbc41fc39561ff5c3ed8
|
|
| MD5 |
d5c24d0029b8be44bc485467e245a97c
|
|
| BLAKE2b-256 |
2e4cdbee6f2fd3464cd95554b2ce4c5c4a9bb0cdc556fa152868e4417c888b47
|
Provenance
The following attestation bundles were made for eyelink_reader-0.2.0.tar.gz:
Publisher:
publish-to-test-pypi.yml on alexander-pastukhov/eyelink_reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eyelink_reader-0.2.0.tar.gz -
Subject digest:
aeb910cc91c4330db92555ad53e9dde3bb197b329197fbc41fc39561ff5c3ed8 - Sigstore transparency entry: 152941403
- Sigstore integration time:
-
Permalink:
alexander-pastukhov/eyelink_reader@3293e11a6cdca905cbc1ef4002b2859eb5d077ce -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/alexander-pastukhov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@3293e11a6cdca905cbc1ef4002b2859eb5d077ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file eyelink_reader-0.2.0-py3-none-any.whl.
File metadata
- Download URL: eyelink_reader-0.2.0-py3-none-any.whl
- Upload date:
- Size: 89.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
485a7391dc7da804f23793f2019e2d42d6b1024c165569731862db09a4fa73e1
|
|
| MD5 |
0c9ff030af048cd792a2ba6734ad9d05
|
|
| BLAKE2b-256 |
a4d618f0ab90afcd5f110383b415afebb3c802748c47fc52719c974cd76b2a1c
|
Provenance
The following attestation bundles were made for eyelink_reader-0.2.0-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on alexander-pastukhov/eyelink_reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eyelink_reader-0.2.0-py3-none-any.whl -
Subject digest:
485a7391dc7da804f23793f2019e2d42d6b1024c165569731862db09a4fa73e1 - Sigstore transparency entry: 152941404
- Sigstore integration time:
-
Permalink:
alexander-pastukhov/eyelink_reader@3293e11a6cdca905cbc1ef4002b2859eb5d077ce -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/alexander-pastukhov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@3293e11a6cdca905cbc1ef4002b2859eb5d077ce -
Trigger Event:
push
-
Statement type: