Test spherical harmonic conversions.
()
| 486 | |
| 487 | |
| 488 | def 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 |
nothing calls this directly
no test coverage detected