我不确定这是否正是您想要的,但我试一试:
您可能需要使用SkyCoord 类:
import numpy as np
from astropy import units as u
from astropy.coordinates import SkyCoord
ra = np.random.uniform(130., 135., 10)
dec = np.random.uniform(-55., -57., 10)
你必须使用天文单位来设置它:
a = SkyCoord(ra * u.degree, dec * u.degree)
a
<SkyCoord (ICRS): (ra, dec) in deg
[(134.26176984, -55.707478), (134.58510684, -55.87649941),
(134.87524059, -56.48554659), (133.13341559, -56.81440026),
(132.87143675, -56.44936089), (131.14191795, -56.68300147),
(133.50910855, -56.07594072), (132.05561955, -56.90231565),
(134.62961065, -55.72207914), (133.64757046, -55.59277667)]>
现在你有了一个坐标类(不确定哪个坐标系最合适。SkyCoord 默认为ICRS)。如果你想计算它的方位投影你可以使用其他representations 我认为PhysicsSphericalRepresentation 是你想要的?!
a.represent_as('physicsspherical')
<PhysicsSphericalRepresentation (phi, theta, r) in (deg, deg, )
[(134.26176984, 145.707478, 1.0), (134.58510684, 145.87649941, 1.0),
(134.87524059, 146.48554659, 1.0), (133.13341559, 146.81440026, 1.0),
(132.87143675, 146.44936089, 1.0), (131.14191795, 146.68300147, 1.0),
(133.50910855, 146.07594072, 1.0), (132.05561955, 146.90231565, 1.0),
(134.62961065, 145.72207914, 1.0), (133.64757046, 145.59277667, 1.0)]>