I would like to compute and plot the PSD of a
Raw object with all channels, i.e. including all “bad” channels. The
pick argument should take care of that, but it is not working for the following reason.
First, I need to compute the PSD with
psd = raw.compute_psd()
This method has a
picks argument, but no value includes bad channels except for manually specifying the names of all channels (which is something I would like to avoid, even though I could get channel names from
raw.ch_names). Also, there is no
exclude argument, which I would have set to
() as in
Second, plotting the PSD requires
I noticed that the default will change to plotting all channels (including bads) in 1.5, which is a welcome change. However, this requires that all channels are available in the
Spectrum object in the first place, which is neither the case by default nor obvious how to do it. So I think this change is probably not sufficient if the goal was to simply plot all channels by default.
Am I missing something?
Can also be the string values “all” to pick all channels
psd = raw.compute_psd(picks="all") should work, and it’s more elegant than
psd = raw.compute_psd(picks=raw.ch_names).
At least in 1.4,
picks="data" all exclude bad channels. So it looks like the default of excluding bads does not only apply if that argument is
None, but in general. I’ll check if this works in 1.5.
Unfortunately, this doesn’t work in 1.5 either.
Arf, I got baited by the description… Maybe we could have a
"bad" keys to pick respectively all, all good, and all bad channels (that last one is not that useful, but if we have a
good key, it makes sense).
Personally, my go-to solution at the moment is to provide explicitly the indices.
picks = pick_types(raw.info, meg=True, eeg=True, exclude=())
Yes, that’s what bit me too. I’d even say that the current documentation is misleading, because
"all" does not pick all channels.
I’ve opened an issue to discuss adding new values and/or changing the behavior of existing ones. Thanks!