Sets pupil samples detected as artifacts to missing. See https://dr-jt.github.io/pupillometry/ for more information.
pupil_artifact(x, n = 16, plot = FALSE, plot_trial = "all")
dataframe.
constant used to calculate threshold.
Logical. Inspect a plot of how pupil values changed?
what trial(s) to plot. default = "all"
Changes values in the column that contains pupil data.
The median absolute deviation (MAD) statistic can be used to detect changes in pupil size that are abnormally fast such that they are likely to be an artifact, such as fast changes in pupil size due to the occlusion of the pupil during a blink.
A threshold value for the speed of pupil size change is calculated based on a constant, `n`. If the speed for a given pupil size sample exceeds this threshold, then the pupil value will be set to missing in the data.
The default value of the constant is set at `n = 16`.
To inspect how the preprocesing step changed pupil size values, use `plot = TRUE`.
Warning: this will create a separate plot for every trial and therefore can be time consuming and overwhelming. The plot argument is meant for initial exploratory steps to determine the appropriate preprocessing parameters.