我有两个具有赤道坐标(ra, dec)
且(ra_0, dec_0)
位于距离r
和的源r_0
,我需要计算它们之间的 3D 距离。
据我所知,我使用了两种应该给出相同结果的方法,但事实并非如此。
第一种方法是应用astropy的separator_3d函数。第二种方法是使用用球坐标给出两个源之间距离的表达式:
如此处所示。
在下面的 MCVE 中,返回的值为:
91.3427173002 pc
93.8470493776 pc
这两个值不应该相等吗?
MCVE:
from astropy.coordinates import SkyCoord
from astropy import units as u
import numpy as np
# Define some coordinates and distances for the sources.
c1 = SkyCoord(ra=9.7*u.degree, dec=-50.6*u.degree, distance=1500.3*u.pc)
c2 = SkyCoord(ra=7.5*u.degree, dec=-47.6*u.degree, distance=1470.2*u.pc)
# Obtain astropy's distance between c1 & c2 coords.
print c1.separation_3d(c2)
# Obtain distance between c1 & c2 coords using explicit expression.
ra_0, dec_0, r_0 = c1.ra.radian, c1.dec.radian, c1.distance
ra, dec, r = c2.ra.radian, c2.dec.radian, c2.distance
alpha_delta_par = np.sin(dec) * np.sin(dec_0) * np.cos(ra - ra_0) +\
np.cos(dec) * np.cos(dec_0)
d_pc = np.sqrt(r**2 + r_0**2 - 2*r*r_0*alpha_delta_par)
print d_pc