Raw Grand Average

Hello,

I would like to plot a power spectrum of my continuous EEG data representing the average of all participants for any given condition; however, it does not seem that a “grand average” function exists for raw objects (only evoked and AverageTFR). I am currently just loading all my datasets into Python simultaneously and averaging the arrays, but this is cumbersome and takes quite a bit of memory. Is there a better solution?

I am not sure if AverageTFR is the best approach, but either way, I am struggling to create an AverageTFR object from raw since I cannot figure out how to create a 3d array for the “data” parameter where one of the dimensions is n_freq. (Apologies if this is better suited to its own thread - you can ignore it if AverageTFR is not needed for my original question).

Thank you for your time,
DPS

I would probably use mne.time_frequency.psd_multitaper — MNE 0.23.0 documentation or mne.time_frequency.psd_welch — MNE 0.23.0 documentation to compute the PSD for each subject, and then combine the resulting NumPy arrays (with np.mean) to generate your average spectrum. Note that the validity of averaging spectra assumes a stationary signal, so you may want to z-score (or at least baseline-correct) the signals first.