Skip to content

Commit

Permalink
Split out computation of number of psf stars from those used for stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Nov 7, 2023
1 parent 4b1989f commit a17413a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python/lsst/pipe/tasks/computeExposureSummaryStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a17413a

Please sign in to comment.