[Mne_analysis] How to transfer the subjects’ heads into the same position?

Alexandre Gramfort alexandre.gramfort at inria.fr
Sun Sep 30 14:57:18 EDT 2018
Search archives:

        External Email - Use Caution        

hi Maria,

the following code snippet is fully tested but it should do in theory
do what you want.
It maps an evoked object to a new set of sensor locations:

---

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

---

let's see if someone has the time to make it a proper MNE function.

HTH
Alex



More information about the Mne_analysis mailing list