Skip to content

Report the chi-square on fits that were rejected rather than accepted - #519

Merged
matthewholman merged 1 commit into
mainfrom
fix/518-csq-on-rejected-fits
Sep 2, 2026
Merged

Report the chi-square on fits that were rejected rather than accepted#519
matthewholman merged 1 commit into
mainfrom
fix/518-csq-on-rejected-fits

Conversation

@matthewholman

Copy link
Copy Markdown
Collaborator

csq is now written for every flag except -1 (never attempted) and 5 (no
candidate found to score). The state, covariance and epoch stay gated on
flag == 0, so a finite chi-square on a rejected row cannot be read as an
accepted orbit.

This makes the stage markers diagnosable. On ten main-belt objects a cold start
cannot fit -- all flag 3 or 4, all previously NaN -- the chi-squares separate
into two groups the flags could not distinguish: four between 22 and 2652, and
six between 5e7 and 2e10. The first group is a weighting or outlier problem on a
good orbit; the second is a wrong orbit.

Closes #518.

csq was written only when flag == 0, so a fit that converged and was then
rejected reported NaN -- discarding the number that explains the rejection
exactly when it is wanted. The stage markers hid it too: do_fit returns the
lowest-chi-square candidate it tried, so a fit labelled 3 or 4 still carries a
meaningful score.

csq is now reported for every flag except -1 (never attempted) and 5 (no
candidate found to score). The state, covariance and epoch stay gated on
flag == 0, so a finite csq on a rejected row cannot be read as an accepted
orbit.

On the ten main-belt objects a cold start cannot fit -- all flag 3 or 4, all
previously NaN -- the chi-squares separate into two groups: four with reduced
chi-square 22 to 2652, and six between 5e7 and 2e10.

Closes #518

@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.

Looks good

@matthewholman
matthewholman merged commit eead782 into main Sep 2, 2026
7 checks passed
@matthewholman
matthewholman deleted the fix/518-csq-on-rejected-fits 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.

csq is NaN for fits rejected on chi-square

2 participants