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-38751: Allow MeasureApCorrTask to fail and filter when making warps. #774

Merged
merged 2 commits into from Apr 20, 2023

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Apr 19, 2023

No description provided.

# downstream.
dmeRes.exposure.info.setApCorrMap(None)

if apCorrSuccess:
Copy link
Member

Choose a reason for hiding this comment

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

You've discovered the exact reason try/else exists, and this is possibly the best opportunity you'll ever have to use it!

            try:
                apCorrMap = self.measureApCorr.run(
                    exposure=dmeRes.exposure,
                    catalog=dmeRes.sourceCat,
                ).apCorrMap
            except MeasureApCorrError:
                # We have failed to get a valid aperture correction map.
                # Proceed with processing, and image will be filtered
                # downstream.
                dmeRes.exposure.info.setApCorrMap(None)
            else:
                dmeRes.exposure.info.setApCorrMap(apCorrMap)
                self.applyApCorr.run(catalog=dmeRes.sourceCat, apCorrMap=exposure.getInfo().getApCorrMap())

No apCorrSuccess variable necessary!

But feel free to ignore this suggestion if you find the original more readable; just know that by doing so you'd practically be declaring that try/else shouldn't exist in Python.

@erykoff erykoff force-pushed the tickets/DM-38751 branch 2 times, most recently from 45d3907 to bff1f38 Compare April 19, 2023 19:27
@erykoff erykoff merged commit b62d540 into main Apr 20, 2023
1 check passed
@erykoff erykoff deleted the tickets/DM-38751 branch April 20, 2023 22:56
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