From a17413aca0e33256933c3f650aff57eb618a98ac Mon Sep 17 00:00:00 2001 From: Eli Rykoff Date: Thu, 5 Oct 2023 13:29:51 -0700 Subject: [PATCH] Split out computation of number of psf stars from those used for stats. --- .../pipe/tasks/computeExposureSummaryStats.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/python/lsst/pipe/tasks/computeExposureSummaryStats.py b/python/lsst/pipe/tasks/computeExposureSummaryStats.py index 631bf1ed8e..faab5ceef4 100644 --- a/python/lsst/pipe/tasks/computeExposureSummaryStats.py +++ b/python/lsst/pipe/tasks/computeExposureSummaryStats.py @@ -56,15 +56,13 @@ class ComputeExposureSummaryStatsConfig(pexConfig.Config): default=("NO_DATA", "SUSPECT"), ) starSelection = pexConfig.Field( - doc="Field to select sources to be used in the PSF statistics computation.", + doc="Field to select full list of sources used for PSF modeling.", dtype=str, default="calib_psf_used", - deprecated="This field is deprecated and will be removed after v27. " - "Please use starSelector instead.", ) starSelector = pexConfig.ConfigurableField( target=ScienceSourceSelectorTask, - doc="Selection of sources to compute star statistics.", + doc="Selection of sources to compute PSF star statistics.", ) starShape = pexConfig.Field( doc="Base name of columns to use for the source shape in the PSF statistics computation.", @@ -276,11 +274,14 @@ def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, so # good sources). return - selected = self.starSelector.run(sources) - psf_mask = selected.selected - nPsfStar = psf_mask.sum() + # Count the number of raw psf stars + nPsfStar = sources[self.config.starSelection].sum() + summary.nPsfStar = int(nPsfStar) + + psf_mask = self.starSelector.run(sources).selected + nPsfStarCut = psf_mask.sum() - if nPsfStar == 0: + if nPsfStarCut == 0: # No stars to measure statistics, so we must return the defaults # of 0 stars and NaN values. return @@ -318,7 +319,6 @@ def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, so psfStarDeltaSizeScatter = sigmaMad(starSize - psfSize, scale='normal') psfStarScaledDeltaSizeScatter = psfStarDeltaSizeScatter/starSizeMedian - summary.nPsfStar = int(nPsfStar) summary.psfStarDeltaE1Median = float(psfStarDeltaE1Median) summary.psfStarDeltaE2Median = float(psfStarDeltaE2Median) summary.psfStarDeltaE1Scatter = float(psfStarDeltaE1Scatter)