Skip to content

Commit fbfd503

Browse files
committed
FIX: Fittingc
1 parent c16c836 commit fbfd503

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mne/surface.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,11 @@ def _scale_helmet_to_sensors(system, surf, info):
277277
to = np.array(to, float)
278278
interp = _MatchedDisplacementFieldInterpolator(fro, to)
279279
new_rr = interp(surf["rr"])
280-
quat, sc = _fit_matched_points(surf["rr"], new_rr)
280+
try:
281+
quat, sc = _fit_matched_points(surf["rr"], new_rr)
282+
except np.linalg.LinAlgError:
283+
logger.info("Using CAD helmet because fitting failed")
284+
return surf
281285
rot = np.rad2deg(_angle_between_quats(quat[:3]))
282286
tr = 1000 * np.linalg.norm(quat[3:])
283287
logger.info(f" Deforming to match info using {len(fro)} matched points:")

0 commit comments

Comments
 (0)