Displaying all channels and epochs, including bad ones

Hi everyone, I am trying to display raw data using mne.viz.plot_epochs(…) (as channels and epochs) after I programmatically remove bad channels and epochs. Only the good channels and epochs are displayed after removing the bad ones. I want all channels and epoch to be displayed, including the bad ones (highlighted in a different color). I’ve had a look through the MNE code and it appears that perhaps the behavior that I am after can’t be done in MNE - bad data is just deleted before it can be displayed.

So, can someone confirm that I am correct and there is no way to do this (without a substantial rewrite of the code)? Or, I would be very happy if you prove me wrong and can explain how to achieve this.

Thanks.

  • MNE version: 1.8
  • operating system: Windows 10.

By default, picks=None in epochs.plot() shows only good channels. If you want to show all channels, set it to picks="all" (mne.Epochs — MNE 1.8.0 documentation).

Regarding bad epochs, if you don’t see them anymore, you might have dropped them. You should therefore visualize epochs before dropping (i.e., set preload=False, which is the default anyway, and/or defer epochs.load_data()).

Thanks for your response Clemens. I understand what you are saying about including bad channels in the epoch plot. I don’t however fully understand what you are saying about including bad epochs in the plot. I am calling drop_bad() before plotting. So, I have dropped epochs by using that. What I want to know is if there is a way to mark the bad epochs as bad without dropping them - so that I can see them in the plot, highlighted in some way. I want to visually inspect what the epoch rejection criteria I am using is doing with the data. I want to be able to see the characteristics of the rejected epoch data along with the good data. So, do you think that this can be done?

Autoreject does something like that in the RejectLog.plot_epochs() method:


https://autoreject.github.io/stable/auto_examples/plot_visualize_bad_epochs.html

The source code is available here.

Generally speaking, though, MNE drops “bad” epochs and you cannot recover them.

Richard

1 Like