plot_topomap appears to invert the sign of the data.

  • MNE version: 1.0.3
  • operating system: Windows 11

Hello, everyone. I am processing power spectrum density with MEG data. I have noticed that the mne.viz.plot_topomap provide the same image even when I invert the sign of the data.

The below is a sample and the obtained image. “epochs” is an Epochs instance derived from a .fif file.

info = epochs.pick_types(meg='grad').info
psds_orig = np.linspace(-0.5, 0.5, 204)
psds_inv = psds_orig*-1.0
fig, ax = plt.subplots(2,2)
vmin, vmax = -0.3, 0.3
mne.viz.plot_topomap(psds_orig, info, axes=ax[0,0],cmap='jet', vmin=vmin, vmax=vmax);ax[0,0].set_title('original')
mne.viz.plot_topomap(psds_inv, info, axes=ax[0,1],cmap='jet', vmin=vmin, vmax=vmax);ax[0,1].set_title('inverted')
ax[1,0].plot(psds_orig);ax[1,0].set_title('original data');ax[1,0].set_xlabel('grad channel')
ax[1,1].plot(psds_inv);ax[1,1].set_title('inverted data');ax[1,1].set_xlabel('grad channel')

topomap_sample

I expect that when the sign of the data is inverted, the color of the topomap would also be inverted. However, the two data provide the same image.

I am confused with the situation and need help to get around the problem.

Thank you

Katsuya Ogata

There are two planar gradiometers at each location in the topoplot. The topoplot will combine the signal at these two gradiometers by computing sqrt(sens1 ** 2 + sens2 ** 2). Hence, any information about the sign (rather, the signal direction) will be lost in this type of plot. Try plotting the planar1 and planar2 sensors independently (epochs.pick_types(meg='planar1'))

Thank you very much for your reply. Now I understand the situation.

1 Like