def test_galactic2ecliptic_individual(): from aplpy.wcs_util import fk52gal, gal2fk5 r = ComponentLink([L, B], R, lb2ra) d = ComponentLink([L, B], R, lb2dec) l = ComponentLink([R, D], L, radec2glon) b = ComponentLink([R, D], B, radec2glat) x = np.array([0]) y = np.array([0]) check_using(l, (x, y), fk52gal(x, y)[0]) check_using(b, (x, y), fk52gal(x, y)[1]) check_using(r, (x, y), gal2fk5(x, y)[0]) check_using(d, (x, y), gal2fk5(x, y)[1])
def test_Galactic2Equatorial(): from aplpy.wcs_util import fk52gal, gal2fk5 result = Galactic2Equatorial(L, B, R, D) assert len(result) == 4 check_link(result[0], [R, D], L) check_link(result[1], [R, D], B) check_link(result[2], [L, B], R) check_link(result[3], [L, B], D) x = np.array([0]) y = np.array([0]) check_using(result[0], (x, y), fk52gal(x, y)[0]) check_using(result[1], (x, y), fk52gal(x, y)[1]) check_using(result[2], (x, y), gal2fk5(x, y)[0]) check_using(result[3], (x, y), gal2fk5(x, y)[1])
def lb2dec(lat, lon): """Compute declination from galactic longitude and latitude""" return gal2fk5(lat, lon)[1]
def lb2ra(lat, lon): """Compute right ascension from galactic longitude and latitude""" return gal2fk5(lat, lon)[0]