def test_lambert_equal_area_projection_polar(): theta = np.repeat(np.pi/3,10) phi = np.linspace(0,2*np.pi,10) # points sit on circle with co-latitude pi/3 (60 degrees) leap = lambert_equal_area_projection_polar(theta,phi) yield assert_array_almost_equal(np.sqrt(np.sum(leap**2,axis=1)), np.array([ 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.]))
def test_lambert_equal_area_projection_polar(): theta = np.repeat(np.pi / 3, 10) phi = np.linspace(0, 2 * np.pi, 10) # points sit on circle with co-latitude pi/3 (60 degrees) leap = lambert_equal_area_projection_polar(theta, phi) yield assert_array_almost_equal, np.sqrt(np.sum(leap**2,axis=1)), \ np.array([ 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.])
def test_lambert_equal_area_projection_cart(): xyz = np.array([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]]) # points sit on +/-1 on all 3 axes r,theta,phi = cart2sphere(*xyz.T) leap = lambert_equal_area_projection_polar(theta,phi) r2 = np.sqrt(2) yield assert_array_almost_equal(np.sqrt(np.sum(leap**2,axis=1)), np.array([ r2,r2,0,r2,r2,2]))
def test_lambert_equal_area_projection_cart(): xyz = np.array([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]]) # points sit on +/-1 on all 3 axes r,theta,phi = cart2sphere(*xyz.T) leap = lambert_equal_area_projection_polar(theta,phi) r2 = np.sqrt(2) yield assert_array_almost_equal, np.sqrt(np.sum(leap**2,axis=1)), \ np.array([ r2,r2,0,r2,r2,2])