Skip to content

Document the orbitfit status flags - #495

Merged
matthewholman merged 5 commits into
mainfrom
docs/fit-status-flags
Sep 2, 2026
Merged

Document the orbitfit status flags#495
matthewholman merged 5 commits into
mainfrom
docs/fit-status-flags

Conversation

@matthewholman

@matthewholman matthewholman commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

The fit outcome is reported in six columns and none of them were written
down anywhere. This adds a docs page describing each one and when to read it.

The columns are flag, a summary that is 0 if and only if the fit converged
and passed every check, plus converged, stage, and three failed_* columns
carrying the individual verdicts. A clean fit is zero across all of them.

The page also warns that flag == 2 and flag == 6 under-report rejections:
where a fit stopped overwrites why it was rejected, so rejections should be
counted on failed_csq and failed_cov.

Closes #499.

Relevant to #493, but documents only what the code does today.

The flag column has eleven values in use and none of them were written
down anywhere in the documentation. This lists each value, what sets it,
and groups them by what they say about the fit.

The grouping matters more than the list: 2 and 6 are fits that converged
and were then rejected by a gate, while 1, 3, 4, 5 and 7 never converged
at all. The values are an enumeration, not a severity ordering.

Also notes that both gates are statistical rather than physical, so
flag = 0 means the estimator succeeded rather than that the orbit is
plausible. See #493.
@mschwamb

Copy link
Copy Markdown
Collaborator

Why not do a severity ordering?

@matthewholman

matthewholman commented Aug 27, 2026 via email

Copy link
Copy Markdown
Collaborator Author

@hannorein

hannorein commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

I don't feel strongly either way. If we do severity ordering, then we might end up with having to change values later when an additional flag value somewhere in the middle gets introduced.

One useful thing might be to label flag something else, like error or success. If we do that and make a distinction between positive values and 0, then we could have easily readable code like if (!error){ or if(success){.

@mschwamb

Copy link
Copy Markdown
Collaborator

I like the idea of error or success style

@hannorein

Copy link
Copy Markdown
Collaborator

Even with the documentation, I'm still a bit confused. It's not clear from this what the "gates" are. Sometimes the documentation refers to "gates currently enabled", sometimes to "both gates". Especially, what is a "statistical" gate? Related, I don't understand the statement "a fit can converge, pass both [both what?], and still describe an implausible orbit". What is an implausible orbit?

@mschwamb

Copy link
Copy Markdown
Collaborator

I am still confused after reading the draft documentation. After reading the documentation, I would think flag=0 are the only orbits I should look at in my output from layup orbitfitting. Is that correct?

@hannorein

Copy link
Copy Markdown
Collaborator

Wouldn't it make more sense to have separate flags for everything? One for converged/not converged and one for each gate?

@matthewholman

Copy link
Copy Markdown
Collaborator Author

@hannorein, are suggesting a bitmask?

@hannorein

Copy link
Copy Markdown
Collaborator

I wouldn't overcomplicate it. What about just using multiple variables to report outcomes of the multiple steps?

I'm suggesting it because it looks like some of the complexity and confusion comes from logic of how the different outcomes of fits/gates are combined. Rather than trying to explain the logic really well, wouldn't it be easier to just report the flags for the different steps and let the user combine/filter them?

It's just a suggestion... I could be miss something here!

@matthewholman

Copy link
Copy Markdown
Collaborator Author

@hannorein — you were right. Done in #513: separate columns for converged, stage, and one per check, with flag kept as the summary. It also supersedes #507.

@mschwamb — yes, flag == 0 is the right filter and stays that way. The new columns say why anything else was rejected.

#513 replaced the single flag with a summary plus five columns reporting
the individual facts, so the eleven-value taxonomy this documented no
longer describes the code.

Answers the two questions the review raised. Meg's - is flag == 0 the
only thing to look at - now has a direct answer at the top: yes for orbits
you intend to use, and the other columns say why anything else was
rejected. Hanno's objections were to undefined terms; 'gates' is gone,
each check is named and says what it tests, and there is no longer a
'statistical gate' or an unexplained 'implausible orbit'.

Adds the warning issue #499 now tracks: flag == 2 and flag == 6
under-report, because where a fit stopped takes precedence over why it was
rejected. Count rejections on failed_csq and failed_cov instead.

failed_physical is documented as reserved and currently always 0, since
the check it is for is not applied yet.
Follows #497, which applies the hyperbolic-excess-speed check and adds
FLAG_IMPLAUSIBLE_ORBIT. failed_physical is no longer reserved.

Says what the check does and does not do: it catches the extreme case, the
threshold is deliberately generous because layup is expected to fit real
interstellar objects, and it will therefore accept short-arc orbits that
are implausible without being impossible. Names the constant and says
which way to move it.

DEPENDS ON #497 - flag 9 does not exist until that merges.

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

This functions as intended. Good enough for now. A robot can, and will, fix it later if need be.

@matthewholman
matthewholman merged commit b387a66 into main Sep 2, 2026
7 checks passed
@matthewholman
matthewholman deleted the docs/fit-status-flags branch September 2, 2026 17:25
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.

Document that flag under-reports gate rejections; triage on the failed_* columns

4 participants