Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-43042: Fix indexing bug in _match_psf_stars #896

Merged
merged 1 commit into from Feb 27, 2024
Merged

Conversation

parejkoj
Copy link
Contributor

No description provided.

Copy link
Contributor

@isullivan isullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please consider simplifying the line that sets ids by splitting it to two lines.

python/lsst/pipe/tasks/calibrateImage.py Outdated Show resolved Hide resolved
matches = list(best.values())
ids = np.array([(match0.getId(), match1.getId()) for match0, match1, d in matches]).T
# We'll use this to construct index arrays into each catalog.
ids = np.array([(match_psf.getId(), match_stars.getId()) for match_psf, match_stars, d in matches]).T
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks overly complicated, especially since you use ids[0] and ids[1] separately. Could this just be:
psf_ids = matches[0].getId()
star_ids = matches[1].getId()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, no. matches is a list of tuples, and it's a pain to work with. This has always been a difficulty with the 2014-era matchXy API.

I agree it's complicated, but this is the only way I know of to do this without iterating through the match list twice.

Improve test to catch the bug.
Rename variables in the method to make the components more obvious.
@parejkoj parejkoj merged commit 1d60b36 into main Feb 27, 2024
2 checks passed
@parejkoj parejkoj deleted the tickets/DM-43042 branch February 27, 2024 22:48
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.

None yet

2 participants