You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use solar_system_ephemeris for barycentric corrections and coordinate transforms? #4942
Currently, Time.light_travel_time uses coordinate transforms to calculate the barycentric corrections, essentially by getting the location-barycentre vector by transforming location to ITRS and using the coordinate framework. With #4890, we now in principle have the ability to do more accurate corrections (by combining the ITRS position with the barycentric position of the Earth), and I think this could even be made automatic by relying on solar_system_ephemeris for a default ephemeris (see #4920).
This issue is mostly to remind us to actually do this.
Furthermore, we should think whether to do this in light_travel_time (probably adding an ephemeris argument, defaulting to solar_system_ephemeris), or rather inside the coordinate frame transform graph. I'm slightly wary of the latter, as many conversions would become dependent on this state, which may lead to hard-to-track inconsistencies. On the other hand, it would be great to have the ultimate in precision available if needed.
Following the work done by @mhvk in #5231, this wouldn't actually be too much of a challenge. Most of the transformation code base between co-ordinate systems can remain in place, but we would replace the calls to erfa.apcs13 and erfa.apci13 with calls to erfa.apcs and erfa.apci. The former use erfa.epv00 to calculate the heliocentric and barycentric position and velocity; the latter ask the user to supply their own.
I'm thinking we should allow the transform_to method to accept an ephemeris argument which defaults to None, in which case the solar_system_ephemeris is used.
OK I could do with some guidance on this from wiser heads; @eteq, @mhvk.
We can do as I describe above but at the moment all the co-ordinate transforms have a hard-wired signature of (fromcoord, toframe). So there are two options:
Change the signature of all transforms to (fromcoord, toframe, **kwargs). This allows us to add an ephemeris argument to transform_to which would work exactly as we have in get_body.
Have the coordinate transforms "silently" respect the ephemeris context manager, e.g
In [1]: ippeg = coord.SkyCoord.from_name('IP Peg')
In [2]: ippeg.transform_to(coord.GCRS(obstime="J2000")) # use the builtin ephemeris by default
Out[2]:
<SkyCoord (GCRS: obstime=J2000.000, obsgeoloc=[ 0. 0. 0.] m, obsgeovel=[ 0. 0. 0.] m / s): (ra, dec) in deg
(350.78366528, 18.4178038)>
In [3]: with coord.solar_system_ephemeris.set('jpl'):
...: gcrs = ippeg.transform_to(coord.GCRS(obstime="J2000"))
...:
In [4]: gcrs
Out[4]:
<SkyCoord (GCRS: obstime=J2000.000, obsgeoloc=[ 0. 0. 0.] m, obsgeovel=[ 0. 0. 0.] m / s): (ra, dec) in deg
(350.78366528, 18.4178038)>
Those two results are different by the way, at the 0.2 microarcecond level!
Despite the former being more explicit, I am leaning towards the latter since, for many transforms, the "ephemeris" argument makes no sense, and so it seems odd to add it to transform_to.
@StuartLittlefair - I haven't looked at your branch yet, but like the idea of using the science state (although for items like light_travel_time, where one might not immediately think of coordinate transforms, I think an ephemeris element is still appropriate).
Activity
StuartLittlefair commentedon Aug 25, 2016
Following the work done by @mhvk in #5231, this wouldn't actually be too much of a challenge. Most of the transformation code base between co-ordinate systems can remain in place, but we would replace the calls to
erfa.apcs13anderfa.apci13with calls toerfa.apcsanderfa.apci. The former useerfa.epv00to calculate the heliocentric and barycentric position and velocity; the latter ask the user to supply their own.I'm thinking we should allow the
transform_tomethod to accept an ephemeris argument which defaults toNone, in which case thesolar_system_ephemerisis used.StuartLittlefair commentedon Aug 27, 2016
OK I could do with some guidance on this from wiser heads; @eteq, @mhvk.
We can do as I describe above but at the moment all the co-ordinate transforms have a hard-wired signature of
(fromcoord, toframe). So there are two options:(fromcoord, toframe, **kwargs). This allows us to add an ephemeris argument totransform_towhich would work exactly as we have inget_body.Those two results are different by the way, at the 0.2 microarcecond level!
Despite the former being more explicit, I am leaning towards the latter since, for many transforms, the "ephemeris" argument makes no sense, and so it seems odd to add it to
transform_to.StuartLittlefair commentedon Aug 27, 2016
To help discussion, I have a branch which fully implements option 2 here
mhvk commentedon Aug 27, 2016
@StuartLittlefair - I haven't looked at your branch yet, but like the idea of using the science state (although for items like
light_travel_time, where one might not immediately think of coordinate transforms, I think anephemeriselement is still appropriate).