You can use the Eyelink eye tracker with mgl and the task code. First, make sure that the mgl eyelink is compiled by following instructions here.
myscreen = eyeCalibDisp(myscreen);
To test this whole procedure, you may wish to use the stimulus program taskTemplateSaccade. This program has the subject saccade to a number of eccentric positions and back to the fixation. After you are done, you should have saved eye traces that look like ones below.
Optionally, you may also want to test eye position for significant effects across conditions, which can be tested using the function (see help in function):
mglCheckEyepos
A simple GUI that allows you to set parameters for the EyeLink eye tracker. You can set the whether you want 5 or 9 calibration points (set calibrationType to HV5 or HV9, respectively). You can set the sample rate and which data you want to save. You can also set the calibration area - the area of the screen that you want to use for calibration. Sometimes it is useful to move the calibration in from the edges of the screen when you are having trouble getting pupil lock at far eccentricities.
getTaskEyeTraces can be used to load the eye tracker data. It works like getTaskParameters, but also returns the eye traces sorted by trial. You can load up the data for an experiment. For example, from a run of taskTemplateSaccade
>> getTaskEyeTraces('100811_stim01') (getTaskEyeTraces) Opening edf file /Users/justin/data/eyetracker/10081101.edf took 3 secs 374 ms (getTaskEyeTraces) Extracting trial by trial data for 63 trials took 0 secs 842 ms (getStimvolFromVarname) taskNum=[1], phaseNum=[1], segmentNum=[1] (getstimvol) Same trial in multiple conditions. (getStimvolFromVarname) targetAngle=0.0000000 targetRadius=8.0000000: 3 trials (getStimvolFromVarname) targetAngle=45.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=90.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=135.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=180.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=225.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=270.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=315.0000000 targetRadius=8.0000000: 4 trials (getStimvolFromVarname) targetAngle=0.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=45.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=90.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=135.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=180.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=225.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=270.0000000 targetRadius=12.0000000: 4 trials (getStimvolFromVarname) targetAngle=315.0000000 targetRadius=12.0000000: 4 trials
This will return a structure similar to the one returned by getTaskParameters except there will be an “eye” field:
ans = nTrials: 63 trialVolume: [1x63 double] trialTime: [1x63 double] trialTicknum: [1x63 double] trials: [1x63 struct] blockNum: [1x63 double] blockTrialNum: [1x63 double] response: [1x63 double] reactionTime: [1x63 double] originalTaskParameter: [1x1 struct] responseVolume: [1x63 double] parameter: [1x1 struct] stimfile: [1x1 struct] eye: [1x1 struct]
This will have the eye position data sorted by trial:
ans = hPos: [63x2002 double] vPos: [63x2002 double] pupil: [63x2002 double] time: [1x2002 double]
Note that hPos and vPos fields contains eye position data with respect to the center of the screen in degrees.
It will also display a figure (this can be turned off by setting the input parameter dispFig=0) of the eye position data sorted by trial type