Skip to content

Instantly share code, notes, and snippets.

@bloyl
Created November 16, 2017 18:20
Show Gist options
  • Save bloyl/2f067bcf5f84144e090d45fa01836ced to your computer and use it in GitHub Desktop.
Save bloyl/2f067bcf5f84144e090d45fa01836ced to your computer and use it in GitHub Desktop.
import os.path as op
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)
evoked_l_aud = evoked[0]
# restrict to magnetometers
evoked_l_aud.pick_types(meg='mag')
# pick the right channels
rt_chans = [k['ch_name'] for k in evoked_l_aud.info['chs']
if k['loc'][0] >= 0]
rt_picks = mne.pick_channels(evoked_l_aud.info['ch_names'], rt_chans)
# make a dataset just of right channels.
evoked_l_aud_rt_chans = evoked_l_aud.copy()
evoked_l_aud_rt_chans.pick_channels(rt_chans)
# test plot_joint
evoked_l_aud.plot_joint(times=[0.089], show=False)
evoked_l_aud.plot_joint(times=[0.089], picks=rt_picks, show=False)
evoked_l_aud_rt_chans.plot_joint(times=[0.089], show=False)
plt.show()
# what about topo plot
evoked_l_aud.plot_topomap(times=[0.089], show=False)
evoked_l_aud_rt_chans.plot_topomap(times=[0.089], show=False)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment