Skip to content

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

@CarinaFo

Description

@CarinaFo

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions