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])
import numpy as np from aplpy.wcs_util import fk52gal, j2000tob1950 # Read in initial coordinates as J2000 coordinates data_j2000 = np.loadtxt("../initial_coords.txt") ra_j2000, dec_j2000 = data_j2000[:, 0], data_j2000[:, 1] glon, glat = fk52gal(ra_j2000, dec_j2000) np.savetxt("coords_galactic.txt", zip(glon, glat), fmt="%20.15f") ra_fk4, dec_fk4 = j2000tob1950(ra_j2000, dec_j2000) np.savetxt("coords_b1950.txt", zip(ra_fk4, dec_fk4), fmt="%20.15f")
import numpy as np from aplpy.wcs_util import fk52gal, j2000tob1950 # Read in initial coordinates as J2000 coordinates data_j2000 = np.loadtxt('../initial_coords.txt') ra_j2000, dec_j2000 = data_j2000[:,0], data_j2000[:,1] glon, glat = fk52gal(ra_j2000, dec_j2000) np.savetxt('coords_galactic.txt', zip(glon, glat), fmt="%20.15f") ra_fk4, dec_fk4 = j2000tob1950(ra_j2000, dec_j2000) np.savetxt('coords_b1950.txt', zip(ra_fk4, dec_fk4), fmt="%20.15f")
def radec2glat(ra, dec): """Compute galactic latitude from right ascension and declination""" return fk52gal(ra, dec)[1]