Skip to content

Apply debiasing for obs80 catalog codes, not just names (Closes #409) - #410

Merged
matthewholman merged 1 commit into
mainfrom
issue/409/debias-catalog-code
Jul 2, 2026
Merged

Apply debiasing for obs80 catalog codes, not just names (Closes #409)#410
matthewholman merged 1 commit into
mainfrom
issue/409/debias-catalog-code

Conversation

@matthewholman

Copy link
Copy Markdown
Collaborator

Summary

debias() silently applied no correction on obs80 input: Obs80DataReader supplies the single-char catalog code (W, q, …), but debias() looked the catalog up as an MPC_CATALOGS key (a name like UCAC4). Since bias_dict is keyed by the code, a code never resolved → the guard returned the astrometry unchanged. So debiasing never fired on obs80 — including the bulk MPC archive the catalogue fit ingests.

Fix

catalog_key = MPC_CATALOGS.get(catalog, catalog)  # name -> code, or a code passes through
if catalog_key is None or catalog_key not in bias_dict:
    return ra, dec

Validation

End-to-end, fitting the same objects with debias=False vs debias=True now differs (it was byte-identical before the fix):

obj Δa (debias off) Δa (debias on)
20000 3.83×10⁻⁴ 2.16×10⁻⁴
90377 4.08×10⁻² 1.14×10⁻¹
944 5.27×10⁻⁸ 6.89×10⁻⁸

Corrections are small (sub-arcsec), as expected — but they now actually apply, which the "faithful to JPL" weighting+debiasing story needs on obs80 data.

Tests

Adds a regression test asserting a code ("p") yields the same correction as its name ("PPM") and actually changes the astrometry. All 8 test_debias tests pass.

Closes #409.

🤖 Generated with Claude Code

debias() looked the catalog up as an MPC_CATALOGS key (a name, e.g. "UCAC4"),
but obs80 supplies the single-char code (a value, e.g. "q"). bias_dict is keyed
by the code, so a code never resolved and debiasing silently no-op'd on all
obs80 input -- including the bulk MPC archive the catalogue fit ingests.

Use MPC_CATALOGS.get(catalog, catalog): a name maps to its code, a code passes
through, and blank/None/unknown still fall through the `not in bias_dict` guard
unchanged (preserving #401). Confirmed end-to-end: fitting with debias on vs off
now differs (it was byte-identical before).

Adds a regression test asserting a code (e.g. "p") applies the same correction
as its name ("PPM") and actually changes the astrometry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matthewholman
matthewholman requested a review from kjnapier July 2, 2026 17:00

@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 3216fa3 into main Jul 2, 2026
10 of 11 checks passed
@matthewholman
matthewholman deleted the issue/409/debias-catalog-code branch July 2, 2026 18:05
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.

debias() silently no-ops on obs80 catalog codes (single-char codes vs MPC_CATALOGS names)

2 participants