Skip to content

Compute and plot PSD for all channels #11722

@cbrnr

Description

@cbrnr

Our definition of picks is inconsistent across various functions (see e.g. #11382). Here's another example where we could make the behavior more consistent: Plotting the PSD of all channels (good and bad).

Currently, this is not possible, or at least it is not immediately obvious how to do it. I've described this in our forum: https://mne.discourse.group/t/computing-and-plotting-psd-with-all-channels/7025/1

In a nutshell:

  • The only way to include bad channels in psd = raw.compute_psd() is to explicitly list them in picks. Rather unintuitively, picks="all", picks="data", and picks="eeg" all include only good channels.
  • In addition, plotting a Spectrum object with psd.plot() has its own picks parameter. But if bad channels are not present in the first place, the recent change in v1.5 of showing all channels by default has no impact.

Here's a possible solution to improve consistency:

  • Change picks="all" to use all channels (good and bad)
  • Add picks="good" to use only good channels
  • Add picks="bad" to use only bad channels
  • Change picks="data" to use data channels (good and bad)
  • Change picks="eeg" (and other types) to use all channels of that type (good and bad)

However, this gets a bit complicated, especially when considering that at least Spectrum.plot() has an exclude parameter (which is basically the opposite of picks). I assume that only one of the two arguments can be passed, but we'd also need to translate any changes to the behavior of picks to exclude. BTW, raw.compute_psd() has no exclude parameter, which is also inconsistent.

Another option could be to add a new parameter to deal with bad channels (e.g. include_bads=True). This would make the two selections independent of each other (and probably simpler, IDK).

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