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

Function _check_origin

mne/bem.py:1121–1147  ·  view source on GitHub ↗

Check or auto-determine the origin.

(origin, info, coord_frame="head", disp=False)

Source from the content-addressed store, hash-verified

1119
1120
1121def _check_origin(origin, info, coord_frame="head", disp=False):
1122 """Check or auto-determine the origin."""
1123 if isinstance(origin, str):
1124 if origin != "auto":
1125 raise ValueError(
1126 f'origin must be a numerical array, or "auto", not {origin}'
1127 )
1128 if coord_frame == "head":
1129 R, origin = fit_sphere_to_headshape(
1130 info, verbose=_verbose_safe_false(), units="m"
1131 )[:2]
1132 logger.info(f" Automatic origin fit: head of radius {R * 1000:0.1f} mm")
1133 del R
1134 else:
1135 origin = (0.0, 0.0, 0.0)
1136 origin = np.array(origin, float)
1137 if origin.shape != (3,):
1138 raise ValueError("origin must be a 3-element array")
1139 if disp:
1140 origin_str = ", ".join([f"{o * 1000:0.1f}" for o in origin])
1141 msg = f" Using origin {origin_str} mm in the {coord_frame} frame"
1142 if coord_frame == "meg" and info["dev_head_t"] is not None:
1143 o_dev = apply_trans(info["dev_head_t"], origin)
1144 origin_str = ", ".join(f"{o * 1000:0.1f}" for o in o_dev)
1145 msg += f" ({origin_str} mm in the head frame)"
1146 logger.info(msg)
1147 return origin
1148
1149
1150# ############################################################################

Callers 8

average_movementsFunction · 0.85
_map_meg_or_eeg_channelsFunction · 0.85
_make_surface_mappingFunction · 0.85
compute_fine_calibrationFunction · 0.85
_prep_maxwell_filterFunction · 0.85
_interpolate_to_eegFunction · 0.85
_interpolate_to_megFunction · 0.85
interpolate_badsMethod · 0.85

Calls 4

fit_sphere_to_headshapeFunction · 0.85
_verbose_safe_falseFunction · 0.85
apply_transFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected