Filtering spectral data computed from epochs

  • MNE version 1.3.1
  • Ubuntu 20.04 running in WSL vscode Jupyter

Hello! I am experimenting with spectral analysis and was wondering if there is a way to perform a notch filter on already spectrally transformed data. I computed the PSD using these settings:
epochs.compute_psd(method='welch', n_fft =var_n_fft).average()
and now would like to filter my data using a notch filter. The problem is I do not have the raw data as I imported the data using an epochs array. Here is the relevant spectrum:


I would like to filter out the peak that is around 30 hertz.

Thanks!
Jacob

I don’t know of a way to filter a spectrum. @larsoner?

FWIW, you can filter Epochs, but you’ll typically get edge artifacts. You can do a band-stop filter by setting l_freq > h_freq in the call to epochs.filter(). Or if you want to use the spectrum_fit method, you could use mne.filter.notch_filter() on your numpy array data before you create the epochs object.

I would not filter the spectrum itself but as you suggest @drammock notch filter the data, ideally at the raw stage