File: angle_distance.py

package info (click to toggle)
pymap3d 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: python: 3,742; ruby: 105; makefile: 4
file content (19 lines) | stat: -rwxr-xr-x 712 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
from argparse import ArgumentParser

from pymap3d.haversine import anglesep, anglesep_meeus
from pytest import approx

p = ArgumentParser(description="angular distance between two sky points")
p.add_argument("r0", help="right ascension: first point [deg]", type=float)
p.add_argument("d0", help="declination: first point [deg]", type=float)
p.add_argument("r1", help="right ascension: 2nd point [deg]", type=float)
p.add_argument("d1", help="declination: 2nd point [degrees]", type=float)
a = p.parse_args()

dist_deg = anglesep_meeus(a.r0, a.d0, a.r1, a.d1)
dist_deg_astropy = anglesep(a.r0, a.d0, a.r1, a.d1)

print(f"{dist_deg:.6f} deg sep")

assert dist_deg == approx(dist_deg_astropy)