[AstroPy] Use of separation

Emil Lenc elenc at me.com
Fri Mar 26 03:44:34 EDT 2021


Hi All,

I’ve been trying to determine the separation between a point in the sky and the moon and I’ve come across a strange situation that I don’t quite understand. Depending on how I determine the separation I get two very different results i.e. if I determine the separation between the moon and the sky location as opposed to the separation between the sky location and the moon. I expected that these should give the same result but they don't. Here is a simple script to demonstrate what I mean:

from astropy import units as u
from astropy.time import Time
from astropy.coordinates import EarthLocation, Angle, SkyCoord
from astropy.coordinates import get_moon

# Where are we observing from?
latitude = Angle("-26:41:46.0", unit=u.deg)
longitude = Angle("116:38:13.0", unit=u.deg)
observing_location = EarthLocation(lat=latitude, lon=longitude)

# When are we observing?
t = Time("2021-03-04 21:51:58", format='iso', scale='utc')

# Where is the moon?
moon = get_moon(t, observing_location)
pointing = SkyCoord("15h33m45.000s -18d40m3.793s", frame='fk5’)

# Print out the location of the moon
dir_str = moon.to_string(style='hmsdms')
print("Moon (at specified location) is at: %s" %(dir_str))

# Print out the location of the pointing
dir_str = pointing.to_string(style='hmsdms')
print("Pointing is at: %s" %(dir_str))

# Determine the separation between the moon and the pointing
sep = moon.separation(pointing).deg
print("Moon separation from pointing = %0.1f deg" %(sep))

# Determine the separation between the pointing and the moon
sep = pointing.separation(moon).deg
print("Pointing separation from Moon = %0.1f deg\n" %(sep))

The result of running this script producing the following result:

Moon (at specified location) is at: 15h48m35.4296s -18d29m19.3018s
Pointing is at: 15h33m45s -18d40m03.793s
Moon separation from pointing = 3.5 deg
Pointing separation from Moon = 71.5 deg

Does anyone understand why the second case giving a result of 71.5 degrees? Any help would be greatly appreciated.

Best regards,

Emil.



More information about the AstroPy mailing list