mne-tools / mne-tools/mne-python
The lack of custom DIG montage is not correctly identified
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Description of the problem
I have a recording MEG + 10 EEG where a .set_montage("standard_1020") fails with:
Traceback (most recent call last):
Cell In[3], line 1
epochs.set_montage("standard_1020")
File <decorator-gen-25>:12 in set_montage
File ~/git/mscheltienne/mne-python/mne/_fiff/meas_info.py:419 in set_montage
_set_montage(info, montage, match_case, match_alias, on_missing)
File ~/git/mscheltienne/mne-python/mne/channels/montage.py:1311 in _set_montage
"coord_frame": info["dig"].pop()["coord_frame"],
IndexError: pop from empty list
It looks like it's due to custom_eeg_ref_dig being set to True here: https://github.com/mne-tools/mne-python/blob/7a91c470be872698dd21b5c76ab26c1bc3f4f10c/mne/channels/montage.py#L1176-L1189
Assuming the recording did have an electrode digitization for the EEG electrodes, but we actually skipped it. The ref_pos array is:
array([[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.],
[1., 0., 0.]])
I'll try to get some ER recordings with/without EEG channels enabled and with/without digitization to confirm on our MEG.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in mne/channels/montage.py at _set_montage and the custom_eeg_ref_dig handling around the referenced lines. Reproduce with a MEG+EEG recording using standard_1020, including the shown ref_pos case, and verify that missing or skipped digitization is identified without the IndexError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100