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

Function _assert_complete_surface

mne/bem.py:526–544  ·  view source on GitHub ↗

Check the sum of solid angles as seen from inside.

(surf, incomplete="raise")

Source from the content-addressed store, hash-verified

524
525
526def _assert_complete_surface(surf, incomplete="raise"):
527 """Check the sum of solid angles as seen from inside."""
528 # from surface_checks.c
529 # Center of mass....
530 cm = surf["rr"].mean(axis=0)
531 logger.info(
532 f"{_bem_surf_name[surf['id']]} CM is "
533 f"{1000 * cm[0]:6.2f} "
534 f"{1000 * cm[1]:6.2f} "
535 f"{1000 * cm[2]:6.2f} mm"
536 )
537 tot_angle = _get_solids(surf["rr"][surf["tris"]], cm[np.newaxis, :])[0]
538 prop = tot_angle / (2 * np.pi)
539 if np.abs(prop - 1.0) > 1e-5:
540 msg = (
541 f"Surface {_bem_surf_name[surf['id']]} is not complete (sum of "
542 f"solid angles yielded {prop}, should be 1.)"
543 )
544 _on_missing(incomplete, msg, name="incomplete", error_klass=RuntimeError)
545
546
547def _assert_inside(fro, to):

Callers 2

test_bem_solutionFunction · 0.90
_check_surfacesFunction · 0.85

Calls 4

_get_solidsFunction · 0.85
_on_missingFunction · 0.85
infoMethod · 0.80
meanMethod · 0.45

Tested by 1

test_bem_solutionFunction · 0.72