def test_radec2sky(): """Test function: Region.radec2sky""" ra, dec = (15, -45) sky = Region.radec2sky(ra, dec) if not (np.all(sky == [(ra, dec)])): raise AssertionError("radec2sky broken on non-list input") ra = [0, 10] dec = [-45, 45] sky = Region.radec2sky(ra, dec) answer = np.array([(ra[0], dec[0]), (ra[1], dec[1])]) if not (np.all(sky == answer)): raise AssertionError('radec2sky broken on list input')
def test_sky2vec2sky(): """Test that function Region.vec2sky and Region.sky2vec are mutual inverses""" ra, dec = np.radians(np.array((0, -45))) sky = Region.radec2sky(ra, dec) vec = Region.sky2vec(sky) sky2 = Region.vec2sky(vec) if not (np.all(np.array(sky2) - np.array(sky) == 0)): raise AssertionError("sky2vec2sky failed") vec2 = Region.sky2vec(sky2) if not (np.all(np.array(vec) - np.array(vec2) == 0)): raise AssertionError('vec2sky2vec failed')