*


Get constellation names from RA and DEC with Python

#!/usr/bin/python3
import sys
from astropy import units as u
from astropy.coordinates import SkyCoord, get_constellation 
coord=sys.argv[1:]
co=" ".join(coord)
c=SkyCoord(co, unit=(u.hourangle,u.deg))
print(get_constellation(c,short_name=False))


Distance between stars with linear algebra in Python (example used is the milk run from Rigilkent to Proxima):

#!/usr/bin/env python3
import sys
import numpy as np
p1 = np.array(sys.argv[1:4], dtype=float)
p2 = np.array(sys.argv[4:7], dtype=float)
print(np.linalg.norm(p2 - p1))

Galactic Cartesian coordinates from RA and DEC (Alpha Centauri used for the example, and compared to a run with Celestial coordinates)

#!/usr/bin/env python3
import sys
from astropy import units as u
from astropy.coordinates import SkyCoord
c = SkyCoord(
    " ".join(sys.argv[1:7]),
    unit=(u.hourangle, u.deg),
    distance=float(sys.argv[7]))
g = c.galactic
print(g.cartesian)