You can use SkyCoord.separation
to compute the separation between coordinates:
c1 = SkyCoord('08h55m10s',' -7d14m42s', frame='icrs') # your coords
c2 = SkyCoord(133.782, -7.241, unit='deg', frame='icrs') # first object in table
sep = c1.separation(c2)
print c1
<SkyCoord (ICRS): ra=133.791666667 deg, dec=-7.245 deg>
print c2
<SkyCoord (ICRS): ra=133.782208333 deg, dec=-7.24123611111 deg>
print sep
0d00m36.3947s
The table you printed is truncated in between. If you enlarge your terminal emulator, you will be able to see a column called dist
, which is the distance between your input coordinates and the corresponding object in arcsecs:
print table['dist']
dist
------------------
36.420772999999997
44.138542000000001
51.987606999999997
52.838003
49.937266999999999
22.372699000000001
53.621690000000001
12.375482
25.27176
53.707365000000003
Then the nearest object is the one whose separation is:
print table['dist'].min()
12.375482
Or equivalently, the one whose index is:
print table['dist'].argmin()
7
The separation is calculated using the equation that @Rob Jeffries pointed out.
No comments:
Post a Comment