def calcAngSepDeg(ra0, dec0, ra1, dec1):
'''Return the angular separation between two objects. Use the
special case of the Vincenty formula that is accurate for all
distances'''
C = numpy.pi / 180
d0 = C * dec0
d1 = C * dec1
r12 = C * (ra0 - ra1)
cd0 = numpy.cos(d0)
sd0 = numpy.sin(d0)
cd1 = numpy.cos(d1)
sd1 = numpy.sin(d1)
cr12 = numpy.cos(r12)
sr12 = numpy.sin(r12)
num = numpy.sqrt((cd0 * sr12) ** 2 + (cd1 * sd0 - sd1 * cd0 * cr12) ** 2)
den = sd0 * sd1 + cd0 * cd1 * cr12
return numpy.arctan2(num, den) / C
评论列表
文章目录