Getting Started: Analysing Smooth Pursuit Data in Matlab
The attached Matlab script takes a Sample Report from Data Viewer, and outputs some basic smooth pursuit metrics. It expects the sample report to contain target position data - please see section 7.3.7 of the Data Viewer manual for details of how to send target position messages from your stimulus presentation script. If you are using Experiment Builder, you can take a look at the Pursuit example(File > Examples > Pursuit).

You can have multiple participants in the same Data Viewer session and recordings can be monocular or binocular.

The analysis script assumes that every fixation identified in Data Viewer is pursuit eye movements (pursuit will typically not be marked as a saccade event by the EyeLink). This might be considered crude and there are other, more sophisticated ways of identifying pursuit, which are not listed in this post.

First import your edf file/s in a new Data Viewer session, create an interest period based on the section of trial you are interested in, then click on the Preferences tab in the inspector, go to Preferences > Output/Analysis and change the “Missing Value” property to NaN rather than dot (.) so Matlab can parse missing data more easily. Then output a sample report (Analysis > Reports > Sample report) and either include all variables or at least include the following variables:


Save the resulting .txt file. Run the pursuitDV.m script (attached) which will open a dialog box and ask for a sample report .txt file. It will then ask for a directory where you want the results file to be saved. The Matlab results file will contain the following columns:

SESSION_LABEL (edf file name)
TRIAL_INDEX (trial index)
FIX_INDEX (fixation index)
START_EDF_TIME (edf time at the start of fixation event)
END_EDF_TIME (edf time at the end of the fixation event)
DURATION (duration of the fixation event or section of pursuit)
VEL_GAIN (velocity gain)
RMSE_GAZE (RMSE values for gaze vs target position)

Each row of the Matlab report will be a separate "fixation" (i.e. a section of pursuit). The script can handle data collected monocularly (from the left or right eye) or binocularly within the same Data Viewer sample report. If the data is binocular, it reports data from both left and right eye separately. The pursuit target can be sinusoidal, constant velocity, and in any direction including circular. The script ignores samples where the target is missing. Velocity gain is calculated by dividing the averaged gaze angular velocity by the averaged target velocity during each section of "fixation". RMSE gaze is calculated by measuring the angular distance between target and gaze for every sample within a fixation followed by sqrt(x) ^2.

Attached Files
.m   pursuitDV.m (Size: 5.25 KB / Downloads: 40)