Skip to content

Instantly share code, notes, and snippets.

@bloyl
Created April 9, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloyl/7f6a7910bf2afce5f198b6233f39416b to your computer and use it in GitHub Desktop.
Save bloyl/7f6a7910bf2afce5f198b6233f39416b to your computer and use it in GitHub Desktop.
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
data_path = mne.datasets.sample.data_path()
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')
evoked = mne.read_evokeds(fname, baseline=(None, 0), proj=True)
# only left aud
evoked = evoked[0]
lt_chans = [k['ch_name'] for k in evoked.info['chs']
if k['loc'][0] <= 0 ]
evoked.info['bads'] = []
evoked.plot(exclude=[], show=False)
evoked.info['bads'] += lt_chans
evoked.plot(exclude=[],show=False)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment