Unexpected behavior with SkyCoord.separation method
See original GitHub issueDear Astropy,
Thanks for such a useful project!
I noticed an unexpected behavior when computing separations between two sets of SkyCoords. When one of the SkyCoods is an array and the other is a single value, array.separation(value)
produces the correct result but value.separation(array)
does not. Here’s a simple example involving computing the distance between the Kepler field and the moon.
Cheers,
Erik
%pylab inline
from astropy.time import Time
import astropy.coordinates
from astropy.coordinates import SkyCoord, EarthLocation
from astropy import units as u
loc = EarthLocation.of_site('KPNO')
t0 = Time('2017-01-01 00:00:00', scale='utc')
t = t0 + np.arange(0.,365,1) * u.day
moon = astropy.coordinates.get_moon(t,location=loc)
kepler = SkyCoord('19h22m', '+44d30m', frame='icrs')
sep = moon.separation(kepler)
plot(t.datetime, sep.degree)
sep = kepler.separation(moon)
plot(t.datetime, sep.degree)
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Separations, Offsets, Catalog Matching, and Related ... - Astropy
The on-sky separation can be computed with the astropy.coordinates. ... SkyCoord.separation() methods, which computes the great-circle distance (not the ...
Read more >SkyCoord — Astropy v5.2
A convenience method to create and return a new SkyCoord from the data in an astropy ... Computes on-sky separation between this coordinate...
Read more >Table Operations — Astropy v5.2
Aggregation is the process of applying a specified reduction function to the values within each group for each non-key column. This function must...
Read more >Using the SkyCoord High-Level Class — Astropy v5.2
The SkyCoord class has a number of convenience methods that are useful in ... Single coordinate string with a LON and LAT value...
Read more >Astropy Documentation - Read the Docs
from astropy.coordinates import SkyCoord. >>> coordinate = SkyCoord(123.4*u.deg, ... The Astropy Project is a process intended to facilitate.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for looking into this! If this is the expected behavior than that’s great. It might help others if the docs were a little more explicit about this.
Cheers,
Erik
I just want to clarify that when dealing with the moon and a target, e.g for preparing observations one should use:
moon.separation( target )
thanks! I was also puzzled by this and I’m glad I found this post.