[AstroPy] Use of separation

Stuart P Littlefair s.littlefair at sheffield.ac.uk
Fri Mar 26 03:50:49 EDT 2021


Hi Emil

The documentation for separation has an explanation of this. 

https://docs.astropy.org/en/stable/api/astropy.coordinates.SkyCoord.html#astropy.coordinates.SkyCoord.separation

“ If the other coordinate object is in a different frame, it is first transformed to the frame of this object. This can lead to unintuitive behavior if not accounted for. Particularly of note is that self.separation(other) and other.separation(self) may not give the same answer in this case.“

Stuart Littlefair
Dept. of Physics & Astronomy
Univ. of Sheffield, Sheffield, S3 7RH

email: s.littlefair at shef.ac.uk
Phone: +44 114 2224525
Sent from my iPhone

> On 26 Mar 2021, at 07:45, Emil Lenc <elenc at me.com> wrote:
> 
> 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.
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20210326/aec4eac9/attachment.html>


More information about the AstroPy mailing list