Skip to content

add exclude param to Raw, Epochs and Evokeds - #14225

Merged
larsoner merged 16 commits into
mne-tools:mainfrom
CarinaFo:exclude_bads_consistent_handling
Aug 28, 2026
Merged

add exclude param to Raw, Epochs and Evokeds#14225
larsoner merged 16 commits into
mne-tools:mainfrom
CarinaFo:exclude_bads_consistent_handling

Conversation

@CarinaFo

Copy link
Copy Markdown
Contributor

Fixes #12577
First step to fix #13946 and #12197

Fix the inconsistencies mentioned in the issues above.
Currently, not every data object has a public exclude parameter in .get_data(), this is being addressed here.

The default behaviour is not changed in this PR (the Epochs object is an outlier, this will be addressed in a future PR).

To be discussed: default for exclude as this will require a deprecation cycle and is not consistent between objects.

@CarinaFo
CarinaFo requested a review from larsoner as a code owner August 26, 2026 14:16
Comment thread mne/io/base.py Outdated
def get_data(
self,
picks: str | np.ndarray | slice | None = None,
exclude: list[str] | Literal["bads"] = "bads",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is backward incompatible in this location because someone might have done
inst.get_data("meg", 0, 1) for example. This new param should go after the *

Comment thread mne/epochs.py Outdated
self,
out=True,
picks=None,
exclude="bads",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking below it looks like the old default was ()

Suggested change
exclude="bads",
exclude=(),

Can you double check the others, too? (Some of them are only implicit so might require a bit of digging)

Comment thread mne/evoked.py Outdated
def get_data(
self,
picks: str | np.ndarray | slice | None = None,
exclude: list[str] | Literal["bads"] = "bads",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I think needs to be () as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and move later in the signature

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some tiny tweaks, marking for merge-when-green, thanks in advance @CarinaFo !

Comment thread mne/io/base.py Outdated
Comment thread mne/epochs.py Outdated
Comment thread mne/epochs.py Outdated
@larsoner
larsoner enabled auto-merge (squash) August 28, 2026 09:04
@larsoner
larsoner merged commit 3acfa3f into mne-tools:main Aug 28, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants