Skip to content

Commit

Permalink
fix circle, speed up example
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrockhill committed Jan 4, 2024
1 parent 37c5acd commit df27b94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/preprocessing/interpolate_bad_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,24 @@
# %%
# You can also interpolate bad channels per epoch
raw = mne.io.read_raw(meg_path / "sample_audvis_raw.fif")
raw.pick("eeg") # just to speed up execution
events = mne.read_events(meg_path / "sample_audvis_raw-eve.fif")
epochs = mne.Epochs(raw, events=events)

# try to only remove bad channels on some epochs to save EEG 053
epochs.drop_bad(reject=dict(grad=4000e-13, mag=4e-12, eeg=100e-6))
epochs.drop_bad(reject=dict(eeg=100e-6))

interpolate_channels = [
entry if len(entry) < 5 else tuple() for entry in epochs.drop_log
]
drop_epochs = np.array([len(entry) >= 5 for entry in epochs.drop_log])
del epochs

epochs = mne.Epochs(raw, events=events)
epochs = mne.Epochs(raw, events=events, preload=True)
epochs.interpolate_bads_per_epoch(interpolate_channels)
epochs = epochs[~drop_epochs]
epochs.average().plot()


# %%
# References
# ----------
Expand Down

0 comments on commit df27b94

Please sign in to comment.