Skip to content

Instantly share code, notes, and snippets.

@jasmainak
Created March 12, 2019 21:33
Show Gist options
  • Save jasmainak/756cf02dce82ab2dc5c2c69722dd13d1 to your computer and use it in GitHub Desktop.
Save jasmainak/756cf02dce82ab2dc5c2c69722dd13d1 to your computer and use it in GitHub Desktop.
def remap_evoked(evoked, info_to, mode='fast'):
# get info that should only differ in dev_head transform
from mne import pick_types, pick_info
from mne.forward import _map_meg_channels
picks = pick_types(evoked.info, meg=True, eeg=False, ref_meg=True)
info_from = pick_info(evoked.info, picks)
info_to = pick_info(info_to, picks)
mapping = _map_meg_channels(info_from, info_to, mode=mode)
evoked.copy()
evoked.info = info_to # update info
evoked.data[picks] = np.dot(mapping, evoked.data[picks])
return evoked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment