Plot Epochs with Bad Epochs Selected in Red

Hi all,

   I couldn't find a way to plot epochs with the epochs in the drop log plotted in red instead of not plotted at all. If anyone had any advice in regards to how to do that I would appreciate it.

Thanks,

Alex

Translational NeuroEngineering Laboratory
Division of Neurotherapeutics, Department of Psychiatry
Massachusetts General Hospital, Martinos Center
149 13th St Charlestown #2301, Boston, MA 02129
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190304/2f035ff3/attachment-0001.html

External Email - Use Caution

Hi Alex,

I don?t think it?s possible in MNE. The reason is that the data that has
been dropped is not there any more.

However, there is a workaround that you could try using autoreject. Here?s
a code snippet to get you started:

import numpy as npfrom autoreject import RejectLog
epochs_orig = epochs.copy()
# now interactively mark the bad epochs
epochs.plot()

bad_idxs = [idx for idx, drop in enumerate(epochs.drop_log) if
            drop == ['USER']]

n_channels = epochs_orig.info['nchan']
n_epochs = len(epochs_orig)

bad_epochs = np.zeros((n_epochs,))
labels = np.zeros((n_epochs, n_channels))

bad_epochs[bad_idxs] = 1

reject = RejectLog(bad_epochs=bad_epochs, labels=labels,
                   ch_names=epochs.info['ch_names'])
reject.plot_epochs(epochs_orig)

Best,
Mainak

Hi all,

   I couldn't find a way to plot epochs with the epochs in the drop log
plotted in red instead of not plotted at all. If anyone had any advice in
regards to how to do that I would appreciate it.

Thanks,

Alex

Translational NeuroEngineering Laboratory
Division of Neurotherapeutics, Department of Psychiatry
Massachusetts General Hospital, Martinos Center
149 13th St Charlestown #2301, Boston, MA 02129
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190304/d0f77f32/attachment-0001.html

1 Like