diff --git a/python/lsst/pipe/tasks/extended_psf.py b/python/lsst/pipe/tasks/extended_psf.py index 420809b6f..d9c4369f7 100644 --- a/python/lsst/pipe/tasks/extended_psf.py +++ b/python/lsst/pipe/tasks/extended_psf.py @@ -554,10 +554,15 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs): "No detector groups were provided to MeasureExtendedPsfTask; computing a single, " "constant extended PSF model over all available observations." ) + self.metadata["psfStarCount"] = 0 + for brightStarStamps in bss_ref_list: + stamps = brightStarStamps.get() + self.metadata["psfStarCount"] += len(stamps) output_e_psf = ExtendedPsf(self.stack_bright_stars.run(bss_ref_list)) else: output_e_psf = ExtendedPsf() region_ref_list = self.select_detector_refs(bss_ref_list) + self.metadata["psfStarCount"] = {} for region_name, ref_list in region_ref_list.items(): if not ref_list: # no valid references found @@ -566,6 +571,10 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs): region_name, ) continue + self.metadata["psfStarCount"][region_name] = 0 + for brightStarStamps in ref_list: + stamps = brightStarStamps.get() + self.metadata["psfStarCount"][region_name] += len(stamps) ext_psf = self.stack_bright_stars.run(ref_list, region_name) output_e_psf.add_regional_extended_psf( ext_psf, region_name, self.detectors_focal_plane_regions[region_name] diff --git a/python/lsst/pipe/tasks/processBrightStars.py b/python/lsst/pipe/tasks/processBrightStars.py index d7b48736b..88d06f071 100644 --- a/python/lsst/pipe/tasks/processBrightStars.py +++ b/python/lsst/pipe/tasks/processBrightStars.py @@ -287,6 +287,8 @@ def run(self, inputExposure, refObjLoader=None, dataId=None, skyCorr=None): badMaskPlanes=self.config.badMaskPlanes, discardNanFluxObjects=(self.config.discardNanFluxStars), ) + # Store the count number of valid stars that overlap the exposure. + self.metadata["validStarCount"] = len(brightStarStamps) # Do not create empty FITS files if there aren't any normalized stamps. if not brightStarStamps._stamps: self.log.info("No normalized stamps exist for this exposure.") @@ -402,6 +404,12 @@ def extractStamps( refCatBright.remove_rows(badRows) gMags = list(refCatBright["mag"][:]) ids = list(refCatBright["id"][:]) + + # Store the count number of all stars (within the given magnitude + # range) that overlap the exposure. + # TODO: Make sure self._getCutout only misses stars that don't have any + # valid pixel overlapped with the exposure. + self.metadata["allStarCount"] = len(starStamps) return Struct(starStamps=starStamps, pixCenters=pixCenters, gMags=gMags, gaiaIds=ids) def _getCutout(self, inputExposure, coordPix: Point2D, stampSize: list[int]):