Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions mne/channels/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,35 @@ def _interpolate_to_meg(inst, sensors, origin, mode):
if len(picks_meg_good) == 0:
raise ValueError("No good MEG channels available for interpolation.")

# Load target sensor configuration
info_to = read_meg_canonical_info(sensors)
info_to["dev_head_t"] = deepcopy(inst.info["dev_head_t"])
# Load target sensor configuration as info file
info_cano = read_meg_canonical_info(sensors)

# Get source MEG info
info_from = pick_info(inst.info, picks_meg_good)

# Design target info like source, except for channel info and
# some (possibly) related fields
info_to = deepcopy(info_from)
info_to._unlocked = True # make all info fields modifiable
# Update channel info to the desired one
info_to["chs"] = deepcopy(info_cano["chs"])
info_to["ch_names"] = deepcopy(info_cano["ch_names"])
info_to["nchan"] = deepcopy(info_cano["nchan"])
# Reset some channel and machine-related fields to avoid confusion later on
info_to["device_info"] = None
info_to["helium_info"] = None
info_to["proj_id"] = None
info_to["proj_name"] = None
info_to["gantry_angle"] = None
# we keep original 'dev_head_t'
info_to["ctf_head_t"] = None
info_to["dev_ctf_t"] = None
# info_to['dig'] = None # or should they be removed, too?
info_to["bads"] = []
info_to["projs"] = []
info_to["comps"] = []
info_to._unlocked = False # lock info again

# Compute field interpolation mapping
origin_val = _check_origin(origin, inst.info)
mapping = _map_meg_or_eeg_channels(info_from, info_to, mode=mode, origin=origin_val)
Expand Down
Loading