From 2c35237bf76856499ca17fb0fa76d134e15d23e5 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Wed, 3 Dec 2025 21:32:34 -0500 Subject: [PATCH 1/3] Demote log level of skipped visits to DEBUG level --- python/lsst/drp/tasks/assemble_cell_coadd.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/lsst/drp/tasks/assemble_cell_coadd.py b/python/lsst/drp/tasks/assemble_cell_coadd.py index 0653712c..49a0dff4 100644 --- a/python/lsst/drp/tasks/assemble_cell_coadd.py +++ b/python/lsst/drp/tasks/assemble_cell_coadd.py @@ -692,8 +692,7 @@ def run( overlap_fraction = (detector_map[inner_bbox].array == ccd_row["ccd"]).mean() assert -1e-4 < overlap_fraction < 1.0001, "Overlap fraction is not within [0, 1]." if (overlap_fraction < self.config.min_overlap_fraction) or (overlap_fraction <= 0.0): - self.log.log( - self.log.DEBUG if overlap_fraction == 0.0 else self.log.INFO, + self.log.debug( "Skipping %s in cell %s because it had only %.3f < %.3f fractional overlap.", warp_input.dataId, cellInfo.index, From 9e9e54840273926018076d268e080af3393515b7 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Wed, 3 Dec 2025 20:25:44 -0500 Subject: [PATCH 2/3] Suppress the bug due to out-of-scope variable --- python/lsst/drp/tasks/assemble_cell_coadd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/lsst/drp/tasks/assemble_cell_coadd.py b/python/lsst/drp/tasks/assemble_cell_coadd.py index 49a0dff4..35b95ff9 100644 --- a/python/lsst/drp/tasks/assemble_cell_coadd.py +++ b/python/lsst/drp/tasks/assemble_cell_coadd.py @@ -750,7 +750,11 @@ def run( psf_shape_flag = True psf_eval_point = None try: - if overlap_fraction < 1.0: + # The `if` branch is buggy. `dest_polygon` is technically + # out of scope, but Python does not raise an error. + # TODO: Fix this properly in DM-53479, but sweep it under + # the rug for now. + if overlap_fraction < 0.5: psf_eval_point = dest_polygon.intersectionSingle( geom.Box2D(inner_bbox) ).calculateCenter() From 38be31f871e6817784fdc1de4b69e586abdad6a8 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Wed, 3 Dec 2025 21:29:44 -0500 Subject: [PATCH 3/3] Set iNEXACT_PSF mask bits --- python/lsst/drp/tasks/assemble_cell_coadd.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/lsst/drp/tasks/assemble_cell_coadd.py b/python/lsst/drp/tasks/assemble_cell_coadd.py index 35b95ff9..590b49f1 100644 --- a/python/lsst/drp/tasks/assemble_cell_coadd.py +++ b/python/lsst/drp/tasks/assemble_cell_coadd.py @@ -623,6 +623,11 @@ def run( ) removeMaskPlanes(warp.mask, self.config.remove_mask_planes, self.log) + # Instead of using self.config.bad_mask_planes, we explicitly + # ask statsCtrl which pixels are going to be ignored/rejected. + rejected = afwImage.Mask.getPlaneBitMask( + ["CLIPPED", "REJECTED"] + afwImage.Mask.interpret(statsCtrl.getAndMask()).split(",") + ) # Compute the weight for each CCD in the warp from the visitSummary # or from the warp itself, if not provided. Computing the weight @@ -887,6 +892,11 @@ def run( with np.errstate(invalid="ignore"): varArray[:] = np.where(varArray > 0, varArray, np.inf) + afwImage.Mask.addMaskPlane("INEXACT_PSF") + cell_masked_image.mask.array[ + (cell_masked_image.mask.array & rejected) > 0 + ] |= cell_masked_image.mask.getPlaneBitMask("INEXACT_PSF") + image_planes = OwnedImagePlanes.from_masked_image( masked_image=cell_masked_image, mask_fractions=cell_maskfrac_image,