Skip to content

Commit

Permalink
Rename calibrationsCatalog->visitSummary for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Jul 13, 2023
1 parent dc481ef commit b1373c9
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions python/lsst/ip/diffim/subtractImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@ def __init__(self, **kwargs):
self.convolutionControl.setDoNormalize(False)
self.convolutionControl.setDoCopyEdge(True)

def _applyExternalCalibrations(self, exposure, calibrationsCatalog):
def _applyExternalCalibrations(self, exposure, visitSummary):
"""Replace calibrations (psf, and ApCorrMap) on this exposure with
external ones.".
Parameters
----------
exposure : `lsst.afw.image.exposure.Exposure`
Input exposure to adjust calibrations.
calibrationsCatalog : `lsst.afw.table.ExposureCatalog`
visitSummary : `lsst.afw.table.ExposureCatalog`
Exposure catalog with external calibrations to be applied. Catalog
uses the detector id for the catalog id, sorted on id for fast
lookup.
Expand All @@ -263,7 +263,7 @@ def _applyExternalCalibrations(self, exposure, calibrationsCatalog):
"""
detectorId = exposure.info.getDetector().getId()

row = calibrationsCatalog.find(detectorId)
row = visitSummary.find(detectorId)
if row is None:
self.log.warning("Detector id %s not found in external calibrations catalog; "
"Using original calibrations.", detectorId)
Expand All @@ -286,7 +286,7 @@ def _applyExternalCalibrations(self, exposure, calibrationsCatalog):

@timeMethod
def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,
calibrationsCatalog=None):
visitSummary=None):
"""PSF match, subtract, and decorrelate two images.
Parameters
Expand All @@ -303,8 +303,8 @@ def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,
Exposure catalog with finalized psf models and aperture correction
maps to be applied. Catalog uses the detector id for the catalog
id, sorted on id for fast lookup. Deprecated in favor of
``calibrationsCatalog``, and will be removed after v27.
calibrationsCatalog : `lsst.afw.table.ExposureCatalog`, optional
``visitSummary``, and will be removed after v26.
visitSummary : `lsst.afw.table.ExposureCatalog`, optional
Exposure catalog with external calibrations to be applied. Catalog
uses the detector id for the catalog id, sorted on id for fast
lookup. Ignored (for temporary backwards compatibility) if
Expand Down Expand Up @@ -336,14 +336,14 @@ def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,

if finalizedPsfApCorrCatalog is not None:
warnings.warn(
"The finalizedPsfApCorrCatalog argument is deprecated in favor of the calibrationsCatalog "
"argument, and will be removed after v27.",
"The finalizedPsfApCorrCatalog argument is deprecated in favor of the visitSummary "
"argument, and will be removed after v26.",
FutureWarning,
stacklevel=find_outside_stacklevel("lsst.ip.diffim"),
)
calibrationsCatalog = finalizedPsfApCorrCatalog
visitSummary = finalizedPsfApCorrCatalog

self._prepareInputs(template, science, calibrationsCatalog=calibrationsCatalog)
self._prepareInputs(template, science, visitSummary=visitSummary)

# In the event that getPsfFwhm fails, evaluate the PSF on a grid.
fwhmExposureBuffer = self.config.makeKernel.fwhmExposureBuffer
Expand Down Expand Up @@ -720,7 +720,7 @@ def _checkMask(mask, sources, badMaskPlanes):
flags = np.bitwise_and(mv, badPixelMask) == 0
return flags

def _prepareInputs(self, template, science, calibrationsCatalog=None):
def _prepareInputs(self, template, science, visitSummary=None):
"""Perform preparatory calculations common to all Alard&Lupton Tasks.
Parameters
Expand All @@ -731,14 +731,14 @@ def _prepareInputs(self, template, science, calibrationsCatalog=None):
science : `lsst.afw.image.ExposureF`
Science exposure to subtract from the template. The variance plane
of the science image is modified in place.
calibrationsCatalog : `lsst.afw.table.ExposureCatalog`, optional
visitSummary : `lsst.afw.table.ExposureCatalog`, optional
Exposure catalog with external calibrations to be applied. Catalog
uses the detector id for the catalog id, sorted on id for fast
lookup.
"""
self._validateExposures(template, science)
if calibrationsCatalog is not None:
self._applyExternalCalibrations(science, calibrationsCatalog=calibrationsCatalog)
if visitSummary is not None:
self._applyExternalCalibrations(science, visitSummary=visitSummary)
checkTemplateIsSufficient(template, self.log,
requiredTemplateFraction=self.config.requiredTemplateFraction)

Expand Down Expand Up @@ -789,8 +789,7 @@ class AlardLuptonPreconvolveSubtractTask(AlardLuptonSubtractTask):
ConfigClass = AlardLuptonPreconvolveSubtractConfig
_DefaultName = "alardLuptonPreconvolveSubtract"

def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,
calibrationsCatalog=None):
def run(self, template, science, sources, finalizedPsfApCorrCatalog=None, visitSummary=None):
"""Preconvolve the science image with its own PSF,
convolve the template image with a PSF-matching kernel and subtract
from the preconvolved science image.
Expand All @@ -811,8 +810,8 @@ def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,
Exposure catalog with finalized psf models and aperture correction
maps to be applied. Catalog uses the detector id for the catalog
id, sorted on id for fast lookup. Deprecated in favor of
``calibrationsCatalog``, and will be removed after v27.
calibrationsCatalog : `lsst.afw.table.ExposureCatalog`, optional
``visitSummary``, and will be removed after v27.
visitSummary : `lsst.afw.table.ExposureCatalog`, optional
Exposure catalog with complete external calibrations. Catalog uses
the detector id for the catalog id, sorted on id for fast lookup.
Ignored (for temporary backwards compatibility) if
Expand All @@ -839,14 +838,14 @@ def run(self, template, science, sources, finalizedPsfApCorrCatalog=None,
"""
if finalizedPsfApCorrCatalog is not None:
warnings.warn(
"The finalizedPsfApCorrCatalog argument is deprecated in favor of the calibrationsCatalog "
"The finalizedPsfApCorrCatalog argument is deprecated in favor of the visitSummary "
"argument, and will be removed after v27.",
FutureWarning,
stacklevel=find_outside_stacklevel("lsst.ip.diffim"),
)
calibrationsCatalog = finalizedPsfApCorrCatalog
visitSummary = finalizedPsfApCorrCatalog

self._prepareInputs(template, science, calibrationsCatalog=calibrationsCatalog)
self._prepareInputs(template, science, visitSummary=visitSummary)

# TODO: DM-37212 we need to mirror the kernel in order to get correct cross correlation
scienceKernel = science.psf.getKernel()
Expand Down

0 comments on commit b1373c9

Please sign in to comment.