Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions python/lsst/drp/tasks/assemble_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,12 @@ def prepareInputs(self, refList, coadd_bbox, psfMatchedWarpRefList=None):
maskedImage.getVariance(), maskedImage.getMask(), afwMath.MEANCLIP, statsCtrl
)
meanVar, meanVarErr = statObj.getResult(afwMath.MEANCLIP)
weight = 1.0 / float(meanVar)
if not numpy.isfinite(weight):
if meanVar > 0.0 and numpy.isfinite(meanVar):
weight = 1.0 / float(meanVar)
self.log.info("Weight of %s %s = %0.3f", warpName, warpRef.dataId, weight)
else:
self.log.warning("Non-finite weight for %s: skipping", warpRef.dataId)
continue
self.log.info("Weight of %s %s = %0.3f", warpName, warpRef.dataId, weight)

del maskedImage
del warp
Expand Down Expand Up @@ -1649,6 +1650,11 @@ def run(
# Check and match the order of the supplementaryData
# (PSF-matched) inputs to the order of the direct inputs,
# so that the artifact mask is applied to the right warp

# For any missing psfMatched warp refs replaced with None,
# findArtifacts() will produce a NO_DATA mask covering the entire bbox.
# As long as NO_DATA is in self.config.badMaskPlanes, these direct
# warps with missing psfMatched warps will not contribute to the coadd.
dataIds = [ref.dataId for ref in warpRefList]
psfMatchedDataIds = [ref.dataId for ref in supplementaryData.warpRefList]

Expand Down
12 changes: 9 additions & 3 deletions python/lsst/drp/tasks/make_direct_warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,14 +807,20 @@ def _apply_all_calibrations(
return False

if self.config.useVisitSummaryPhotoCalib:
if photo_calib := row.getPhotoCalib():
input_exposure.setPhotoCalib(photo_calib)
else:
photo_calib = row.getPhotoCalib()
if photo_calib is None:
self.log.info(
"No photometric calibration found in visit summary for detector = %s. Skipping it.",
detector,
)
return False
elif not np.isfinite(photo_calib.getInstFluxAtZeroMagnitude()):
self.log.info(
f"Invalid PhotoCalib found in visit summary for detector {detector}. Skipping it.",
)
return False
else:
input_exposure.setPhotoCalib(photo_calib)

if self.config.useVisitSummaryWcs:
if wcs := row.getWcs():
Expand Down