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-46942: Raise UpstreamFailureNoWorkFound in ReprocessVisitImageTask when detector is missing a necessary calibration #77

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

laurenam
Copy link
Contributor

No description provided.

if detector_summary.apCorrMap is None:
msg += "\n > the aperture correction model map for the detector is None"
if detector_summary.photoCalib is None:
msg += "\n > the photometric calibration model for the detector is None"
Copy link
Member

Choose a reason for hiding this comment

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

It's not a big deal here, but when composing multi-line strings programmatically, it's usually better to append to a list of lines and use "\n".join(lines)" to stitch them together.

The main advantage is memory allocation efficiency, which only comes into play when there is a very large number of lines, but I think that makes it good practice for consistency everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Always love a good best-practice coding tip from you 😄

msg += "\n > the aperture correction model map for the detector is None"
if detector_summary.photoCalib is None:
msg += "\n > the photometric calibration model for the detector is None"
if len(msg) > 0:
Copy link
Member

Choose a reason for hiding this comment

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

if msg: is generally better (or if lines:, per the thread above).

self.butler.put(lsst.afw.table.SourceCatalog().asAstropy(), "finalized_src_table", self.visit_only_id)
self.butler.put(make_visit_summary(detector=detector), "finalVisitSummary", self.visit_only_id)
# Make a simple single gaussian psf so that psf is not None in
# finalVisitSummary table whcih would result in
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# finalVisitSummary table whcih would result in
# finalVisitSummary table which would result in

If any of the relevant single frame calibrations are missing from the
final visit summary table, a "calibrated" image cannot be created, so
catch these and raise UpstreamFailureNoWorkFound so that we know there
was a failure upstream, but that downstream tasks know to skip this
dataId.
@laurenam laurenam merged commit 6f403cd into main Oct 18, 2024
3 checks passed
@laurenam laurenam deleted the tickets/DM-46942 branch October 18, 2024 21:24
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