From 144923e4eae5cff32da3e5dd02e7c1d5a75bccb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agn=C3=A8s=20Fert=C3=A9?= Date: Wed, 28 May 2025 17:28:33 -0700 Subject: [PATCH] Add log and change saturation height threshold for saturation sag masking. --- python/lsst/ip/isr/isrFunctions.py | 13 +++++++++---- python/lsst/ip/isr/isrTaskLSST.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/python/lsst/ip/isr/isrFunctions.py b/python/lsst/ip/isr/isrFunctions.py index 206020f2..c292a6c9 100644 --- a/python/lsst/ip/isr/isrFunctions.py +++ b/python/lsst/ip/isr/isrFunctions.py @@ -517,7 +517,7 @@ def _applyMaskITLEdgeBleed(ccdExposure, xCore, sliceMask[y, lowerRange:upperRange] |= saturatedBit -def maskITLSatSag(ccdExposure, fpCore, saturatedMaskName="SAT"): +def maskITLSatSag(ccdExposure, fpCore, saturatedMaskName="SAT", log=None): """Mask columns presenting saturation sag in saturated footprints in ITL detectors. @@ -529,7 +529,10 @@ def maskITLSatSag(ccdExposure, fpCore, saturatedMaskName="SAT"): Footprint of saturated core. saturatedMaskName : `str`, optional Mask name for saturation. + log : `logging.Logger`, optional + Logger to handle messages. """ + log = log if log else logging.getLogger(__name__) # TODO DM-49736: add a flux level check to apply masking @@ -537,12 +540,14 @@ def maskITLSatSag(ccdExposure, fpCore, saturatedMaskName="SAT"): saturatedBit = maskedImage.mask.getPlaneBitMask(saturatedMaskName) cc = numpy.sum(fpCore.getSpans().asArray(), axis=0) - # Mask full columns that have 20 percent of the height of the footprint + # Mask full columns that have 30 percent of the height of the footprint # saturated - columnsToMaskFP = numpy.where(cc > fpCore.getSpans().asArray().shape[0]/5.) + columnsToMaskFP = numpy.where(cc > fpCore.getSpans().asArray().shape[0]*0.3) columnsToMask = [x + int(fpCore.getBBox().getMinX()) for x in columnsToMaskFP] - maskedImage.mask.array[:, columnsToMask] |= saturatedBit + + log.info("Masking %d columns for saturation sag masking.", len(columnsToMask[0])) + maskedImage.mask.array[:, columnsToMask[0]] |= saturatedBit def maskITLDip(exposure, detectorConfig, maskPlaneNames=["SUSPECT", "ITL_DIP"], log=None): diff --git a/python/lsst/ip/isr/isrTaskLSST.py b/python/lsst/ip/isr/isrTaskLSST.py index 512e9509..722a1c4f 100644 --- a/python/lsst/ip/isr/isrTaskLSST.py +++ b/python/lsst/ip/isr/isrTaskLSST.py @@ -1073,7 +1073,7 @@ def maskITLSatEdgesAndColumns(self, exposure, badAmpDict): ) if self.config.doITLSatSagMask: isrFunctions.maskITLSatSag(ccdExposure=exposure, fpCore=fpCore, - saturatedMaskName=self.config.saturatedMaskName) + saturatedMaskName=self.config.saturatedMaskName, log=self.log) def overscanCorrection(self, mode, detectorConfig, detector, badAmpDict, ccdExposure): """Apply serial overscan correction in place to all amps.