-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Interpolate blinks in eyegaze / pupil channels. #11725
Comments
I like the suggestion to start with the basics (just interp during blinks) and expand later as needed/helpful for people. I'd suggest to put in |
yes totally, sorry, I meant to say |
I like it! |
would be nice to add an option to pad data around the blinks - when you inspect blink periods in eyetracking data it's often corrupted just before/after the blink too. it's pretty common to leave some space around the blink that you also interpolate to account for this (which can vary between researchers). an option to allow this would be cool (i should say this is such a cool addition i've been using my own hacky stuff for years and tried to get it to work within mne but struggled. I just stumbled upon eyelink data now being supported) |
Describe the new feature or enhancement
While I wrap up my open PR soon, I wanted to initiate a discussion on the next task that I'd like to work on for my GSoC project.
CC @larsoner and @britta-wstnr
Proposed function:
mne.preprocessing.interpolate_blinks
(orremove_blink_artifact
). Forpupil
channelsBackground
it is a common pre-processing step in pupillometry research to interpolate missing values during blinks (see this paper, this paper, this package, and this package).
The basic idea is that blinks are very short in duration, but the pupil response is relatively slow; so it can be reasonably assumed that the pupil size during a blink was close to the pupil size values just before and just after the blink.
Use-case
Currently in
mne
, if you have aRawEyelink
object withpupil
channels, and you want to to assess the average pupil size across trials, you have to:epochs
that have a blink in them (which can result in data loss).epochs
This is because
pupil
channels contain0
's during blinks. Including blink periods inepochs.average()
would bias the result such that the the pupil size would seem to be unrealistically small!Having an
interpolate_blinks
function would help users move beyond aRaw
object to epoching the data and being able to use those epochs for analyses.Describe your proposed implementation
I propose we add a function, called
interpolate_blinks
orremove_blink_artifact
tomne.preprocessing.eyetracking
.How:
The way I am thinking about it now:
This function would accept a
Raw
object, and will rely onAnnotations
in theRaw
object that start withblink
to identify periods to be interpolated.mne.io.read_raw_eyelink
extracts any blink periods (that EyeLink wrote to the file) and stores them asmne.Annotations
. So this function would rely on thoseAnnotations
.This function would accept a parameter named something like
method
, which would accept'linear'
or'cubic_spline'
, and would use:numpy.interp
for linear interpolationscipy.interpolate.CubicSpline
for cubic-spline interpolation (see this eye-tracking paper).Summary:
So I suggest that:
pupil
channels (noteyegaze
,EEG
,MEG
,NIRS
etc.).pupil
data during saccades (There is precedent for this because pupil-size measurement is thought to be less reliable during saccades).eyegaze
channels (There is one package that does this), but AFAIK it is harder to justify interpolatingeyegaze
data, because it can change at a much faster rate / is more variable across time. I'll need to do more literature review to see how often this has been done.Describe possible alternatives
I'm open to any other ideas!
Additional context
To see an example of a file that could benefit from
interpolate_blinks
see:The text was updated successfully, but these errors were encountered: