Skip to content

FIX: Handle channel dropout in eyelink files (e.g. switching from binocular to monocular mode etc) - #12847

Merged
larsoner merged 11 commits into
mne-tools:mainfrom
scott-huberty:abcct_bug_fix
Aug 11, 2025
Merged

larsoner merged 11 commits into
mne-tools:mainfrom
scott-huberty:abcct_bug_fix

Conversation

@scott-huberty

Copy link
Copy Markdown
Contributor

This is an issue as PR.

A file from one of our studies causes read_raw_eyelink to break. The file starts recording binocular data and switches to monocular data mid-way through the recording. This is something that EyeLink acquisition software allows.

Although I can't share the file, I’ve created a test that simulates the error. I'm still investigating a fix.

Potential Solutions

  • Add a Check for this scenario (binocular to monocular switch or vice versa) and raise a more informative error. The user can then regenerate their ASCII file, outputting monocular data only, which in theory should then be readable by MNE. I think this minimizes technical debt for us.
  • Devise a workaround to handle this situation, such as adding a parameter to read_raw_eyelink that reads data for one eye only. This is probably (a lot?) more development work.
  • Try to convince EyeLink (SR Research) to open-source a python reader for their format 😆

CC @anomalosepia

@scott-huberty scott-huberty changed the title TST: Make it break BUG: read raw eyelink file that switches from binocular to monocular mode Sep 12, 2024
@scott-huberty
scott-huberty marked this pull request as draft September 12, 2024 19:44
@larsoner

Copy link
Copy Markdown
Member

To me naively the easiest solution is actually to treat the data as binocular, but set one of the eyes to nan when it switches to monocular. Then if you want a "monocular instance" you just raw.drop_channels(["eye_right"]) or whatever (assuming left is the one that was on the whole time).

@scott-huberty

Copy link
Copy Markdown
Contributor Author

To me naively the easiest solution is actually to treat the data as binocular, but set one of the eyes to nan when it switches to monocular. Then if you want a "monocular instance" you just raw.drop_channels(["eye_right"]) or whatever (assuming left is the one that was on the whole time).

Hmm yeah could do.. I'll give it a try and will see how much complexity it adds.

@anomalosepia

anomalosepia commented Mar 26, 2025 via email

Copy link
Copy Markdown

@scott-huberty

Copy link
Copy Markdown
Contributor Author

Hey @anomalosepia Thanks for the ping ; )

Someone else has reported the same issue.. I will try to get to it this weekend!

@scott-huberty scott-huberty mentioned this pull request Aug 7, 2025
Havent tested the rest of the suite yet.. Will likely have to make some more fixes due to the updated code
Actually we are now catching a case  that we didn't before, which is good! That is why I adjusted test_multi_block_misc_channels, to make sure we continue to warn when the eye being tracked changes
Comment thread mne/io/eyelink/_utils.py Resolved
- I just added them there for myself when I was debugging. But type hints dont play well with the _soft_import func
- also removed some cruft comments
@scott-huberty
scott-huberty marked this pull request as ready for review August 8, 2025 13:59
@scott-huberty

Copy link
Copy Markdown
Contributor Author

Alright ready for review. Sorry that the diff is large, but the only path forward that I could see involved some refactoring. Basically now we are reading in acquisition blocks one at a time and figuring out the channels in them, and we integrating those blocks at the end (dealing with scenarios where one acquisition block is missing the pupil channel etc).

@scott-huberty scott-huberty changed the title BUG: read raw eyelink file that switches from binocular to monocular mode FIX: Handle channel dropout in eyelink files (e.g. switching from binocular to monocular mode etc) Aug 8, 2025
Comment thread mne/io/eyelink/_utils.py Resolved
Comment thread mne/io/eyelink/_utils.py Resolved
Comment thread mne/io/eyelink/_utils.py Resolved
Comment thread mne/io/eyelink/tests/test_eyelink.py Resolved
Comment thread mne/io/eyelink/tests/test_eyelink.py Resolved
scott-huberty and others added 2 commits August 8, 2025 12:23
- explicitly check that the sfreq didnt change during recording
- tell the user the implications of channel dropout

Co-authored-by: Eric Larson <[email protected]>
@larsoner

larsoner commented Aug 8, 2025

Copy link
Copy Markdown
Member

Marking for merge-when-green, thanks in advance @scott-huberty !

@scott-huberty

Copy link
Copy Markdown
Contributor Author

Hey @larsoner can you re-run that failed azure job? It looks like it timed out.

@larsoner
larsoner enabled auto-merge (squash) August 11, 2025 15:49
@larsoner
larsoner merged commit 9652572 into mne-tools:main Aug 11, 2025
WouterKroot pushed a commit to WouterKroot/mne-python that referenced this pull request Aug 13, 2025
zEdS15B3GCwq pushed a commit to zEdS15B3GCwq/mne-python that referenced this pull request Aug 25, 2025
@scott-huberty
scott-huberty deleted the abcct_bug_fix branch June 3, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants