def test_tps():
 az = np.linspace(0.0, (2 * np.pi), 20, endpoint=False)
 pol = np.linspace(0, np.pi, 12)[1:(-1)]
 sph = np.array(np.meshgrid(1, az, pol, indexing='ij'))
 sph.shape = (3, (-1))
 assert_equal(sph.shape[1], 200)
 source = _sph_to_cart(sph.T)
 destination = source.copy()
 destination *= 2
 destination[:, 0] += 1
 warp = SphericalSurfaceWarp().fit(source[::2], destination[::2])
 destination_est = warp.transform(source)
 assert_allclose(destination_est, destination, atol=0.01)

def test_tps ( ) : az = np . linspace ( 0.0 , ( 2 * np . pi ) , 20 , endpoint = False ) pol = np . linspace ( 0 , np . pi , 12 ) [ 1 : ( - 1 ) ] sph = np . array ( np . meshgrid ( 1 , az , pol , indexing = 'ij' ) ) sph . shape = ( 3 , ( - 1 ) ) assert_equal ( sph . shape [ 1 ] , 200 ) source = _sph_to_cart ( sph . T ) destination = source . copy ( ) destination *= 2 destination [ : , 0 ] += 1 warp = SphericalSurfaceWarp ( ) . fit ( source [ : : 2 ] , destination [ : : 2 ] ) destination_est = warp . transform ( source ) assert_allclose ( destination_est , destination , atol = 0.01 )
test tps warping .