Mean of different topomaps

  • MNE version: e.g.1.7.0
  • operating system: Windows 10

Hello everyone,

I have 16 participants and I am able to do a scalpmap for each participant. However, I want to do a scalpmap with the average of the power of all the participants into only one scalpmap.
The goal is to do that for 2 different conditions, and then be able to compare both of conditions.

After all the preprocessing:

 epochs = mne.make_fixed_length_epochs(rawpre_dict[f'rawpre{subject}'],duration=2,preload=True,
    overlap=0.150,reject_by_annotation=False)
    
    #FFT
    fmin = 0
    fmax = 60
    window = "rect"
    sfreq = 500
    n_fft = 1024
    resolution = sfreq/n_fft
    
    trai = mne.EpochsArray(epochs,epochs.info)

    av = trai.compute_psd(method='welch',fmin=fmin,fmax=fmax,exclude='bads',
                            
   window=window,remove_dc=True,n_fft=1024,n_per_seg=1000).average()
    
    psds_dict[f'rawpre{subject}'], freqs = av.get_data(return_freqs=True)
    psds_dict[f'rawpre{subject}'] = (av.get_data()*1e12)*resolution

    psds_total[i] =  psds_dict[f'rawpre{subject}']

      ....
    
    print("Scalpmap - Subject " + str(subject))
    epochs.compute_psd().average().plot_topomap(bands = {'Delta (0-4 Hz)': (0, 4),'Theta (4-8 Hz)':(4, 8),
    'Alpha (8-12 Hz)': (8, 12),'Beta (12-30 Hz)':(12, 30)},cmap="seismic",colorbar=True,
    show=True)

Thank you in advance and I am sorry if it’s a silly question, i am still a newbie :sweat_smile:

Hi @rodrigordias03,

You’ll want to use mne.viz.plot_topomap

Basically, data should be of shape n_channels, where each value is the averaged PSD across participants for a particular sensor. For pos, I think passing a suitable mne.Info object is the easiest approach.

If you have any trouble, feel free to reply to this thread.

Thank you!

I did this:

psd_avg = np.mean([av[1].get_data(), av[2].get_data()...axis=0).mean(1)

mne.viz.plot_topomap(psd_avg,epochs.info)

However, in order to compare the pre and post stimulation, I did this:

dB1 = 10*np.log10(psd_avg2/psd_avg)

mne.viz.plot_topomap(dB1,epochs.info)

It worked, but I want scalmaps for different frequencies, so I can analyze how the power of difference frequencies changes due to stimulation. Any way I can do that?

Thank you in advance!