Description
Describe the new feature or enhancement
The original Eyelink blink detection algorithm simply parses blinks when pupil becomes indetectable. However, this approach ignores the temporal dynamics of the opening/closing of eyelids. One existing solution is mne.preprocessing.eyetracking.interpolate_blinks
which interpolates data in a fixed-duration buffer zone before and after a blink. The algorithm is effective but not adaptive enough to account for individual and trial-to-trial differences.
Instead, a new method (https://doi.org/10.3758/s13428-017-1008-1) makes use of pupilometry noise and sharp slopes that precede and follow the blinks. The Python code is publically available at https://osf.io/jyz43/ thanks to @titoghose. The OSF repo has no indicated license, but we hope that's OK @titoghose if we adapt the code for MNE.
@AlexLepauvre and I can make a quick adaptation of the original code and make the algorithm available to everyone using MNE to analyze pupilometry data.
Describe your proposed implementation
New function
mne.preprocessing.eyetracking.find_blinks_by_slope(
raw,
concat=False,
concat_gap_interval=100,
description='BAD_blink'
)
raw
is the Raw
object storing eye-tracking data that at least has one channel named 'pupil_*'.
concat
controls whether to concat nearby blinks.
'concat_gap_interval' determines the interval between successive missing samples/blinks to concatenate.
description
determines the annotation description for the newly detected blinks. If set to 'BAD_blink' will also replace the existing 'BAD_blink' annotations.
The function will try to look for all 'pupil_*' channels and perform the detection. The detected blink events will be saved as annotations with ch_names
set to the channel they were detected from.
Describe possible alternatives
mne.preprocessing.eyetracking.interpolate_blinks
, but it lacks the flexibility to detect individual blinks.
Additional context
No response