Ejemplo n.º 1
0
def test_vec2sky_corners():
    """Test that function Region.vec2sky works at some tricky locations"""
    vectors = np.array([[1, 0, 0], [0, 0, 1], [0, 0, -1]])
    skycoords = Region.vec2sky(vectors, degrees=True)
    answers = np.array([[0, 0], [0, 90], [0, -90]])
    if not (np.all(skycoords == answers)):
        raise AssertionError('vec2sky fails on corners')
Ejemplo n.º 2
0
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')
Ejemplo n.º 3
0
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')
Ejemplo n.º 4
0
def test_vec2sky_corners():
    """Test that function Region.vec2sky works at some tricky locations"""
    vectors = np.array([[1, 0, 0], [0, 0, 1], [0, 0, -1]])
    skycoords = Region.vec2sky(vectors, degrees=True)
    answers = np.array([[0, 0], [0, 90], [0, -90]])
    if not (np.all(skycoords == answers)): raise AssertionError('vec2sky fails on corners')