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

Function test_spherical_conversions

mne/preprocessing/tests/test_maxwell.py:488–501  ·  view source on GitHub ↗

Test spherical harmonic conversions.

()

Source from the content-addressed store, hash-verified

486
487
488def test_spherical_conversions():
489 """Test spherical harmonic conversions."""
490 # Test our real<->complex conversion functions
491 az, pol = np.meshgrid(np.linspace(0, 2 * np.pi, 30), np.linspace(0, np.pi, 20))
492 for degree in range(1, int_order):
493 for order in range(0, degree + 1):
494 sph = sph_harm_y(degree, order, pol, az)
495 # ensure that we satisfy the conjugation property
496 assert_allclose(_sh_negate(sph, order), sph_harm_y(degree, -order, pol, az))
497 # ensure our conversion functions work
498 sph_real_pos = _sh_complex_to_real(sph, order)
499 sph_real_neg = _sh_complex_to_real(sph, -order)
500 sph_2 = _sh_real_to_complex([sph_real_pos, sph_real_neg], order)
501 assert_allclose(sph, sph_2, atol=1e-7)
502
503
504@testing.requires_testing_data

Callers

nothing calls this directly

Calls 4

sph_harm_yFunction · 0.90
_sh_negateFunction · 0.85
_sh_complex_to_realFunction · 0.85
_sh_real_to_complexFunction · 0.85

Tested by

no test coverage detected