raw.compute_psd() not working on acceleration data

Hello!

My raw has acceleration channels (bio type) added to EEG data and I tried to use raw.compute_psd() on it. Tried to use raw.compute_psd(picks = []) with channel names, type and preselected channels with pick_channels() and none of them works.

I got different kinds of Errors:

ValueError: picks (NoneNone, treated as "data") yielded no channels, consider passing picks explicitly

or

ValueError: All picks must be < n_channels (67), got 67

or

ValueError: picks (['accx', 'accy', 'accz']) could not be interpreted as channel names (no channel "['accx', 'accy', 'accz']"), channel types (no type "accx"), or a generic type (just "all" or "data")

I had a similar issue with mne.filter.notch_filter and had to use raw.notch_filter(...) because mne.filter.notch_filter is for np.ndarray s only. Is this the case here as well? What could I use instead?

The legacy version mne.viz.plot_raw_psd(raw, picks=['accx', 'accy', 'accz']) works but with a slight bug (?). We work with 2 Hz movements, and on the psd plot it shows the peek slightly on the left.

Thank you for any help!

Hello,

Using the stable version of MNE (1.3), compute_psd and its plot method does work if you provide the channel name explicitly.

from mne.datasets import sample
from mne.io import read_raw_fif


directory = sample.data_path() / "MEG" / "sample" 
raw = read_raw_fif(directory / "sample_audvis_raw.fif")
raw.pick_types(eog=True)
raw.load_data()
raw.set_channel_types({"EOG 061": "bio"})
raw.rename_channels({"EOG 061": "fakeAcce"})
spectrum = raw.compute_psd(picks="fakeAcce")
spectrum.plot(picks="fakeAcce")

Note that providing multiple channel as a list works too:

spectrum = raw.compute_psd(picks=["fakeAcce"])
spectrum.plot(picks=["fakeAcce"])

The channel name must be provided explicitly because bio channels are not considered as data channels. See this glossary entry: Glossary — MNE 1.3.1 documentation

Mathieu

Hi Mathieu,

Thank you for your answer! I’ve been using the stable verion, it seems like the problem was me not giving the explicit channel names for both the raw.compute_psd and .plot commands.

Thanks again,
Fanni