mne-tools / mne-tools/mne-python

Unexpected drop_log behaviour when subsetting epochs

Open
#12,953 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Description of the problem

Bad epoch from irrelevant condition isn't marked as "IGNORED" in drop_log.

Expected results

"IGNORED" is added to the irrelevant epochs even when they're bad.

Actual results

For example: I have only two conditions, either 'stim' or 'blank'.
For epochs['stim'].drop_log the output is:
(('IGNORED',), (), ('EEG044',), (), (), ...
While epochs['blank'].drop_log returns:
((), ('IGNORED',), ('EEG044',), ('IGNORED',), ('IGNORED',), ...

Note how the third epoch isn't ignored in either condition.

Additional information

Platform Windows-11-10.0.22631-SP0
Python 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]
Executable c:\Users\gennadiyb\Documents\erp.venv\Scripts\python.exe
CPU Intel64 Family 6 Model 158 Stepping 10, GenuineIntel (12 cores)
Memory 31.9 GB

Core
├☑ mne 1.8.0 (latest release)
├☑ numpy 2.1.2 (OpenBLAS 0.3.27 with 12 threads)
├☑ scipy 1.14.1
└☑ matplotlib 3.9.2 (backend=module://matplotlib_inline.backend_inline)

Numerical (optional)
├☑ pandas 2.2.3
└☐ unavailable sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py

Visualization (optional)
├☑ qtpy 2.4.1 (PyQt6=6.7.1)
├☑ pyqtgraph 0.13.7
├☑ mne-qt-browser 0.6.3
├☑ ipywidgets 8.1.5
└☐ unavailable pyvista, pyvistaqt, vtk, ipympl, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with epochs['stim'].drop_log and epochs['blank'].drop_log, then trace the epoch-subsetting and drop_log handling paths. Add a regression test covering bad epochs from irrelevant conditions, and consider the issue done when irrelevant epochs are marked "IGNORED" in both subsets.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.