Skip to content

Set all types to False in pick_types #7710

Closed

Description

@cbrnr

Would it make sense to set all arguments in pick_types to False by default? In other words, currently everything is False except for meg. I know where this is coming from, but for people working with EEG, NIRS, or other non-MEG signals, we always have to include meg=False in addition to e.g. eeg=True.

Activity

  1. agramfort commented on May 1, 2020

    @agramfort
    SponsorMember
  2. larsoner commented on May 1, 2020

    @larsoner
    Member

    +1 for doing it. I wish we had done it 5 (10?) years ago but it still seems worth it in the long run. I don't think actually it will be too terrible for users (many probably will have set it explicitly anyway), but even forcing them to add True/False (when MEG channels are present) will be more explicit in their uses anyway. A potential benefit (aside from consistency) is that it could actually help them uncover some silent bugs in their code.

  3. drammock commented on May 1, 2020

    @drammock
    Member

    So then raw.pick_types() with all default arguments would be an error? Or a raw object with zero channels? :)

  4. larsoner commented on May 1, 2020

    @larsoner
    Member

    Yeah, I suppose so. Kind of a weird side effect. But if you don't ask to pick anything it's probably better that it throws an error than it silently pick one channel type...

  5. drammock commented on May 1, 2020

    @drammock
    Member

    if you don't ask to pick anything it's probably better that it throws an error than it silently pick one channel type...

    Agreed. +1 for embarking on the painful deprecation effort.

  6. hoechenberger commented on May 2, 2020

    @hoechenberger
    Member

    +1 from my end for doing this, the current behavior always felt weird to me (an EEG user).

  7. hoechenberger commented on May 2, 2020

    @hoechenberger
    Member

    @agramfort

    If you have only EEG data it's not a pb though no?

    Valid comment though. But since simultaneous recordings with different methods are gaining in popularity, I believe addressing this issue will become more and more important in the future.

  8. cbrnr commented on May 2, 2020

    @cbrnr
    ContributorAuthor

    Alright, so it looks like we agree that this must be done. I'll submit a PR.

  9. dengemann commented on May 2, 2020

    @dengemann
    Member

    I think this is a good idea. +1 from my side.

  10. agramfort commented on May 2, 2020

    @agramfort
    SponsorMember
  11. cbrnr commented on May 2, 2020

    @cbrnr
    ContributorAuthor

    The next release (0.21) should behave identically to 0.20, but a DeprecationWarning should be raised (something like "The defaults of pick_types will change in the next release. All signal types will be set to False by default (currently, meg=True by default).").

    Release 0.22 should implement the new behavior. Your examples will be:

    If you have EEG/MEG:

    raw.pick_types(meg=False, eeg=True)  # EEG only, will work as before
    raw.pick_types()  # error (no signals picked)
    raw.pick_types(eeg=True)  # new option to pick EEG only

    If you have EEG:

    raw.pick_types()  # error (no signals picked)
    raw.pick_types(eeg=True)  # need to select EEG

    If you have MEG:

    raw.pick_types()  # error (no signals picked)
    raw.pick_types(meg=True)  # need to select MEG
  12. hoechenberger commented on May 2, 2020

    @hoechenberger
    Member

    I've converted @agramfort's list to a table, which we can potentially amend as the discussion progresses.

    Type pick_types() call master behavior proposed new behavior
    EEG & MEG pick_types(meg=False, eeg=True) EEG only
    EEG & MEG pick_types() MEG only
    EEG pick_types() Error?
    MEG pick_types() MEG only
  13. cbrnr commented on May 2, 2020

    @cbrnr
    ContributorAuthor

    What is the current behavior when I pick types that don't exist? Does it raise an error? Or pick nothing (i.e. return a zero-channel object)? Or is this a no-op?

  14. hoechenberger commented on May 2, 2020

    @hoechenberger
    Member

    Updated table based on @cbrnr's and @agramfort's comments – hope I copied everything correctly.

    Type pick_types() call master behavior proposed new behavior
    EEG & MEG pick_types(meg=False, eeg=True) EEG only EEG only
    EEG & MEG pick_types() MEG only error
    EEG & MEG pick_types(eeg=True) EEG & MEG EEG only
    EEG pick_types() Error? error
    EEG pick_types(eeg=True) EEG & MEG EEG only
    MEG pick_types() MEG only error
    MEG pick_types(meg=True) MEG only MEG only
  15. agramfort commented on May 2, 2020

    @agramfort
    SponsorMember
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions