Test TPS warping.
()
| 72 | |
| 73 | |
| 74 | def test_tps(): |
| 75 | """Test TPS warping.""" |
| 76 | az = np.linspace(0.0, 2 * np.pi, 20, endpoint=False) |
| 77 | pol = np.linspace(0, np.pi, 12)[1:-1] |
| 78 | sph = np.array(np.meshgrid(1, az, pol, indexing="ij")) |
| 79 | sph = _reshape_view(sph, (3, -1)) |
| 80 | assert_equal(sph.shape[1], 200) |
| 81 | source = _sph_to_cart(sph.T) |
| 82 | destination = source.copy() |
| 83 | destination *= 2 |
| 84 | destination[:, 0] += 1 |
| 85 | # fit with 100 points |
| 86 | warp = SphericalSurfaceWarp() |
| 87 | assert "no " in repr(warp) |
| 88 | warp.fit(source[::3], destination[::2]) |
| 89 | assert "oct5" in repr(warp) |
| 90 | destination_est = warp.transform(source) |
| 91 | assert_allclose(destination_est, destination, atol=1e-3) |
| 92 | |
| 93 | |
| 94 | @testing.requires_testing_data |
nothing calls this directly
no test coverage detected