/CPET

Continuous Psychophysics with Eye Tracking: A MATLAB Based Program for Estimation of Contrast Sensitivity and Assessing Refractive Errors.

Primary LanguageMATLAB

Continuous Psychophysics with Eye Tracking (CPET)

Author: Ethan Pirso

Research Supervisor: Dr. Curtis L. Baker, McGill Vision Research

I would like to acknowledge the valuable contributions and guidance provided by my research supervisor, Dr. Baker. Their expertise and support have been instrumental in shaping my research work and improving the experiment program.

Description

CPET is a MATLAB application for conducting continuous tracking experiments with an EyeLink eye tracker. It includes functions for initializing the stimulus, collecting gaze data, calculating position errors, and updating the stimulus position based on specified distributions. The application collects eye movement data and determines the contrast threshold of a subject. Data is saved in a structured format, and plots can be generated for analysis. The data can be used to assess contrast sensitivity and perform refraction.

Contents

CODE folder

1. calc_freq_cpd.m: Calculates the required 'freq' parameter for a Gabor patch in Psychtoolbox based on the desired frequency in cycles per degree (CPD), screen size in centimeters, screen size in pixels, and viewing distance in centimeters.
2. calc_ppd.m: Calculates 'pixels_per_degree' parameter used when setting the velocity of a curvilinear trajectory stimulus in visual degrees per second.
3. closeEyelink.m: Stops EyeLink data acquisition, closes the EDF file, downloads the output file, and shuts down the EyeLink system.
4. collectData.m: Collects eye gaze data from the Eyelink and updates stimulus position data.
5. drawStim.m: Draws the stimulus in the Psychtoolbox window and flips screen.
6. estimateError.m: Calculates position error in real-time and uses MAD as an early trial stopping criterion.
7. generateRefractiveSeries.m: Generates a refractive series for a subject based on a range of trials, plots the series, and identifies the 'best' diopter. Saves the plot and all data to files.
8. initEyelink.m: Initializes the Eyelink eye tracker and configures the calibration type.
9. initStim.m: Initializes the position and properties of the stimulus.
10. initWin.m: Sets up the Psychtoolbox (PTB) window and defines screen parameters.
11. params.m: Initializes various parameters for the experiment, such as stimulus type, stimulus size, viewing distance, spatial frequency, step size, dwell time, and contrast step size.
12. plotData.m: Generates plots of the target and subject gaze positions, normalized position error, and contrast.
13. prefs.m: Sets preferred stimulus parameters.
14. runCPET.m: Main script to run the tracking experiment, collect data, and save results.
15. updateStim.m: Updates the position of the stimulus based on the specified distribution and movement type.
16. wpolyfit.m: Function for fitting a weighted polynomial to data.

DATA folder

The folder to serve as storage for experiment data, created after running the program. EyeLink Data Files (.EDF) are stored in the EDF subfolder. EyeLink Data Files (.EDF) will be stored in the EDF subfolder, MATLAB plots (.fig) generated by plotData.m will be stored in the FIG subfolder, and the MATLAB data file (.mat) containing subject information, trial settings, and tracking data will be stored in the MAT subfolder.

DEMOS folder

1. gaborWalk.m: A demo script to display a Gabor patch following a random walk trajectory.
2. trackGaze.m: A demo script for gaze tracking using the EyeLink eye tracker.

STIMULI folder

Contains the images for Aukland Optotypes and Marmoset stimuli.

Getting Started

To begin using CPET, navigate to the CODE folder and run the runCPET.m script. This script will execute the tracking experiment, collect data, and save results.

To run in 'demo' mode without EyeLink, enter '1' when prompted in the runCPET.m script. The program will only play the stimulus on screen and no subject data is collected or saved.

For refractive analysis, you can run the generateRefractiveSeries.m script after completing a range of trials with a subject. This script will help in understanding how the subject's contrast thresholds vary with different diopters, which is crucial in determining the 'best' lens power for the subject. The generated plot and all extracted data will be saved for future reference.

For further information, please read the 'CPET Guide.pdf' and review the docstrings of each script for more details of the program and its features.

Dependencies

• MATLAB
• Psychtoolbox
• EyeLink SDK (for eye tracking)