-
-
Notifications
You must be signed in to change notification settings - Fork 281
Fix near parabolic regimes #908
Fix near parabolic regimes #908
Conversation
Asked one question about notation in Math.StackExchange - it turns out that T^1 is the 1-torus, the circle. Cool! |
7ef086b
to
da5b797
Compare
Codecov Report
@@ Coverage Diff @@
## master #908 +/- ##
==========================================
- Coverage 89.93% 89.34% -0.60%
==========================================
Files 69 69
Lines 3608 3668 +60
Branches 301 316 +15
==========================================
+ Hits 3245 3277 +32
- Misses 286 308 +22
- Partials 77 83 +6
Continue to review full report at Codecov.
|
da5b797
to
00ce629
Compare
Well, this was more difficult than expected. Getting errors in some old tests that compare the propagator with Cowell's method, still not sure what's happening. Will review tomorrow. |
d550faf
to
50795fb
Compare
Well, this turned out to be more difficult than I thought. Several findings while working on this:
I still don't understand why We have a path to fix this, but it will take a long time. |
50795fb
to
501bd77
Compare
All the propagators in A very obvious case can be seen in Mikkola's method: poliastro/src/poliastro/core/propagation.py Lines 327 to 335 in 643356d
I feel that if we mix the treatment that Farnocchia does of the near-parabolic region with the other propagators we can get mixed results. Doing so probably requires a careful review of all the algorithms and implementations. The last two years we have devoted a lot of time to improve our propagators, and I have to say both @jorgepiloto and @nikita-astronaut did an amazing job. Therefore, I will try not to affect how other propagators work while fixing the issues with the Farnocchia one. And to finally justify all this work, let's take a look at this table again: poliastro/src/poliastro/twobody/propagation.py Lines 4 to 22 in 643356d
Leaving Cowell's method aside, Farnocchia's and Vallado's are the only propagators we have at the moment that are supposed to work with all orbits. Vallado's method, being based on the universal variables approach, shares its pros and cons. From Farnocchia et al.: Even though @nikita-astronaut fixed the convergence problems of Vallado's method in #362, it still requires a large number of Newton iterations (in line with the comment above) and the relative tolerance is bounded by numerical errors. In conclusion:
|
While working on this PR I came to an important realization: Even if most books and papers talk about the mean anomaly as a quantity that can be defined for elliptic, parabolic and hyperbolic orbits, more rigorous texts like Battin are very careful not to abuse the term for eccentricities equal or larger than one. For example, the "mean anomaly" for hyperbolic motion is referred to as "the quantity N": The same can be said about the "parabolic anomaly" and the "hyperbolic anomaly", which are never called as such: the former is mentioned tangentially suggested when saying that "tan f/2 is the key variable in Barker's equation", and the latter is called "the quantity H", or the "hyperbolic analog to the eccentric anomaly". My theory is that this is done because these quantities do not represent angles directly. However, for practical reasons this fact is often overlooked. |
My previous comment has important implications for poliastro. In the same way that |
See poliastro#908 for discussion.
See poliastro#908 for discussion.
See poliastro#908 for discussion.
See poliastro#908 for discussion.
See poliastro#908 for discussion.
See poliastro#908 for discussion.
bbdafda
to
5a6b9fa
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
After the initial guess change, the following tests are still failing on CI:
The Windows build passed though! |
Those pass locally with |
Can't reproduce these locally, either with numba 0.48 or 0.49, with or without jitting. |
It would be interesting to know the processor type/supported SIMD instruction sets, if numba is optimizing w.r.t. those that might be a difference... |
|
Found another falsifying case locally: |
5cbac9d
to
a57e757
Compare
a57e757
to
7f5dc6b
Compare
All tests passed 😍 Thanks everyone who chimed in! I am now merging this once and for all. |
@helgee are your failing tests (with JIT) covered with the fixes in the latest commits? If not, it might be worth to open a separate issue on these. |
Works fine now 👍 |
@astrojuanlu Just a followup on your comment regarding issue #10230 in the astropy repository. I'm posting here as it seems like a more appropriate place to do so. Your comment was a bit concerning as I have a program that is in use by the control systems at several observatories to track comets in real time given a set of orbital elements. The algorithm that I use is attributed to Danby from the 2nd edition of his book Fundamentals of Celestial Mechanics 1988 (pages 149-154). I don't have a copy of this book, but it uses an accelerated Newton's method very similar to the one I see in
I have never had any problems with this program. From what I see here, the issues that you were seeing only occur when the true anomaly is close to 180 degrees. Is that correct? If that is the case, then I'm not going to worry much as we are only concerned with observing comets as they make their closest approach to Earth. |
Oh, never mind on the difference in the algorithms. I see that yours has the factors of 1/2 and 1/6 absorbed in to deltas whereas mine doesn't. |
Thanks for chiming in @mkbrewer! (xref astropy/astropy#10230) The conversation in this particular pull request is a mess. The important thing is the end result, based on the Farnocchia et al. paper. Let me know if you have any comments about it. |
No comments, just my question above. |
@astrojuanlu An answer to this question would be appreciated when you have the time.
|
Hello @mkbrewer, I'm so sorry for the huge delay - I was in a bad moment when you asked, and then when I recovered I have been postponing it. Trying to get back on track.
Yes, that's correct. The issues that we were seeing in this algorithm were for the case where the true anomaly is close to 180 degrees. If you think about it, that condition is impossible to happen in true parabolic motion, and for near-parabolic motion, the closer we are to 180 the more evidence we have that the orbit is, well, elliptic. That's why in the chart by Farnocchia et al. the "near parabolic" region shrinks towards 180 degrees: Fortunately, we managed to fix our implementation (it contained several conceptual errors) and now our Hope this answers your question, please let me know otherwise. |
Regions of
(nu, ecc)
from Farnocchia at al., 2013:Previously our logic was wrong: we were incorrectly using the near parabolic solution where we should have been using the strong elliptic solution, and therefore it failed "in the vicinity of
nu = pi
,0.985 < ecc < 1.0
(fordelta=1e-2
)" as I correctly identified two years ago.nu_to_M
(which causesorbit.M
to hang)M_to_nu
(which causes themean_motion
propagator to hang)Fix #475 (finally!), fix #907.