question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Another) GCRS angular separation behavior

See original GitHub issue

This issue is to report another counter-intuitive behavior of angular separations in the GCRS frame. It follows on similar reports in #5185 and #6633 (and may be of interest to @StuartLittlefair and @adrn).

The basic issue is that an object at fixed ICRS position observed at two different times will have different GCRS coordinates. However, the separation between these GCRS coordinates is calculated to be zero. Here is a MWE:

from astropy.coordinates import SkyCoord, GCRS, ICRS
from astropy.time import Time

obj = SkyCoord(ra=37.0*u.degree,dec=-4.5*u.degree, distance=3*u.au)
obj_t0 = obj.transform_to(GCRS(obstime=Time(57370.0, format='mjd')))
obj_t1 = obj.transform_to(GCRS(obstime=Time(57380.0, format='mjd')))

print(obj_t0)
print(obj_t1)
print("Obj(t0) RA,DEC: ", obj_t0.ra.deg,obj_t0.dec.deg)
print("Obj(t1) RA,DEC: ",obj_t1.ra.deg,obj_t1.dec.deg)

print(obj_t0.separation(obj_t1))
print(obj_t1.separation(obj_t0))

and the output:

<SkyCoord (GCRS: obstime=57370.0, obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s): (ra, dec, distance) in (deg, deg, AU)
    (22.02874564, -14.46782793, 2.49351509)>
<SkyCoord (GCRS: obstime=57380.0, obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s): (ra, dec, distance) in (deg, deg, AU)
    (20.38720594, -13.68925892, 2.64894343)>
Obj(t0) RA,DEC:  22.028745635550386 -14.467827929473025
Obj(t1) RA,DEC:  20.387205935596295 -13.689258920287072
0d00m00s
0d00m00s

My understanding is that the frames of obj_t0 and obj_t1 differ (both are GCRS, but at different obstime). Thus, separation is converting the two coordinates to the same obstime, and thus the angular separation is calculated to be zero.

print("Equivalent frame?",obj_t0.is_equivalent_frame(obj_t1))

While I’m guessing this is the “correct” behavior, it is definitely counter-intuitive (i.e., when trying to compute parallax corrections for solar system objects).

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mhvkcommented, Apr 5, 2021

@eteq, @adrn and I are wondering if it wouldn’t be best to just raise an exception if the frames are not identical: it can be an origin that is different at the same time or different times with the same origin. Obviously, the exception message could then clarify things. (See also #11388)

0reactions
StuartLittlefaircommented, Apr 6, 2021

I’d be in favour of raising an exception, but we should certainly deprecate this usage first, as this will break a lot of code in the wild, and people should get some warning…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected behavior with SkyCoord.separation method #6633
I noticed an unexpected behavior when computing separations between two sets of ... (Another) GCRS angular separation behavior #8505.
Read more >
Galactic Cosmic Rays - an overview | ScienceDirect Topics
Galactic cosmic rays (GCR) are very high energy particles, chiefly protons, which can induce a wide variety of nuclear reactions when they interact...
Read more >
angular_separation — Astropy v5.2
Angular separation between two points on a sphere. Parameters ... Quantities should be in angular units; floats in radians. Returns. angular separation ......
Read more >
Average angular distance in degrees between any site and all of its ...
Average angular distance in degrees between any site and all of its neighbours for the Brunhes (B), normal (N) and reversed (R) subsets...
Read more >
The Galactic cosmic-ray Sun shadow observed by HAWC – arXiv ...
This allows for the study of the temporal behavior of the Solar magnetic field. ... intensity as a function of angular distance from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found