MCPcopy
hub / github.com/mne-tools/mne-python / _check_destination

Function _check_destination

mne/preprocessing/maxwell.py:1041–1065  ·  view source on GitHub ↗

Triage our reconstruction trans.

(destination, info, coord_frame)

Source from the content-addressed store, hash-verified

1039
1040
1041def _check_destination(destination, info, coord_frame):
1042 """Triage our reconstruction trans."""
1043 if destination is None:
1044 return info["dev_head_t"]
1045 if coord_frame != "head":
1046 raise RuntimeError(
1047 "destination can only be set if using the head coordinate frame"
1048 )
1049 if isinstance(destination, str | Path):
1050 recon_trans = _get_trans(destination, "meg", "head")[0]
1051 elif isinstance(destination, Transform):
1052 recon_trans = destination
1053 else:
1054 destination = np.array(destination, float)
1055 if destination.shape != (3,):
1056 raise ValueError("destination must be a 3-element vector, str, or None")
1057 recon_trans = np.eye(4)
1058 recon_trans[:3, 3] = destination
1059 recon_trans = Transform("meg", "head", recon_trans)
1060 if recon_trans.to_str != "head" or recon_trans.from_str != "MEG device":
1061 raise RuntimeError(
1062 "Destination transform is not MEG device -> head, "
1063 f"got {recon_trans.from_str} -> {recon_trans.to_str}"
1064 )
1065 return recon_trans
1066
1067
1068@verbose

Callers 3

average_movementsFunction · 0.85
_prep_maxwell_filterFunction · 0.85
plot_head_positionsFunction · 0.85

Calls 2

_get_transFunction · 0.85
TransformClass · 0.85

Tested by

no test coverage detected