raw.compute_psd() not working

Hello,

The method compute_psd() is not working when following this tutorial:
https://mne.tools/stable/auto_tutorials/time-freq/10_spectrum_class.html

I get the error: AttributeError: 'Raw' object has no attribute 'compute_psd'
As a positive control, I tried raw.plot_psd(), and that worked fine.

Can you please advise? Many thanks!

    mne.datasets.sample.data_path()
    sample_data_folder = mne.datasets.sample.data_path()
    sample_data_raw_file = (sample_data_folder / 'MEG' / 'sample' /
                        'sample_audvis_raw.fif')
    raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=60)
    raw.plot_psd()
    raw.compute_psd()

Platform: macOS-12.4-arm64-i386-64bit
Python: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:41:22) [Clang 13.0.1 ]
mne: 1.1.1

Hello, I believe you need MNE-Python 1.2 for this.

@drammock the API docs don’t mention when this method first appeared, this should probably be added?

Beste wishes,
Richard

2 Likes

Works like a charm with MNE-Python 1.2. Thank you for your quick help!

soon they will: Spectrum-related docs tidying by drammock · Pull Request #11259 · mne-tools/mne-python · GitHub

1 Like

Hi Richard,
Does the compute_psd() removed in the later release?
I am using mne=1.6.0, and I got the following error:
AttributeError: ‘RawEDF’ object has no attribute ‘computer_psd’.

Could you please advise?

Regards,
Long

you should now use:

https://mne.tools/dev/generated/mne.time_frequency.Spectrum.html

Alex

1 Like

I think you have a typo there. It’s compute_psd, not computer_psd.

Richard

my bad, sorry.