detect.fixations: Detect Fixations in a Stream of Raw Eye-Tracking Samples

Description Usage Arguments Value Details Author(s) References See Also Examples

View source: R/saccade_recognition.R

Description

Takes a data frame containing raw eye-tracking samples and returns a data frame containing fixations.

Usage

1
2
detect.fixations(samples, lambda = 15, smooth.coordinates = T,
  smooth.saccades = T)

Arguments

samples

a data frame containing the raw samples as recorded by the eye-tracker. This data frame has four columns:

time:

the time at which the sample was recorded

trial:

the trial to which the sample belongs

x:

the x-coordinate of the sample

y:

the y-coordinate of the sample

Samples have to be listed in chronological order. The velocity calculations assume that the sampling frequency is constant.

lambda

a parameter for tuning the saccade detection. It specifies which multiple of the standard deviation of the velocity distribution should be used as the detection threshold.

smooth.coordinates

logical. If true the x- and y-coordinates will be smoothed using a moving average with window size 3 prior to saccade detection.

smooth.saccades

logical. If true, consecutive saccades that are separated only by a few samples will be joined. This avoids the situation where swing-backs at the end of longer saccades are recognized as separate saccades. Whether this works well, depends to some degree on the sampling rate of the eye-tracker. If the sampling rate is very high, the gaps between the main saccade and the swing-back might become too large and look like genuine fixations. Likewise, if the sampling frequency is very low, genuine fixations may be regarded as spurious. Both cases are unlikely to occur with current eye-trackers.

Value

a data frame containing the detected fixations. This data frame has the following columns:

trial

the trial to which the fixation belongs

start

the time at which the fixation started

end

the time at which the fixation ended

x

the x-coordinate of the fixation

y

the y-coordinate of the fixation

sd.x

the standard deviation of the sample x-coordinates within the fixation

sd.y

the standard deviation of the sample y-coordinates within the fixation

peak.vx

the horizontal peak velocity that was reached within the fixation

peak.vy

the vertical peak velocity that was reached within the fixation

dur

the duration of the fixation

Details

This function uses a velocity-based detection algorithm for saccades proposed by Engbert and Kliegl. Anything between two saccades is considered to be a fixation. Thus, the algorithm is not suitable for data sets containing episodes of smooth pursuit eye movements.

Author(s)

Titus von der Malsburg malsburg@posteo.de

References

Ralf Engbert, Reinhold Kliegl: Microsaccades uncover the orientation of covert attention, Vision Research, 2003.

See Also

diagnostic.plot, calculate.summary

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(samples)
head(samples)
fixations <- detect.fixations(samples)
head(fixations)
## Not run: 
first.trial <- samples$trial[1]
first.trial.samples <- subset(samples, trial==first.trial)
first.trial.fixations <- subset(fixations, trial==first.trial)
with(first.trial.samples, plot(x, y, pch=20, cex=0.2, col="red"))
with(first.trial.fixations, points(x, y, cex=1+sqrt(dur/10000)))

## End(Not run)

Example output

Loading required package: zoom
  time     x      y trial
1    0 53.18 375.73     1
2    4 53.20 375.79     1
3    8 53.35 376.14     1
4   12 53.92 376.39     1
5   16 54.14 376.52     1
6   20 54.46 376.74     1
  trial start  end        x         y      sd.x     sd.y    peak.vx    peak.vy
0     1     0   71 53.81296 377.40741 0.5409335 1.089680  0.5283333  0.7550000
1     1    92  276 39.68156 379.58711 1.1832069 1.730369 -1.6383333 -1.0833333
2     1   297  376 59.99267 379.92467 1.5042476 1.068207  2.0016667  1.1816667
3     1   426  573 18.97898  56.94046 1.0980458 2.876349  1.5233333 -2.1216667
4     1   606 1586 40.28365  39.03599 2.1135052 2.400781  2.3116667 -2.0083333
5     1  1602 2912 47.36547  35.39441 2.0214823 1.268885  1.9233333  0.8766667
   dur
0   71
1  184
2   79
3  147
4  980
5 1310

saccades documentation built on May 2, 2019, 5:55 a.m.