This is a collaborative space. In order to contribute, send an email to maximilien.chaumon@icm-institute.org
On any page, type the letter L on your keyboard to add a "Label" to the page, which will make search easier.

Eyelink basic preprocessing with dataHandler


Prerequisite

You need the Eyelink recording files in the original .edf format.

You also need access to the Eyelink software, Matlab, and dataHandler.

Goal of this tutorial

This tutorial teaches you how to read the Eyelink files and create markers corresponding to the different eye-related events (blinks, saccades) using dataHandler. These markers can be used as events for MEG data analysis.

Step-by-step guide




1. The Eyelink data files

a. During acquisition

The name you choose for this file has to be short, otherwise it can create problems when saving the data. When saving the data with your stimulation script, you need to leave some time for the system to save the file (with a command waitsecs after the command to save the Eyelink data, for example), otherwise the file will be corrupted or not saved.

b. Data conversion after acquisition

Eyelink data is saved in .edf format by the software. After your recordings, you have to convert the .edf file to .asc. You can use the Eyelink software installed in the stimulation computer at the MEG.

c. Inside the data file

The .asc data file can be viewed as a text file, using the command

gedit run1.asc
An example .asc file
** CONVERTED FROM C:\manips\XXX.edf using edfapi 3.1 Win32 Nov 24 2009 on Thu Oct 01 17:29:36 2015
** DATE: Fri Sep 25 10:43:59 2015

[[ A lot of header text was removed here for clarity. ]]

START	90220983 	RIGHT	SAMPLES	EVENTS
PRESCALER	1
VPRESCALER	1
PUPIL	DIAMETER
EVENTS	GAZE	RIGHT	RATE	1000.00	TRACKING	CR	FILTER	2
SAMPLES	GAZE	RIGHT	RATE	1000.00	TRACKING	CR	FILTER	2
MSG	90220983 !MODE RECORD CR 1000 2 1 R
90220983	  685.8	  446.1	 5794.0	...
INPUT	90220983	0
90220984	  685.9	  446.0	 5796.0	...
90220985	  685.5	  445.9	 5799.0	...
90220986	  684.8	  445.8	 5799.0	...
90220987	  684.4	  445.8	 5800.0	...
90220988	  684.7	  445.8	 5801.0	...
90220989	  685.2	  445.8	 5801.0	...
SFIX R   90220990
90220990	  685.9	  445.9	 5801.0	...
90220991	  686.0	  446.0	 5801.0	...
90220992	  685.5	  446.0	 5802.0	...
90220993	  684.8	  446.1	 5803.0	...
90220994	  684.2	  446.2	 5802.0	...
90220995	  684.6	  446.2	 5801.0	...

[[ The file goes on...]]

90221820	  663.8	  468.3	 5514.0	...
90221821	  663.7	  467.8	 5514.0	...
90221822	  663.5	  467.9	 5515.0	...
90221823	  663.4	  467.6	 5516.0	...
90221824	  662.9	  467.2	 5515.0	...
EFIX R   90221475	90221824	350	  655.1	  475.1	   5879
SSACC R  90221825
90221825	  662.5	  466.5	 5513.0	...
90221826	  662.3	  466.2	 5509.0	...
90221827	  663.0	  466.3	 5507.0	...
90221828	  663.8	  466.8	 5499.0	...
90221829	  664.8	  467.3	 5493.0	...
90221830	  666.2	  467.7	 5489.0	...
90221831	  668.4	  468.2	 5491.0	...
90221832	  671.4	  468.7	 5492.0	...
90221833	  674.4	  468.9	 5490.0	...
90221834	  677.2	  468.9	 5483.0	...
90221835	  680.1	  469.0	 5476.0	...
90221836	  682.4	  470.1	 5471.0	...
90221837	  686.0	  471.5	 5471.0	...
90221838	  689.2	  472.9	 5473.0	...
90221839	  693.8	  473.4	 5476.0	...
90221840	  698.0	  473.7	 5479.0	...
90221841	  704.0	  474.0	 5475.0	...
90221842	  710.0	  474.3	 5468.0	...
90221843	  716.4	  474.5	 5458.0	...
90221844	  720.7	  474.3	 5452.0	...
90221845	  723.7	  474.0	 5444.0	...
90221846	  725.1	  473.4	 5437.0	...
90221847	  726.0	  472.5	 5432.0	...
90221848	  726.8	  471.1	 5430.0	...
90221849	  727.5	  469.8	 5429.0	...
90221850	  727.5	  468.6	 5427.0	...
90221851	  726.6	  468.0	 5424.0	...
ESACC R  90221825	90221851	27	  662.5	  466.5	  726.6	  468.0	   2.53	    183
SFIX R   90221852
90221852	  725.6	  467.4	 5423.0	...
90221853	  725.1	  467.3	 5424.0	...

[[ And the file goes on...]]

This file contains a header with information related to the acquisition (date, Eyelink version, format conversions performed…). You will also see information about the calibration(s) data were done, and then 4 columns of numeric values: the 1st column is the sample number, the 2nd column is the x coordinate of the eye position on the screen, the 3rd column is the y coordinate, and the 4th column is the pupil diameter.

Some eye-related events are automatically identified by Eyelink:

  • Fixation: SFIX and EFIX for start and end fixation
  • Saccades: SSACC and and ESACC for start and end fixation

Next to EFIX and ESACC, the numbers indicate the sample corresponding to the end of fixation/saccade, the sample corresponding to the start of the fixation/saccade, the duration of the fixation/saccade, the x, y coordinates and the pupil diameter.




2. Creating markers with Eyelink information

a. Insert markers

To insert Eyelink markers from a run1.asc file on a run1_trans_tsss.fif file, you can use the following dataHandler command on a terminal:

dataHandler -r -edf run1.asc run1_trans_tsss.fif

You can also run this command from matlab, by doing the following:

str_Eyelink = 'dataHandler -r -edf run1.asc run1_trans_tsss.fif';
command(str_Eyelink)

For help on this dataHandler function, type from a terminal:

dataHandler -help -edf

b. What are these Eyelink markers

Eyelink markers are saved in run1_trans_tsss.mrk. You will find different sorts of markers:

  • EL_SBLINK_R, EL_EBLINK_R: these indicate the beginning (SBLINK) and the end (EBLINK) of blinks. '_R' indicates the eye chosen during the recording ('_R' for right or '_L' for left).
  • EL_SSACC_R_0, EL_ESACC_R_0, EL_SSACC_R_1, EL_ESACC_R_1...: beginning (SSACC) and end (ESACC) of a saccade. 'R_' indicates the eye chosen during the recording ('_R' for right, '_L' for left). The number indicates the amplitude in degrees of visual angle: 0 for angles < 1 degree, 1 for angles < 2 degrees…, 5 for angles > 5 degrees.

No information about the pupil diameter is entered automatically. You will have to read it yourself, either by reading the .asc file, or by using the acquisition data channel where Eyelink pupil diameter data was sent to at recording.

c. How to read these markers with fieldtrip

 You can read the .mrk file using the function my_ft_read_event. For more information, see 'Computing ERPs'.




3. Some adjustments and checks to make

a. Visualize the markers

To visualize the markers, you can open your .fif data file with Muse, it will automatically read the corresponding .mrk file containing the Eyelink markers.

You will be able to browse through the data, especially EOG if you had it recorded, to check that the markers are where they should be.

You can also visualize the 3 channels on your data file containing the Eyelink data (x coordinate, y coordinate and pupil diameter), usually set up at acquisition.


Example of saccades: The first two channels correspond to the position of the eye on the screen, the last channel corresponds to pupil diameter. The markers here indicate the beginning and end of saccades. You can see that the second saccade (EL_SSACC_R_2 / EL_ESACC_R_2) was larger than the others (EL_SSACC_R_0 / EL_ESACC_R_0). The first saccade was defined only along the x-axis (horizontal eye movement).


Example of blink: You can see here the occurrence of a blink, delimited by the red markers. Note how this blink was preceded and followed by a saccade, corresponding to the eye movement associated with the blink. Note also how blinks affect all measures (position on the screen and pupil diameter).

b. Incorrect pupil diameter data

It can happen that Eyelink is not able to measure the pupil diameter, so you will see saturated signal. This may not be detected by any automatic Eyelink marker, so you have to check for that.

c. Blink time window

If the precise time window defining a blink is of some importance for your analysis, you should check the Eyelink blink markers. The blink window defined is typically rather restricted, so you may want to add some extra timing before and after, to extend the blink time window. For example, in the figure above illustrating a blink, you can see how the red markers delimiting the blink could have been extended in order to catch all the blink event.

Related articles