Created
March 12, 2019 21:33
-
-
Save jasmainak/756cf02dce82ab2dc5c2c69722dd13d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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