Skip to content

Conversation

@mrawls
Copy link
Contributor

@mrawls mrawls commented Jul 1, 2025

This PR fixes the bug as reported, but does not fix the underlying issue of why the PSF cannot be evaluated at the average position for this image. I looked at the visit (detector=150, visit=2025060400401) that caused the failure on RubinTV and didn't see anything obviously wrong or unusual.

@mrawls mrawls requested a review from isullivan July 1, 2025 06:26
@mrawls mrawls changed the title DM-51635: LSSTCam DRP error in subtractImages with undefined magnum DM-51635: LSSTCam DRP error in subtractImages with undefined maglim Jul 1, 2025
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.

Approved, but please see my comment to help prevent this from happening again in the future.

try:
psf = exposure.getPsf()
psf_shape = psf.computeShape(psf.getAveragePosition())
except (lsst.pex.exceptions.InvalidParameterError, afwDetection.InvalidPsfError):
Copy link
Contributor

Choose a reason for hiding this comment

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

Any exception that is not in this list will raise an error in the finally step, since maglim won't be defined. I think this would be a good place to use except Exception as e to catch any exception, and print the error message in the log. Alternately, you could define maglim = np.nan before the try block to guarantee that it is defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks - I like the idea to just set it to nan upfront so we at least wind up with something.

@mrawls mrawls force-pushed the tickets/DM-51635 branch from 2077b97 to 89b128d Compare July 2, 2025 01:50
@mrawls mrawls merged commit 5e1b9f9 into main Jul 2, 2025
5 checks passed
@mrawls mrawls deleted the tickets/DM-51635 branch July 2, 2025 03:55
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.

2 participants