How interpret the time_frequence.EpochsSpectrum().get_data() output

Dear all,

I am currently making some tests with MNE on 3 random channels. I wanted to compute PSD of two populations and compare these two populations.
I thought to use the following line code to do that:
psds, freqs = mne.time_frequency.EpochsSpectrum(Epochs, "welch", fmin = 2, fmax = 100, tmin = 0, tmax = 30, picks = "eeg", proj = False, n_jobs = 1).get_data(return_freqs = True)

However, it returns a list of 5 times 3 lists looking like that:

[
[[1 2 3 4...] [1 2 3 4...] [1 2 3 4...]] 
[[1 2 3 4...] [1 2 3 4...] [1 2 3 4...]] 
[[1 2 3 4...] [1 2 3 4...] [1 2 3 4...]]
[[1 2 3 4...] [1 2 3 4...] [1 2 3 4...]]
[[1 2 3 4...] [1 2 3 4...] [1 2 3 4...]]
]
[2 4 6... 98 100]

Each individual list contains 50 elements.
How can interpret this? Why there is 5 lists of lists? why there 50 elements in each lists (I guess it is for the frequencies)? What represent the values in each list? Does each individual list correspond to one channel, but why 5 times?
Based on these data, on could I compare my different populations according to the different frequency bands (delta, alpha…)? I guess the very last list (from 2 to 100) is for the different frequencies?

Sorry for these questions,

Best regards,

Hugues

PS: of course the values insides the lists are not the real ones, just for the illustration

At the top of the docstring of the EpochsSpectrum class it says:

Warning The preferred means of creating Spectrum objects from Epochs is via the instance method mne.Epochs.compute_psd(). Direct class instantiation is not supported.

Please use that API instead. As for the output of the EpochsSpectrum.get_data() method: It will return an array of shape (n_epochs, n_channels, n_frequency_bins), and optionally also an array giving the center frequencies (in Hz) of the frequency bins. Your pasted output looks reasonable; it suggests you have n_epochs=5, n_channels=3, and n_frequency_bins=50. The data values are “Spectral power in that epoch in that channel in that frequency bin”

1 Like

So cool!!
Than you so much!!
It is so clear for me now!

Thank you again, it helps a lot!

Hugues