def test_sky2ang_symmetric(): """Test that function Region.sky2ang is symmetric""" sky = np.radians(np.array([[15, -45]])) tp = Region.sky2ang(sky) tp = np.array([[tp[0][1], tp[0][0]]]) sky2 = Region.sky2ang(tp) sky2 = np.array([[sky2[0][1], sky2[0][0]]]) if not (np.all(abs(sky-sky2) < 1e-9)): raise AssertionError("sky2ang failed to be symmetric")
def test_sky2ang_symmetric(): """Test that function Region.sky2ang is symmetric""" sky = np.radians(np.array([[15, -45]])) tp = Region.sky2ang(sky) tp = np.array([[tp[0][1], tp[0][0]]]) sky2 = Region.sky2ang(tp) sky2 = np.array([[sky2[0][1], sky2[0][0]]]) if not (np.all(abs(sky - sky2) < 1e-9)): raise AssertionError("sky2ang failed to be symmetric")
def test_sky2ang_corners(): """Test that function Region.sky2ang works at 0/0 and the south pole""" corners = np.radians([[0, 0], [360, -90]]) theta_phi = Region.sky2ang(corners) answers = np.array([[np.pi / 2, 0], [np.pi, 2 * np.pi]]) if not (np.all(theta_phi - answers < 1e-9)): raise AssertionError('sky2ang corner cases failed')
def test_sky2ang_corners(): """Test that function Region.sky2ang works at 0/0 and the south pole""" corners = np.radians([[0, 0], [360, -90]]) theta_phi = Region.sky2ang(corners) answers = np.array([[np.pi/2, 0], [np.pi, 2*np.pi]]) if not (np.all(theta_phi - answers < 1e-9)): raise AssertionError('sky2ang corner cases failed')