Skip to content

Commit

Permalink
Merge pull request #928 from lsst/tickets/DM-44246
Browse files Browse the repository at this point in the history
DM-44246: Use full set of src footprints for noise replacement in FinalizeCharacterizationTask.
  • Loading branch information
erykoff committed May 8, 2024
2 parents bcc14b6 + d9560dc commit cc4507d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions python/lsst/pipe/tasks/calibrateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ def setDefaults(self):
self.install_simple_psf.fwhm = 4

# S/N>=50 sources for PSF determination, but detection to S/N=5.
# The thresholdValue sets the minimum flux in a pixel to be included in the
# footprint, while peaks are only detected when they are above
# thresholdValue * includeThresholdMultiplier. The low thresholdValue
# ensures that the footprints are large enough for the noise replacer
# to mask out faint undetected neighbors that are not to be measured.
self.psf_detection.thresholdValue = 5.0
self.psf_detection.includeThresholdMultiplier = 10.0
# TODO investigation: Probably want False here, but that may require
Expand Down
8 changes: 6 additions & 2 deletions python/lsst/pipe/tasks/characterizeImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ class CharacterizeImageConfig(pipeBase.PipelineTaskConfig,

def setDefaults(self):
super().setDefaults()
# just detect bright stars; includeThresholdMultipler=10 seems large,
# but these are the values we have been using
# Just detect bright stars.
# The thresholdValue sets the minimum flux in a pixel to be included in the
# footprint, while peaks are only detected when they are above
# thresholdValue * includeThresholdMultiplier. The low thresholdValue
# ensures that the footprints are large enough for the noise replacer
# to mask out faint undetected neighbors that are not to be measured.
self.detection.thresholdValue = 5.0
self.detection.includeThresholdMultiplier = 10.0
# do not deblend, as it makes a mess
Expand Down
6 changes: 5 additions & 1 deletion python/lsst/pipe/tasks/finalizeCharacterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ def compute_psf_and_ap_corr_map(self, visit, detector, exposure, src, isolated_s
measured_src : `lsst.afw.table.SourceCatalog`
Updated source catalog with measurements, flags and aperture corrections.
"""
# Extract footprints from the input src catalog for noise replacement.
footprints = SingleFrameMeasurementTask.getFootprintsFromCatalog(src)

# Apply source selector (s/n, flags, etc.)
good_src = self.source_selector.selectSources(src)
if sum(good_src.selected) == 0:
Expand Down Expand Up @@ -699,8 +702,9 @@ def compute_psf_and_ap_corr_map(self, visit, detector, exposure, src, isolated_s
measured_src['calib_psf_used'] = measured_used

# Next, we do the measurement on all the psf candidate, used, and reserved stars.
# We use the full footprint list from the input src catalog for noise replacement.
try:
self.measurement.run(measCat=measured_src, exposure=exposure)
self.measurement.run(measCat=measured_src, exposure=exposure, footprints=footprints)
except Exception as e:
self.log.warning('Failed to make measurements for visit %d, detector %d: %s',
visit, detector, e)
Expand Down

0 comments on commit cc4507d

Please sign in to comment.