Repository navigation
Fix ecliptic transformations - #6508
Conversation
|
Hi there @Juanlu001 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
|
Thanks! If this change is correct (I'll leave that decision up to @eteq and others), this needs a comment when calling the ERFA function to explain the choice of ERFA function (so people don't change it back), and a changelog entry. |
|
Some of the failures are due to timeouts or jobs not starting, but some others are doctest precision differences with Talking about the choice of ERFA function, in the absence of nutation I am not sure if we can keep calling these systems |
|
I wonder if this means we should actually add frames called |
|
I added yet another correction that I have been working on for several weeks now and that was causing us great pain in poliastro. On the one hand, the vector arithmetic for the computation of the position of the Sun was flawed. I attach a sketch to support the corresponding change. On the other hand, the Thanks to these changes, we managed to read data from the JPL Small-Body Database Browser, set it to the corrected Surprisingly (at least on first thought), the coordinates-benchmarks results did not change. I am not sure about the reasons for this, but perhaps it is only checking the coordinates of very distant objects and traslations of ~800 000 km are not significant (whereas small changes in rotations have dramatic impacts). I would like to ask for guidance regarding this specific issue. If the devs give their OK from an algorithmic point of view, I will continue adding tests, documentation and a changelog entry. |
|
@Juanlu001 - this looks very promising indeed! I have no time to look at this myself (and am also not a real expert anyway), but also @StuartLittlefair, who wrote quite a bit of these parts of the code. |
|
@Juanlu001 these fixes look great, and look right to me. My only questions are about frame naming, and the separate With frame naming, ecliptic frames normally use either a mean equinox of a standard date (i.e J2000), the mean equinox of a specific date (i.e what you have here) or the true equinox of a specific date (precession + nutation). We definitely shouldn't call this With respect to using separate |
Cool, will do that!
I don't have an opinion at all on how these frames should be, so I tried to replicate what NASA and JPL do in their public APIs to suit my needs. In my view (after much struggling), I don't have a problem in removing |
|
@Juanlu001 Sorry for the slow conversation; things are extremely hectic for me at the moment. If I understand correctly then, you wish for the '''MeanEcliptic''' frame to use the same epoch for the obliquity as Horizons, but a user-specified epoch for the central body's position? However, there's no such requirement for the '''TrueEcliptic''' frame? Would the frames be useable if they had one parameter (e.g '''obstime'''), and the TrueEcliptic frame used this for both the obliquity and the position of the Sun, but the MeanEcliptic frame used a reference epoch (not given as a parameter, but documented) for the position and/or obliquity? If not, perhaps if you can show a use case that would fail it would help me understand why both '''equinox''' and '''obstime''' are needed. |
No need to apologize :)
Correct. In fact, I don't even need a variable epoch for the obliquity - they just use the value of J2000 always. What I do need though is a way to specify the position of the Sun.
I have no way to validate this. My entire journey has been to replicate what JPL Horizons gives (you can do the experiments by yourself), and the web interface only has one ecliptic frame to select:
Probably because it's the only modern ecliptic frame defined in SPICE: There were already concerns about validation of ecliptic frames (see original issue #6461 and discussion in #3749). This pull request can be considered another data point.
I won't use the
Yes, definitely. If we have a reference epoch (say, J2000) for the obliquity and an |
|
Ok, excellent. I would keep the single parameter's name the same as before to minimise API changes. So I would implement two frames, and have '''equinox''' set the position and obliquity in '''TrueEcliptic''' but only the position in '''MeanEcliptic''' |
|
The name But perhaps I should first ensure I really understand what these coordinates are:
With this list, it seems fairly obvious that For the Separately, looking at the links @Juanlu001 posted, the splice reference frames include: It seems the frame actually wanted here is the equivalent of |
|
Let me also cc @scottransom, @paulray, and @luojing1211 since they may have some insight on ecliptic reference frames via pulsar timing. |
|
Just to clarify the terminology @mhvk: acoording to the appendix of the SOFA Tools for Earth Attitude cookbook, the terms "true" and "mean" refer to the inclusion of the nutation terms in the rotation matrix. As @eteq explained in his original pull request (see #3749 (comment)), he ended up adding the "true" versions and not the "mean" versions. Fast forward until two weeks ago, I realized that neither
So I went on investigating, and found that the position of the Sun was the main driver of the errors - in Astropy it was being computed using the
After all this journey, apart from being precise with the Of course, by fixing my needs I don't want to screw up the rest of the folks that use this, so I'm happy they are all brought to the conversation :) |
|
@Juanlu001 - Thanks for the summary! Reading back the comments in #3749, it seems to me that we indeed want the But really @eteq should pipe in as well.. |
|
Separately, shouldn't |
+1! |
|
@mhvk @Juanlu001 I think I'm clearer on the issue here now. I think it's fair to say that the only difference between On reflection, I can see no problem with including It is probably also worth documenting somewhere which equinox/epoch to use to get the same results as Horizons.... |
Correct!
In fact, "of epoch" equals "of date when date is J2000", at least in the books and papers I have read (perhaps others think otherwise). Anyway, I agree with documenting this very carefully, it's a confusing topic and some pointers to "ground truth" references (like the SOFA cookbook, also USNO Circular 179) are totally worth it.
With these changes, we can note in the docstring of Which is the value that I understand however that this might be too application-specific. If we do not include it in Astropy I will include it in poliastro anyway :) |
|
@Juanlu001 - in principle, it seems to me that if it is used in the SPICE kernels, astropy should support it, or at least we should document how to get it. Just to be sure, in the frame defined for SPICE, which is J2000, both precession and nutation should be irrelevant, correct? Hence, the only term left is the "frame bias" - so is it that term that is not applied in Just as another reference point, looking at PINT's |
|
@mhvk -- I haven't had time to really read/understand this discussion fully yet. As far as PINT's implementation, the only intent was to be compatible with how TEMPO/TEMPO2 have traditionally defined ecliptic coordinates. As you say, this is a simple rotation using obliquity only; there are several choices for what obliquity value is used, there may be some useful historical info in $TEMPO/ephem/ecliptic.dat. |
To be clear: for the transformation between J2000 and ECLIPJ2000 either way, as defined by SPICE, both precession and nutation are irrelevant.
I think that correction was introduced in the new IAU resolutions, and from what I understand they are using the old models. |
My proposal:
1In principle I would be against including frames that cannot be externally validated, but I understand that maybe others want them there anyway. Does this make sense? |
|
(For those following this discussion by email -- I made some tweaks to my last comment, please open GH issue) |
* Fix signs in vector arithmetic. * Use new attribute obstime of HeliocentricTrueEcliptic to compute the position of the Sun, consistent with other systems like GCRS.
13131b1 to
73c4a76
Compare
|
@Juanlu001 - on the Astropy 3.0 changes break out the various frames, I think you should go full steam ahead. I think I also tilt towards But I still think having one actual True (i.e. obstime=equinox) equinox is necessary, because it's the one that maps best conceptually to what less-informed people think an equatorial system is. It may be more a nod to pedagogy than to precision, but that's still useful. |
|
Thank you very much @eteq and everybody else that engaged in the discussion! I will be glad to start working on this, hopefully before the end of the year. |
|
A year has passed but I did not forget about this :) I hope I can put something together before Astropy 3.2 feature freeze. |
|
Thank you, @Juanlu001 ! Looking forward to it. Happy New Year! |
The frames transformation was changed from true to mean in astropy#6508 while deciding to keep the "wrong" names for backwards compatibility, however the docstrings have been wrong all along and included no user-facing warning whatsoever.
This reverts part of the changes made in astropy#6508 in that it makes *TrueEcliptic frames be _true_ again without warnings or shortcomings. Howerver, they come without tests.
This reverts part of the changes made in astropy#6508 in that it makes *TrueEcliptic frames be _true_ again without warnings or shortcomings. Howerver, they come without tests.
|
For the interested readers, here's my followup #8394 |
The frames transformation was changed from true to mean in astropy#6508 while deciding to keep the "wrong" names for backwards compatibility, however the docstrings have been wrong all along and included no user-facing warning whatsoever.
This reverts part of the changes made in astropy#6508 in that it makes *TrueEcliptic frames be _true_ again without warnings or shortcomings. Howerver, they come without tests.
This reverts part of the changes made in astropy#6508 in that it makes *TrueEcliptic frames be _true_ again without warnings or shortcomings. Howerver, they come without tests.
The frames transformation was changed from true to mean in astropy#6508 while deciding to keep the "wrong" names for backwards compatibility, however the docstrings have been wrong all along and included no user-facing warning whatsoever.
This reverts part of the changes made in astropy#6508 in that it makes *TrueEcliptic frames be _true_ again without warnings or shortcomings. Howerver, they come without tests.

SOFA/ERFA new functions for ecliptic transformations do not use the nutation matrix (see #4873 (comment)). Adjusting the corresponding Astropy function seemed to fix the precision issues with respect to the rest of the tools.
If this is merged, I think there is no need to go for #4873.
Before/After: