average instances of mne.time_frequency.Spectrum?

Is it possible to (grand-)average instances of mne.time_frequency.Spectrum?

I don’t know of a way to do so on Spectrum objects directly, but the grand_average() function does support AverageTFR objects.

A workaround could be to repackage your Spectrum data into AverageTFRArray objects with a singleton time dimension and average this.

Cheers,
Thomas

Wonder if this is useful functionality worth implementing @drammock @larsoner?
I wouldn’t mind opening a PR if so.

Seems worth supporting and probably not too hard to do. Presumably would involve a new func combine_spectrum() (or refactoring combine_tfr() to handle spectra) and then some simple tweaks to grand_average().

3 Likes

FYI, this is being addressed here: Add `combine_spectrum()` function and allow `grand_average()` to support `Spectrum` data by tsbinns · Pull Request #13058 · mne-tools/mne-python · GitHub

3 Likes

It appears @tsbinns’s addition will be included in MNE 1.10!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.