Skip to content

Hold the reference fixed within later alignment iterations - #37

Draft
wei-lingfeng wants to merge 4 commits into
MovingUniverseLab:devfrom
wei-lingfeng:hold-ref-within-iteration
Draft

wei-lingfeng wants to merge 4 commits into
MovingUniverseLab:devfrom
wei-lingfeng:hold-ref-within-iteration

Conversation

@wei-lingfeng

Copy link
Copy Markdown
Collaborator

Builds on #36; review the last commit (6e2e6ee). Draft until #36 is merged.

From the second iteration on, stars already in the reference keep their fit from the previous iteration while the starlists are matched, and all stars are refit once, after the last list. Before, each star was refit after every list from only the epochs matched so far in that iteration (one epoch, then two close in time), and the next list was matched against those fits. Stars added during an iteration are still fit as their lists come in; the first iteration is unchanged. update_ref_orig='periter' already held catalog stars this way; this extends it to stars added from the starlists.

This changes the results of multi-iteration runs that add stars from the starlists (for example every MosaicToRef run against a Gaia subset). Runs where every star is in the reference catalog are unchanged.

Results against known truth

  • Test-suite datasets (make_fake_starlists_poly1_vel, _poly1_acc; update_ref_orig False and 'periter'; 10 seeds): identical results.
  • poly1_vel with clustered epochs, 1 mas noise, and a 15-star reference (10 seeds): position and velocity errors 36% smaller on every seed (median 1.62 -> 1.08 mas, 1.57 -> 1.15 mas/yr). The gain is in the frame tie; star-to-star precision (after removing a linear field) is unchanged.
  • OB150211-like simulations (10 seeds x chi2/legacy x Linear/Parallax): fewer split stars on every seed (extra rows 10 -> 2 with chi2, 140 -> 118 with legacy) and 0.7 percentage points more detections matched to the right star.

OB150211: leave-one-epoch-out residuals of stars matched identically by both versions, median 1.77-1.93 -> 1.71-1.74 mas. fit() is 6-17% faster (aggregate updates take half the time).

Tests: test_reference_held_within_later_iterations (fails without the change). Full suite: 139 passed. CHANGES.rst and docs/alignment.rst updated.

wei-lingfeng and others added 2 commits December 2, 2026 16:12
…llax

In iterations after the first, update_ref_table_aggregates sends stars
with at most one epoch to combine_lists_xym, which sets x0/y0 to that
epoch's position but leaves t0 and the motion parameters from the
previous fit (introduced in cea7916). predict_positions then moves the
star with its old velocity from the old t0, misplacing it at every other
epoch; with clustered epochs, stars stop matching and split into several
reference rows. x0/y0 are now shifted so that the star's existing
trajectory passes through the new position. t0 and the motion
parameters are kept, so catalog velocities still apply; a Fixed star is
unchanged.

MotionModel gets min_epochs, the fewest epochs before the model is
chosen (None means n_params), read through required_epochs(). Parallax
sets it to 4, as mm_rework did: 3 epochs in one season cannot separate
parallax from proper motion. Only model selection in
StarTable.fit_motion_models uses it.

OB150211 pass 1 with the notebook settings: stars detected in >= 6 of
12 epochs go from 4-9 on dev to 201-204 (mm_rework: 170-192).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MosaicSelfRef, MosaicToRef and StarTable.fit_motion_models take
min_epochs, a dict keyed by model name (e.g. {'Parallax': 3}), that sets
the fewest epochs before a model is chosen for that run only. The class
attribute stays as the default (4 for Parallax, n_params otherwise).
Unknown names and values below n_params raise. The aligners pass it to
every motion fit, including the bootstrap, and write it to the params log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wei-lingfeng
wei-lingfeng force-pushed the hold-ref-within-iteration branch from 6e2e6ee to bfdc155 Compare December 3, 2026 00:31
wei-lingfeng and others added 2 commits December 2, 2026 16:35
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the second iteration on, stars already in the reference keep their
fit from the previous iteration while the starlists are matched, and all
stars are refit once, after the last list. Before, each star was refit
after every list from only the epochs matched so far in that iteration
(one epoch, then two close in time), and the next list was matched
against those poorly constrained fits. Stars added during an iteration
are still fit as their lists come in, and the first iteration is
unchanged. update_ref_orig='periter' already held catalog stars this
way; this extends it to stars added from the starlists.

On the test-suite datasets (every star in the reference) results are
identical. With clustered epochs, 1 mas noise, and a 15-star reference,
position and velocity errors against the truth are 36% smaller on all
10 seeds; star-to-star precision is unchanged. fit() is 6-17% faster on
OB150211.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wei-lingfeng
wei-lingfeng force-pushed the hold-ref-within-iteration branch from bfdc155 to feb9ddb Compare December 3, 2026 00:37

This branch has not been deployed

No deployments
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.

1 participant