Skip to content

Propagate fitted non-gravitational parameters in predict - #524

Merged
matthewholman merged 2 commits into
mainfrom
fix/522-predict-nongrav
Sep 2, 2026
Merged

Propagate fitted non-gravitational parameters in predict#524
matthewholman merged 2 commits into
mainfrom
fix/522-predict-nongrav

Conversation

@matthewholman

Copy link
Copy Markdown
Collaborator

Fixes #522.

predict re-integrated a fitted orbit under gravity alone, discarding any A1/A2/A3 the fit had solved for. For a comet, or an asteroid with a detected Yarkovsky acceleration, the prediction drifted away from the orbit that produced it.

Two halves were missing. predict.cpp never enabled ASSIST_FORCE_NON_GRAVITATIONAL or set particle_params, and parse_fit_result dropped the a1/a2/a3 columns on the way from the fit table back into a FitResult — so fixing either one alone leaves the bug in place. residuals_at_state now passes the parameters through as well.

Verified on 152563 (1992 BF), whose A2 is well determined over a 1953–2016 arc: residuals at the fitted state drop from 15" to 2" in 1953, and the predicted-to-fitted agreement is 1.000 for both gravity-only and A2 fits. Two regression tests, each confirmed to fail when either half of the fix is reverted.

Closes #522.

predict and residuals_at_state built their simulations from the fitted state but
never enabled ASSIST's Marsden non-gravitational force, so both propagated
gravity-only even when the fit had solved for A1/A2/A3. parse_fit_result
compounded it by dropping the amplitudes at the Python boundary, so the values
never reached the C++ at all. The predicted position, and the uncertainty ellipse
mapped about it, were therefore wrong for any non-gravitationally fitted object,
silently.

Three changes. parse_fit_result now carries a1/a2/a3 and reconstructs
nongrav_mask from which columns the result row has, since those columns exist
only when a non-gravitational fit ran. predict.cpp gains
apply_nongrav_from_fit(), applied at both sites that build a simulation, using
the same default g(r) as the fit. residuals_at_state passes the mask and
amplitudes through to compute_residuals, which already accepted them.

Verified on (152563) 1992 BF, 644 optical observations over 71 years fitted with
A2: the chi-square implied by residuals_at_state went from 4779.9 against a
reported 665.5 to matching it exactly, and the residuals on the four 1953
precovery plates fell from about 15 arcsec to about 2 -- consistent with
Vokrouhlicky, Chesley and Matson (2008), who corrected those positions by up to
3.1 arcsec.

The new test asserts residual size rather than chi-square, since the noise-free
synthetic arc drives chi-square to zero and a relative comparison against it is
degenerate. Both new tests fail with either half of the fix reverted.
…cceleration

The prediction entry described integrate-once/interpolate-to-many but was silent
on non-gravs, which until #522 it did not in fact propagate.

@kjnapier kjnapier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@matthewholman
matthewholman merged commit 6d18296 into main Sep 2, 2026
7 checks passed
@matthewholman
matthewholman deleted the fix/522-predict-nongrav branch September 2, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

predict and residuals_at_state ignore fitted non-gravitational parameters

2 participants