Skip to content

Instantly share code, notes, and snippets.

@jasmainak
Created March 5, 2019 03:16
Show Gist options
  • Save jasmainak/1d3e04633e50328abd81408481ca884f to your computer and use it in GitHub Desktop.
Save jasmainak/1d3e04633e50328abd81408481ca884f to your computer and use it in GitHub Desktop.
visualize bad epochs
import numpy as np
from 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment