Issue with mne.viz.plot_compare_evokeds()

Hi,

I am using ‘mne.viz.plot_compare_evokeds()’ to visualize the evoked time courses for multiple conditions. For some of my subjects, my EEG system recorded with channel Fz as the reference but did not include Fz in the data file, so I add back Fz as a flat channel prior to re-referencing average of mastoid channels as the new reference. This causes the Fz to appear as the last element in the .ch_name list for those subjects.

However, when executing ‘mne.viz.plot_compare_evokeds()’, I noticed from the source code that the channel indices were based on the order of the ch_name list from the first subject data in each condition’s evoked list, which in my case is problematic because my first subject did not use the ‘Fz’ online reference and ‘Fz’ in .ch_name list appears as the second rather than the last element. That’s why I get different results when comparing the results from manual averaging and the function.

I am wondering if the function could be made better to retrieve the picked channel indices based on each subject’s actual ch_name info.

Here’s my system info:

  • MNE version: 1.7.0
  • operating system: macOS-12.6
  • Python: 3.12.3

Thanks,
Lizzie

You can reorder channels with: mne.io.Raw — MNE 1.7.1 documentation or mne.Evoked — MNE 1.7.1 documentation for evoked.

Mathieu

1 Like