stft on epoched data

Dear all,

I am migrating my analysis pipelines from another software to mne and I would like to test the implementation of a STFT on mne. What I would like to do is the following:
1) segment the raw data into epochs of interest (e.g. say -1 to 6 seconds around trigger) for the different experimental conditions
2) for the epoched data, take shorter time windows of e.g. 500 ms (with 250 ms overlap for consecutive windows)
3) multiply the short epochs with a Hamming (or Hann) window function to reduce edge artefacts
4) apply the FFT to the short segments to obtain power of a certain frequency band
5) average across windows and across epochs to obtain mean power for each specific condition

What is the best way to do that in mne? I thought of combining mne with scipy and use their signal.stft on the epoched object. However, I do not think that the signal.stft works well with the structure of an epoch object. Maybe I have to transform the epoch object into an array (so that the epochs for each channel are somehow merged or concatenated)? Or do you have any better idea?

Thanks in advance,

Davide

hi Davide,

what you describe is very close to what tfr_morlet does:

https://martinos.org/mne/stable/generated/mne.time_frequency.tfr_morlet.html

see for example this:

https://martinos.org/mne/stable/auto_examples/time_frequency/plot_time_frequency_simulated.html

HTH
Alex