forked from cdeil/coordinates-benchmark
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f3e717
commit e40fa70
Showing
7 changed files
with
4,084 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
# pyslalib is available: https://github.com/scottransom/pyslalib | ||
|
||
import numpy as np | ||
from pyslalib import slalib as S | ||
|
||
# Read in initial coordinates as J2000 coordinates | ||
data_j2000 = np.radians(np.loadtxt('../initial_coords.txt')) | ||
ra_j2000_fk5, dec_j2000_fk5 = data_j2000[:,0], data_j2000[:,1] | ||
|
||
vals = {} | ||
for system in 'FK4', 'Ecliptic', 'Galactic', 'ICRS': | ||
vals[system] = [np.zeros_like(ra_j2000_fk5), np.zeros_like(dec_j2000_fk5)] | ||
|
||
for ii, (raj, decj) in enumerate(zip(ra_j2000_fk5, dec_j2000_fk5)): | ||
|
||
# FK5 -> FK4 at BEPOCH 2000.0 assuming no proper motion or parallax | ||
r1950, d1950, dr1950, dd1950 = S.sla_fk54z (raj, decj, 2000.0) | ||
vals['FK4'][0][ii],vals['FK4'][1][ii] = r1950, d1950 | ||
|
||
# FK5 -> Ecliptic at TDB (MJD) 51544.0 (i.e. J2000) | ||
dl, db = S.sla_eqecl(raj, decj, 51544.0) | ||
vals['Ecliptic'][0][ii],vals['Ecliptic'][1][ii] = dl, db | ||
|
||
# FK5 -> Galactic | ||
dl, db = S.sla_eqgal(raj, decj) | ||
vals['Galactic'][0][ii],vals['Galactic'][1][ii] = dl, db | ||
|
||
# FK5 -> Hipparcos (i.e. ICRF, which is as close as SLALIB | ||
# gets to ICRS) at epoch 2000.0 and with no proper motion | ||
rh, dh = S.sla_fk5hz(raj, decj, 2000.0) | ||
vals['ICRS'][0][ii],vals['ICRS'][1][ii] = rh, dh | ||
|
||
|
||
glon = vals['Galactic'][0] | ||
glat = vals['Galactic'][1] | ||
np.savetxt('coords_galactic.txt', zip(np.degrees(glon), | ||
np.degrees(glat)), fmt="%20.15f") | ||
|
||
ra_fk4 = vals['FK4'][0] | ||
dec_fk4 = vals['FK4'][1] | ||
np.savetxt('coords_b1950.txt', zip(np.degrees(ra_fk4), | ||
np.degrees(dec_fk4)), fmt="%20.15f") | ||
|
||
elon = vals['Ecliptic'][0] | ||
elat = vals['Ecliptic'][1] | ||
np.savetxt('coords_ecliptic.txt', zip(np.degrees(elon), | ||
np.degrees(elat)), fmt="%20.15f") | ||
|
||
ra_fk5 = vals['ICRS'][0] | ||
dec_fk5 = vals['ICRS'][1] | ||
np.savetxt('coords_j2000.txt', zip(np.degrees(ra_fk5), | ||
np.degrees(dec_fk5)), fmt="%20.15f") | ||
|
||
|
Oops, something went wrong.