Repository navigation
Make chi2 matching the default everywhere - #34
Merged
Merged
Conversation
The legacy rule matched a star with several candidates only if its nearest candidate in position was also its nearest in magnitude. In crowded fields that discards good matches, and each discarded star becomes a duplicate reference row. 'chi2' is now the default in MosaicSelfRef, MosaicToRef, match.match, match.match_name_override, transform_and_match and generic_match; the last two now take matching, dchi2_tol and the chi^2 scales. 'legacy' stays available. test_match_duplicates and test_generic_match now check both rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
matching='chi2'(added in f40cc18) is now the default inMosaicSelfRef,MosaicToRef,match.match,match.match_name_override,transform_and_matchandgeneric_match. The last two now takematching,dchi2_toland the chi^2 scales, which they previously had no way to set.With
'legacy', a star with several candidates inside the tolerances is matched only if its nearest candidate in position is also its nearest in magnitude. In crowded fields that discards good matches -- a candidate 20x closer in position loses to one a few hundredths of a magnitude nearer -- and each discarded star becomes a duplicate reference row that makes the next starlist ambiguous in turn.'chi2'keeps the reciprocal best pair by chi^2 if it wins bydchi2_tol(default 9, a 3-sigma margin), and leaves truly ambiguous stars unmatched.Behavior change:
'chi2'is more conservative when two candidates are both plausible. Intest_generic_match, two stars 1.8 px apart lie 0.61 and 1.17 px from one counterpart;'legacy'picks the nearer (also 0.04 mag nearer), while'chi2'leaves it unmatched (chi^2 margin about 6). Withdm_tol=None, chi2 uses position only, and with few stars its position scale falls back todr_tol/10.matching='legacy'reproduces earlier results.test_match_duplicatesandtest_generic_matchnow check both rules. All 135 tests pass. Docs (alignment.rst) andCHANGES.rstare updated.A before/after comparison on real data will follow.