How to get real-number results when perform continuous wavelet transform

hello guys, I got a complex number matrix when use mne.time_frequency.tfr.cwt. Is there a way to perform cwt but get Real number results instead? thanks.

  • MNE version: 1.1.1
  • operating system: Windows-10-10.0.19045-SP0
Ws = mne.time_frequency.morlet(sfreq=1024, freqs=np.array([10, 20]), n_cycles=2)
tfr = mne.time_frequency.tfr.cwt(X=sample, Ws=Ws, decim=1)

“cwt” stands for “complex wavelet transform”. It is, by definition, complex-valued, as indicated by the first sentence of

The complex wavelet transform (CWT) is a complex-valued extension to the standard discrete wavelet transform (DWT).

If you want a time-frequency decomposition that is real-valued, you can use mne.time_frequency.tfr_morlet — MNE 1.2.0 documentation :

mne.time_frequency.tfr_morlet(epochs_or_evoked, ..., output='power')

note that this is different from mne.time_frequency.tfr.morlet() which just generates the wavelets without applying them to your data.