SecularAndHarmonic does not clear observations when resetting the fitting
In the runup to Orekit 7.0 being released, the implementation of org.orekit.utils.SecularAndHarmonic changed to accomodate the reorganization of code in the Apache Commons Math library, with the subsequent deprecation of the old ACM classes. In the old implementation, the Orekit class used a CurveFitter object that contained the observations, while in the new version the SecularAndHarmonic class contains the observed points itself, generating an anonymous fitter and least squares problem on the fly when the fit function is called.
The problem is that this new list of observed points is not cleared when a call to resetFitting is made. In my case, I was using the class to fit some elements of a GEO orbit in a series of cycles. Once a cycle was finished, I would reset the fitting but keep the current fit parameters as the initial guess for the new cycle. I noticed that the fitting showed a regression if I used the same SAH object, but not if I created a new one for each cycle, even if I copied the fit parameters from the old one.
The fix is a one-liner and restablishes the behaviour previous to the 7.0 release: resetting the fit clears the observed points. This case was not tested for in the new SecularAndHarmonicTest file, and the fix does not change the result of those tests.
(from redmine: issue id 205, created on 2015-05-26, closed on 2016-02-10)
- Uploads:
- orekit70-SAH-clear.diff SecularAndHarmonic patch
- orekit70-SAH-clear-test.diff Hastily put together test