mne-tools / mne-tools/mne-python

Inconsistent handling of exclude='bads' in .pick() methods

Open
#13,946 4 comments 0 reactions 1 assignee View on GitHub

@CarinaFo is already working on this.

Since Aug 25, 2026.

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

Description

Proposed documentation/API change

A user, Arthur Nguyen, raised an important usability issue in the MNE forum regarding the behavior of .pick() when bad channels are present.

Currently, the behavior of exclude='bads' depends on the type of input passed to .pick():

evoked.pick('eeg', exclude='bads')

excludes channels marked as bad and returns only clean EEG channels.

However,

evoked.pick(['F1', 'F2'], exclude='bads')

returns all requested channels, including those marked as bad, effectively ignoring the exclude parameter when channels are specified explicitly by name.

The current behavior is documented but it may still be surprising to users, since the same exclude argument behaves differently depending on the type of .pick() input. Users might expect exclude='bads' to be applied consistently regardless of how channels are selected.

After discussing this with @drammock, adding a warning might not be the ideal solution here. Instead, this may point to a broader API consistency issue: channel selection and exclusion should behave the same way independent of the input type provided to .pick().

A potential refactoring would involve reviewing all .pick()-related methods and standardise their behaviour:

  • Ensure all .pick() methods have an exclude parameter
  • Make exclude behave consistently for all supported .pick() input types
  • Align the default behavior across all .pick()-related methods

Related issues:
#12577
#12197

Fixes #14013

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.