Skip to content

Instantly share code, notes, and snippets.

@GWeindel
Created June 25, 2020 12:38
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 GWeindel/2af99b1a3b07d2d75d8e27cbacdf741e to your computer and use it in GitHub Desktop.
Save GWeindel/2af99b1a3b07d2d75d8e27cbacdf741e to your computer and use it in GitHub Desktop.
MNE Reproducing plot_compare_evokeds error after CSD
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
raw = mne.io.read_raw_fif(data_path + '/MEG/sample/sample_audvis_raw.fif', preload=True)
raw = raw.pick_types(meg=False, eeg=True, eog=True, ecg=True, stim=True,
exclude=raw.info['bads']).load_data()
events = mne.find_events(raw)
raw.set_eeg_reference(projection=True).apply_proj()
event_id = {'auditory/left': 1, 'auditory/right': 2, 'visual/left': 3,
'visual/right': 4, 'smiley': 5, 'button': 32}
epochs = mne.Epochs(raw, events, event_id=event_id, tmin=-0.2, tmax=.5,
preload=True)
evoked = epochs['auditory'].average()
evoked_csd = mne.preprocessing.compute_current_source_density(evoked)
mne.viz.plot_compare_evokeds([evoked_csd], picks='csd', axes='topo')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment