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

Function test_tps

mne/tests/test_transforms.py:74–91  ·  view source on GitHub ↗

Test TPS warping.

()

Source from the content-addressed store, hash-verified

72
73
74def 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

Callers

nothing calls this directly

Calls 5

_reshape_viewFunction · 0.90
_sph_to_cartFunction · 0.90
copyMethod · 0.45
fitMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected