lsst.pipe.tasks  17.0.1-12-g26466192+3
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask Class Reference
Inheritance diagram for lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask:
lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask lsst.pipe.tasks.coaddBase.CoaddBaseTask

Public Member Functions

def runDataRef (self, dataRef, selectDataList=None, warpRefList=None)
 
def prepareDcrInputs (self, templateCoadd, tempExpRefList, weightList)
 
def run (self, skyInfo, tempExpRefList, imageScalerList, weightList, supplementaryData=None)
 
def calculateNImage (self, dcrModels, bbox, tempExpRefList, spanSetMaskList, statsCtrl)
 
def dcrAssembleSubregion (self, dcrModels, subExposures, bbox, dcrBBox, tempExpRefList, statsCtrl, convergenceMetric, baseMask, gain, modelWeights, refImage, dcrWeights)
 
def dcrResiduals (self, residual, visitInfo, wcs, filterInfo)
 
def newModelFromResidual (self, dcrModels, residualGeneratorList, dcrBBox, statsCtrl, mask, gain, modelWeights, refImage, dcrWeights)
 
def calculateConvergence (self, dcrModels, subExposures, bbox, tempExpRefList, weightList, statsCtrl)
 
def calculateSingleConvergence (self, dcrModels, exposure, significanceImage, statsCtrl)
 
def stackCoadd (self, dcrCoadds)
 
def fillCoadd (self, dcrModels, skyInfo, tempExpRefList, weightList, calibration=None, coaddInputs=None, mask=None, variance=None)
 
def calculateGain (self, convergenceList, gainList)
 
def calculateModelWeights (self, dcrModels, dcrBBox)
 
def applyModelWeights (self, modelImages, refImage, modelWeights)
 
def loadSubExposures (self, bbox, statsCtrl, tempExpRefList, imageScalerList, spanSetMaskList)
 
def makeSupplementaryDataGen3 (self, inputData, inputDataIds, outputDataIds, butler)
 
def makeSupplementaryData (self, dataRef, selectDataList=None, warpRefList=None)
 
def run (self, skyInfo, tempExpRefList, imageScalerList, weightList, supplementaryData, args, kwargs)
 
def applyAltEdgeMask (self, mask, altMaskList)
 
def findArtifacts (self, templateCoadd, tempExpRefList, imageScalerList)
 
def prefilterArtifacts (self, spanSetList, exp)
 
def filterArtifacts (self, spanSetList, epochCountImage, nImage, footprintsToExclude=None)
 
def getOutputDatasetTypes (cls, config)
 
def getInputDatasetTypes (cls, config)
 
def getPrerequisiteDatasetTypes (cls, config)
 
def adaptArgsAndRun (self, inputData, inputDataIds, outputDataIds, butler)
 
def processResults (self, coaddExposure, dataRef)
 
def getTempExpRefList (self, patchRef, calExpRefList)
 
def prepareInputs (self, refList)
 
def prepareStats (self, mask=None)
 
def assembleMetadata (self, coaddExposure, tempExpRefList, weightList)
 
def assembleSubregion (self, coaddExposure, bbox, tempExpRefList, imageScalerList, weightList, altMaskList, statsFlags, statsCtrl, nImage=None)
 
def removeMaskPlanes (self, maskedImage)
 
def applyAltMaskPlanes (self, mask, altMaskSpans)
 
def shrinkValidPolygons (self, coaddInputs)
 
def readBrightObjectMasks (self, dataRef)
 
def setBrightObjectMasks (self, exposure, dataId, brightObjectMasks)
 
def setInexactPsf (self, mask)
 
def selectExposures (self, patchRef, skyInfo=None, selectDataList=[])
 Select exposures to coadd. More...
 
def getSkyInfo (self, patchRef)
 Use getSkyinfo to return the skyMap, tract and patch information, wcs and the outer bbox of the patch. More...
 
def getCoaddDatasetName (self, warpType="direct")
 
def getTempExpDatasetName (self, warpType="direct")
 
def getBadPixelMask (self)
 Convenience method to provide the bitmask from the mask plane names. More...
 

Static Public Member Functions

def setRejectedMaskMapping (statsCtrl)
 

Public Attributes

 bufferSize
 
 brightObjectBitmask
 
 warpType
 

Static Public Attributes

 ConfigClass = DcrAssembleCoaddConfig
 
 RunnerClass = CoaddTaskRunner
 

Detailed Description

Assemble DCR coadded images from a set of warps.

Attributes
----------
bufferSize : `int`
    The number of pixels to grow each subregion by to allow for DCR.

Notes
-----
As with AssembleCoaddTask, we want to assemble a coadded image from a set of
Warps (also called coadded temporary exposures), including the effects of
Differential Chromatic Refraction (DCR).
For full details of the mathematics and algorithm, please see
DMTN-037: DCR-matched template generation (https://dmtn-037.lsst.io).

This Task produces a DCR-corrected deepCoadd, as well as a dcrCoadd for
each subfilter used in the iterative calculation.
It begins by dividing the bandpass-defining filter into N equal bandwidth
"subfilters", and divides the flux in each pixel from an initial coadd
equally into each as a "dcrModel". Because the airmass and parallactic
angle of each individual exposure is known, we can calculate the shift
relative to the center of the band in each subfilter due to DCR. For each
exposure we apply this shift as a linear transformation to the dcrModels
and stack the results to produce a DCR-matched exposure. The matched
exposures are subtracted from the input exposures to produce a set of
residual images, and these residuals are reverse shifted for each
exposures' subfilters and stacked. The shifted and stacked residuals are
added to the dcrModels to produce a new estimate of the flux in each pixel
within each subfilter. The dcrModels are solved for iteratively, which
continues until the solution from a new iteration improves by less than
a set percentage, or a maximum number of iterations is reached.
Two forms of regularization are employed to reduce unphysical results.
First, the new solution is averaged with the solution from the previous
iteration, which mitigates oscillating solutions where the model
overshoots with alternating very high and low values.
Second, a common degeneracy when the data have a limited range of airmass or
parallactic angle values is for one subfilter to be fit with very low or
negative values, while another subfilter is fit with very high values. This
typically appears in the form of holes next to sources in one subfilter,
and corresponding extended wings in another. Because each subfilter has
a narrow bandwidth we assume that physical sources that are above the noise
level will not vary in flux by more than a factor of `frequencyClampFactor`
between subfilters, and pixels that have flux deviations larger than that
factor will have the excess flux distributed evenly among all subfilters.

Definition at line 149 of file dcrAssembleCoadd.py.

Member Function Documentation

◆ adaptArgsAndRun()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.adaptArgsAndRun (   self,
  inputData,
  inputDataIds,
  outputDataIds,
  butler 
)
inherited
Assemble a coadd from a set of Warps.

PipelineTask (Gen3) entry point to Coadd a set of Warps.
Analogous to `runDataRef`, it prepares all the data products to be
passed to `run`, and processes the results before returning to struct
of results to be written out. AssembleCoadd cannot fit all Warps in memory.
Therefore, its inputs are accessed subregion by subregion
by the `lsst.daf.butler.ShimButler` that quacks like a Gen2
`lsst.daf.persistence.Butler`. Updates to this method should
correspond to an update in `runDataRef` while both entry points
are used.

Parameters
----------
inputData : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are input Python-domain data objects (or lists of objects)
    retrieved from data butler.
inputDataIds : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are DataIds (or lists of DataIds) that task consumes for
    corresponding dataset type.
outputDataIds : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are DataIds (or lists of DataIds) that task is to produce
    for corresponding dataset type.
butler : `lsst.daf.butler.Butler`
    Gen3 Butler object for fetching additional data products before
    running the Task

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

   - ``coaddExposure`` : coadded exposure (``lsst.afw.image.Exposure``)
   - ``nImage``: N Image (``lsst.afw.image.Image``)

Definition at line 387 of file assembleCoadd.py.

◆ applyAltEdgeMask()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.applyAltEdgeMask (   self,
  mask,
  altMaskList 
)
inherited
Propagate alt EDGE mask to SENSOR_EDGE AND INEXACT_PSF planes.

Parameters
----------
mask : `lsst.afw.image.Mask`
    Original mask.
altMaskList : `list`
    List of Dicts containing ``spanSet`` lists.
    Each element contains the new mask plane name (e.g. "CLIPPED
    and/or "NO_DATA") as the key, and list of ``SpanSets`` to apply to
    the mask.

Definition at line 2109 of file assembleCoadd.py.

◆ applyAltMaskPlanes()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.applyAltMaskPlanes (   self,
  mask,
  altMaskSpans 
)
inherited
Apply in place alt mask formatted as SpanSets to a mask.

Parameters
----------
mask : `lsst.afw.image.Mask`
    Original mask.
altMaskSpans : `dict`
    SpanSet lists to apply. Each element contains the new mask
    plane name (e.g. "CLIPPED and/or "NO_DATA") as the key,
    and list of SpanSets to apply to the mask.

Returns
-------
mask : `lsst.afw.image.Mask`
    Updated mask.

Definition at line 972 of file assembleCoadd.py.

◆ applyModelWeights()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.applyModelWeights (   self,
  modelImages,
  refImage,
  modelWeights 
)
Smoothly replace model pixel values with those from a
reference at locations away from detected sources.

Parameters
----------
modelImages : `list` of `lsst.afw.image.Image`
    The new DCR model images from the current iteration.
    The values will be modified in place.
refImage : `lsst.afw.image.MaskedImage`
    A reference image used to supply the default pixel values.
modelWeights : `numpy.ndarray` or `float`
    A 2D array of weight values that tapers smoothly to zero away from detected sources.
    Set to a placeholder value of 1.0 if ``self.config.useModelWeights`` is False.

Definition at line 946 of file dcrAssembleCoadd.py.

◆ assembleMetadata()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.assembleMetadata (   self,
  coaddExposure,
  tempExpRefList,
  weightList 
)
inherited
Set the metadata for the coadd.

This basic implementation sets the filter from the first input.

Parameters
----------
coaddExposure : `lsst.afw.image.Exposure`
    The target exposure for the coadd.
tempExpRefList : `list`
    List of data references to tempExp.
weightList : `list`
    List of weights.

Definition at line 802 of file assembleCoadd.py.

◆ assembleSubregion()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.assembleSubregion (   self,
  coaddExposure,
  bbox,
  tempExpRefList,
  imageScalerList,
  weightList,
  altMaskList,
  statsFlags,
  statsCtrl,
  nImage = None 
)
inherited
Assemble the coadd for a sub-region.

For each coaddTempExp, check for (and swap in) an alternative mask
if one is passed. Remove mask planes listed in
`config.removeMaskPlanes`. Finally, stack the actual exposures using
`lsst.afw.math.statisticsStack` with the statistic specified by
statsFlags. Typically, the statsFlag will be one of lsst.afw.math.MEAN for
a mean-stack or `lsst.afw.math.MEANCLIP` for outlier rejection using
an N-sigma clipped mean where N and iterations are specified by
statsCtrl.  Assign the stacked subregion back to the coadd.

Parameters
----------
coaddExposure : `lsst.afw.image.Exposure`
    The target exposure for the coadd.
bbox : `lsst.afw.geom.Box`
    Sub-region to coadd.
tempExpRefList : `list`
    List of data reference to tempExp.
imageScalerList : `list`
    List of image scalers.
weightList : `list`
    List of weights.
altMaskList : `list`
    List of alternate masks to use rather than those stored with
    tempExp, or None.  Each element is dict with keys = mask plane
    name to which to add the spans.
statsFlags : `lsst.afw.math.Property`
    Property object for statistic for coadd.
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd.
nImage : `lsst.afw.image.ImageU`, optional
    Keeps track of exposure count for each pixel.

Definition at line 859 of file assembleCoadd.py.

◆ calculateConvergence()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateConvergence (   self,
  dcrModels,
  subExposures,
  bbox,
  tempExpRefList,
  weightList,
  statsCtrl 
)
Calculate a quality of fit metric for the matched templates.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
subExposures : `dict` of `lsst.afw.image.ExposureF`
    The pre-loaded exposures for the current subregion.
bbox : `lsst.afw.geom.box.Box2I`
    Sub-region to coadd
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
weightList : `list` of `float`
    The weight to give each input exposure in the coadd
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd

Returns
-------
convergenceMetric : `float`
    Quality of fit metric for all input exposures, within the sub-region

Definition at line 678 of file dcrAssembleCoadd.py.

◆ calculateGain()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateGain (   self,
  convergenceList,
  gainList 
)
Calculate the gain to use for the current iteration.

After calculating a new DcrModel, each value is averaged with the
value in the corresponding pixel from the previous iteration. This
reduces oscillating solutions that iterative techniques are plagued by,
and speeds convergence. By far the biggest changes to the model
happen in the first couple iterations, so we can also use a more
aggressive gain later when the model is changing slowly.

Parameters
----------
convergenceList : `list` of `float`
    The quality of fit metric from each previous iteration.
gainList : `list` of `float`
    The gains used in each previous iteration: appended with the new
    gain value.
    Gains are numbers between ``self.config.baseGain`` and 1.

Returns
-------
gain : `float`
    Relative weight to give the new solution when updating the model.
    A value of 1.0 gives equal weight to both solutions.

Raises
------
ValueError
    If ``len(convergenceList) != len(gainList)+1``.

Definition at line 832 of file dcrAssembleCoadd.py.

◆ calculateModelWeights()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateModelWeights (   self,
  dcrModels,
  dcrBBox 
)
Build an array that smoothly tapers to 0 away from detected sources.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
dcrBBox : `lsst.afw.geom.box.Box2I`
    Sub-region of the coadd which includes a buffer to allow for DCR.

Returns
-------
weights : `numpy.ndarray` or `float`
    A 2D array of weight values that tapers smoothly to zero away from detected sources.
    Set to a placeholder value of 1.0 if ``self.config.useModelWeights`` is False.

Raises
------
ValueError
    If ``useModelWeights`` is set and ``modelWeightsWidth`` is negative.

Definition at line 913 of file dcrAssembleCoadd.py.

◆ calculateNImage()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateNImage (   self,
  dcrModels,
  bbox,
  tempExpRefList,
  spanSetMaskList,
  statsCtrl 
)
Calculate the number of exposures contributing to each subfilter.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
bbox : `lsst.afw.geom.box.Box2I`
    Bounding box of the patch to coadd.
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
spanSetMaskList : `list` of `dict` containing spanSet lists, or None
    Each element of the `dict` contains the new mask plane name
    (e.g. "CLIPPED and/or "NO_DATA") as the key,
    and the list of SpanSets to apply to the mask.
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd

Returns
-------
dcrNImages : `list` of `lsst.afw.image.ImageU`
    List of exposure count images for each subfilter
dcrWeights : `list` of `lsst.afw.image.ImageF`
    Per-pixel weights for each subfilter.
    Equal to 1/(number of unmasked images contributing to each pixel).

Definition at line 468 of file dcrAssembleCoadd.py.

◆ calculateSingleConvergence()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateSingleConvergence (   self,
  dcrModels,
  exposure,
  significanceImage,
  statsCtrl 
)
Calculate a quality of fit metric for a single matched template.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
exposure : `lsst.afw.image.ExposureF`
    The input warped exposure to evaluate.
significanceImage : `numpy.ndarray`
    Array of weights for each pixel corresponding to its significance
    for the convergence calculation.
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd

Returns
-------
convergenceMetric : `float`
    Quality of fit metric for one exposure, within the sub-region.

Definition at line 719 of file dcrAssembleCoadd.py.

◆ dcrAssembleSubregion()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.dcrAssembleSubregion (   self,
  dcrModels,
  subExposures,
  bbox,
  dcrBBox,
  tempExpRefList,
  statsCtrl,
  convergenceMetric,
  baseMask,
  gain,
  modelWeights,
  refImage,
  dcrWeights 
)
Assemble the DCR coadd for a sub-region.

Build a DCR-matched template for each input exposure, then shift the
residuals according to the DCR in each subfilter.
Stack the shifted residuals and apply them as a correction to the
solution from the previous iteration.
Restrict the new model solutions from varying by more than a factor of
`modelClampFactor` from the last solution, and additionally restrict the
individual subfilter models from varying by more than a factor of
`frequencyClampFactor` from their average.
Finally, mitigate potentially oscillating solutions by averaging the new
solution with the solution from the previous iteration, weighted by
their convergence metric.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
subExposures : `dict` of `lsst.afw.image.ExposureF`
    The pre-loaded exposures for the current subregion.
bbox : `lsst.afw.geom.box.Box2I`
    Bounding box of the subregion to coadd.
dcrBBox : `lsst.afw.geom.box.Box2I`
    Sub-region of the coadd which includes a buffer to allow for DCR.
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd
convergenceMetric : `float`
    Quality of fit metric for the matched templates of the input images.
baseMask : `lsst.afw.image.Mask`
    Mask of the initial template coadd.
gain : `float`, optional
    Relative weight to give the new solution when updating the model.
modelWeights : `numpy.ndarray` or `float`
    A 2D array of weight values that tapers smoothly to zero away from detected sources.
    Set to a placeholder value of 1.0 if ``self.config.useModelWeights`` is False.
refImage : `lsst.afw.image.Image`
    A reference image used to supply the default pixel values.
dcrWeights : `list` of `lsst.afw.image.Image`
    Per-pixel weights for each subfilter.
    Equal to 1/(number of unmasked images contributing to each pixel).

Definition at line 526 of file dcrAssembleCoadd.py.

◆ dcrResiduals()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.dcrResiduals (   self,
  residual,
  visitInfo,
  wcs,
  filterInfo 
)
Prepare a residual image for stacking in each subfilter by applying the reverse DCR shifts.

Parameters
----------
residual : `numpy.ndarray`
    The residual masked image for one exposure,
    after subtracting the matched template
visitInfo : `lsst.afw.image.VisitInfo`
    Metadata for the exposure.
wcs : `lsst.afw.geom.SkyWcs`
    Coordinate system definition (wcs) for the exposure.
filterInfo : `lsst.afw.image.Filter`
    The filter definition, set in the current instruments' obs package.
    Required for any calculation of DCR, including making matched templates.

Yields
------
residualImage : `numpy.ndarray`
    The residual image for the next subfilter, shifted for DCR.

Definition at line 595 of file dcrAssembleCoadd.py.

◆ fillCoadd()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.fillCoadd (   self,
  dcrModels,
  skyInfo,
  tempExpRefList,
  weightList,
  calibration = None,
  coaddInputs = None,
  mask = None,
  variance = None 
)
Create a list of coadd exposures from a list of masked images.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.
skyInfo : `lsst.pipe.base.Struct`
    Patch geometry information, from getSkyInfo
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
weightList : `list` of `float`
    The weight to give each input exposure in the coadd
calibration : `lsst.afw.Image.PhotoCalib`, optional
    Scale factor to set the photometric calibration of an exposure.
coaddInputs : `lsst.afw.Image.CoaddInputs`, optional
    A record of the observations that are included in the coadd.
mask : `lsst.afw.image.Mask`, optional
    Optional mask to override the values in the final coadd.
variance : `lsst.afw.image.Image`, optional
    Optional variance plane to override the values in the final coadd.

Returns
-------
dcrCoadds : `list` of `lsst.afw.image.ExposureF`
    A list of coadd exposures, each exposure containing
    the model for one subfilter.

Definition at line 779 of file dcrAssembleCoadd.py.

◆ filterArtifacts()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.filterArtifacts (   self,
  spanSetList,
  epochCountImage,
  nImage,
  footprintsToExclude = None 
)
inherited
Filter artifact candidates.

Parameters
----------
spanSetList : `list`
    List of SpanSets representing artifact candidates.
epochCountImage : `lsst.afw.image.Image`
    Image of accumulated number of warpDiff detections.
nImage : `lsst.afw.image.Image`
    Image of the accumulated number of total epochs contributing.

Returns
-------
maskSpanSetList : `list`
    List of SpanSets with artifacts.

Definition at line 2263 of file assembleCoadd.py.

◆ findArtifacts()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.findArtifacts (   self,
  templateCoadd,
  tempExpRefList,
  imageScalerList 
)
inherited
Find artifacts.

Loop through warps twice. The first loop builds a map with the count
of how many epochs each pixel deviates from the templateCoadd by more
than ``config.chiThreshold`` sigma. The second loop takes each
difference image and filters the artifacts detected in each using
count map to filter out variable sources and sources that are
difficult to subtract cleanly.

Parameters
----------
templateCoadd : `lsst.afw.image.Exposure`
    Exposure to serve as model of static sky.
tempExpRefList : `list`
    List of data references to warps.
imageScalerList : `list`
    List of image scalers.

Returns
-------
altMasks : `list`
    List of dicts containing information about CLIPPED
    (i.e., artifacts), NO_DATA, and EDGE pixels.

Definition at line 2128 of file assembleCoadd.py.

◆ getBadPixelMask()

def lsst.pipe.tasks.coaddBase.CoaddBaseTask.getBadPixelMask (   self)
inherited

Convenience method to provide the bitmask from the mask plane names.

Definition at line 199 of file coaddBase.py.

◆ getCoaddDatasetName()

def lsst.pipe.tasks.coaddBase.CoaddBaseTask.getCoaddDatasetName (   self,
  warpType = "direct" 
)
inherited
Return coadd name for given warpType and task config

Parameters
----------
warpType : string
    Either 'direct' or 'psfMatched'

Returns
-------
CoaddDatasetName : `string`

Definition at line 149 of file coaddBase.py.

◆ getInputDatasetTypes()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.getInputDatasetTypes (   cls,
  config 
)
inherited
Return input dataset type descriptors

Remove input dataset types not used by the Task

Definition at line 373 of file assembleCoadd.py.

◆ getOutputDatasetTypes()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.getOutputDatasetTypes (   cls,
  config 
)
inherited
Return output dataset type descriptors

Remove output dataset types not produced by the Task

Definition at line 362 of file assembleCoadd.py.

◆ getPrerequisiteDatasetTypes()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.getPrerequisiteDatasetTypes (   cls,
  config 
)
inherited

Definition at line 384 of file assembleCoadd.py.

◆ getSkyInfo()

def lsst.pipe.tasks.coaddBase.CoaddBaseTask.getSkyInfo (   self,
  patchRef 
)
inherited

Use getSkyinfo to return the skyMap, tract and patch information, wcs and the outer bbox of the patch.

Parameters
[in]patchRefdata reference for sky map. Must include keys "tract" and "patch"
Returns
pipe_base Struct containing:
  • skyMap: sky map
  • tractInfo: information for chosen tract of sky map
  • patchInfo: information about chosen patch of tract
  • wcs: WCS of tract
  • bbox: outer bbox of patch, as an afwGeom Box2I

Definition at line 133 of file coaddBase.py.

◆ getTempExpDatasetName()

def lsst.pipe.tasks.coaddBase.CoaddBaseTask.getTempExpDatasetName (   self,
  warpType = "direct" 
)
inherited
Return warp name for given warpType and task config

Parameters
----------
warpType : string
    Either 'direct' or 'psfMatched'

Returns
-------
WarpDatasetName : `string`

Definition at line 164 of file coaddBase.py.

◆ getTempExpRefList()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.getTempExpRefList (   self,
  patchRef,
  calExpRefList 
)
inherited
Generate list data references corresponding to warped exposures
that lie within the patch to be coadded.

Parameters
----------
patchRef : `dataRef`
    Data reference for patch.
calExpRefList : `list`
    List of data references for input calexps.

Returns
-------
tempExpRefList : `list`
    List of Warp/CoaddTempExp data references.

Definition at line 601 of file assembleCoadd.py.

◆ loadSubExposures()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.loadSubExposures (   self,
  bbox,
  statsCtrl,
  tempExpRefList,
  imageScalerList,
  spanSetMaskList 
)
Pre-load sub-regions of a list of exposures.

Parameters
----------
bbox : `lsst.afw.geom.box.Box2I`
    Sub-region to coadd
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
imageScalerList : `list` of `lsst.pipe.task.ImageScaler`
    The image scalars correct for the zero point of the exposures.
spanSetMaskList : `list` of `dict` containing spanSet lists, or None
    Each element is dict with keys = mask plane name to add the spans to

Returns
-------
subExposures : `dict`
    The `dict` keys are the visit IDs,
    and the values are `lsst.afw.image.ExposureF`
    The pre-loaded exposures for the current subregion.
    The variance plane contains weights, and not the variance

Definition at line 966 of file dcrAssembleCoadd.py.

◆ makeSupplementaryData()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.makeSupplementaryData (   self,
  dataRef,
  selectDataList = None,
  warpRefList = None 
)
inherited
Make inputs specific to Subclass.

Generate a templateCoadd to use as a native model of static sky to
subtract from warps.

Parameters
----------
dataRef : `lsst.daf.persistence.butlerSubset.ButlerDataRef`
    Butler dataRef for supplementary data.
selectDataList : `list` (optional)
    Optional List of data references to Calexps.
warpRefList : `list` (optional)
    Optional List of data references to Warps.

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

   - ``templateCoadd``: coadded exposure (``lsst.afw.image.Exposure``)
   - ``nImage``: N Image (``lsst.afw.image.Image``)

Definition at line 2019 of file assembleCoadd.py.

◆ makeSupplementaryDataGen3()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.makeSupplementaryDataGen3 (   self,
  inputData,
  inputDataIds,
  outputDataIds,
  butler 
)
inherited
Make inputs specific to Subclass with Gen 3 API

Calls Gen3 `adaptArgsAndRun` instead of the Gen2 specific `runDataRef`

Duplicates interface of`adaptArgsAndRun` method.
Available to be implemented by subclasses only if they need the
coadd dataRef for performing preliminary processing before
assembling the coadd.

Parameters
----------
inputData : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are input Python-domain data objects (or lists of objects)
    retrieved from data butler.
inputDataIds : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are DataIds (or lists of DataIds) that task consumes for
    corresponding dataset type.
    DataIds are guaranteed to match data objects in ``inputData``.
outputDataIds : `dict`
    Keys are the names of the configs describing input dataset types.
    Values are DataIds (or lists of DataIds) that task is to produce
    for corresponding dataset type.
butler : `lsst.daf.butler.Butler`
    Gen3 Butler object for fetching additional data products before
    running the Task

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

   - ``templateCoadd`` : coadded exposure (``lsst.afw.image.Exposure``)
   - ``nImage``: N Image (``lsst.afw.image.Image``)

Definition at line 1972 of file assembleCoadd.py.

◆ newModelFromResidual()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.newModelFromResidual (   self,
  dcrModels,
  residualGeneratorList,
  dcrBBox,
  statsCtrl,
  mask,
  gain,
  modelWeights,
  refImage,
  dcrWeights 
)
Calculate a new DcrModel from a set of image residuals.

Parameters
----------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Current model of the true sky after correcting chromatic effects.
residualGeneratorList : `generator` of `numpy.ndarray`
    The residual image for the next subfilter, shifted for DCR.
dcrBBox : `lsst.afw.geom.box.Box2I`
    Sub-region of the coadd which includes a buffer to allow for DCR.
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd
mask : `lsst.afw.image.Mask`
    Mask to use for each new model image.
gain : `float`
    Relative weight to give the new solution when updating the model.
modelWeights : `numpy.ndarray` or `float`
    A 2D array of weight values that tapers smoothly to zero away from detected sources.
    Set to a placeholder value of 1.0 if ``self.config.useModelWeights`` is False.
refImage : `lsst.afw.image.Image`
    A reference image used to supply the default pixel values.
dcrWeights : `list` of `lsst.afw.image.Image`
    Per-pixel weights for each subfilter.
    Equal to 1/(number of unmasked images contributing to each pixel).

Returns
-------
dcrModel : `lsst.pipe.tasks.DcrModel`
    New model of the true sky after correcting chromatic effects.

Definition at line 621 of file dcrAssembleCoadd.py.

◆ prefilterArtifacts()

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.prefilterArtifacts (   self,
  spanSetList,
  exp 
)
inherited
Remove artifact candidates covered by bad mask plane.

Any future editing of the candidate list that does not depend on
temporal information should go in this method.

Parameters
----------
spanSetList : `list`
    List of SpanSets representing artifact candidates.
exp : `lsst.afw.image.Exposure`
    Exposure containing mask planes used to prefilter.

Returns
-------
returnSpanSetList : `list`
    List of SpanSets with artifacts.

Definition at line 2231 of file assembleCoadd.py.

◆ prepareDcrInputs()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.prepareDcrInputs (   self,
  templateCoadd,
  tempExpRefList,
  weightList 
)
Prepare the DCR coadd by iterating through the visitInfo of the input warps.

Sets the property ``bufferSize``.

Parameters
----------
templateCoadd : `lsst.afw.image.ExposureF`
    The initial coadd exposure before accounting for DCR.
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
weightList : `list` of `float`
    The weight to give each input exposure in the coadd
    Will be modified in place if ``doAirmassWeight`` is set.

Returns
-------
dcrModels : `lsst.pipe.tasks.DcrModel`
    Best fit model of the true sky after correcting chromatic effects.

Raises
------
NotImplementedError
    If ``lambdaMin`` is missing from the Mapper class of the obs package being used.

Definition at line 255 of file dcrAssembleCoadd.py.

◆ prepareInputs()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.prepareInputs (   self,
  refList 
)
inherited
Prepare the input warps for coaddition by measuring the weight for
each warp and the scaling for the photometric zero point.

Each Warp has its own photometric zeropoint and background variance.
Before coadding these Warps together, compute a scale factor to
normalize the photometric zeropoint and compute the weight for each Warp.

Parameters
----------
refList : `list`
    List of data references to tempExp

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

   - ``tempExprefList``: `list` of data references to tempExp.
   - ``weightList``: `list` of weightings.
   - ``imageScalerList``: `list` of image scalers.

Definition at line 625 of file assembleCoadd.py.

◆ prepareStats()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.prepareStats (   self,
  mask = None 
)
inherited
Prepare the statistics for coadding images.

Parameters
----------
mask : `int`, optional
    Bit mask value to exclude from coaddition.

Returns
-------
stats : `lsst.pipe.base.Struct`
    Statistics structure with the following fields:

    - ``statsCtrl``: Statistics control object for coadd
(`lsst.afw.math.StatisticsControl`)
    - ``statsFlags``: Statistic for coadd (`lsst.afw.math.Property`)

Definition at line 697 of file assembleCoadd.py.

◆ processResults()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.processResults (   self,
  coaddExposure,
  dataRef 
)
inherited
Interpolate over missing data and mask bright stars.

Parameters
----------
coaddExposure : `lsst.afw.image.Exposure`
    The coadded exposure to process.
dataRef : `lsst.daf.persistence.ButlerDataRef`
    Butler data reference for supplementary data.

Definition at line 529 of file assembleCoadd.py.

◆ readBrightObjectMasks()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.readBrightObjectMasks (   self,
  dataRef 
)
inherited
Retrieve the bright object masks.

Returns None on failure.

Parameters
----------
dataRef : `lsst.daf.persistence.butlerSubset.ButlerDataRef`
    A Butler dataRef.

Returns
-------
result : `lsst.daf.persistence.butlerSubset.ButlerDataRef`
    Bright object mask from the Butler object, or None if it cannot
    be retrieved.

Definition at line 1026 of file assembleCoadd.py.

◆ removeMaskPlanes()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.removeMaskPlanes (   self,
  maskedImage 
)
inherited
Unset the mask of an image for mask planes specified in the config.

Parameters
----------
maskedImage : `lsst.afw.image.MaskedImage`
    The masked image to be modified.

Definition at line 928 of file assembleCoadd.py.

◆ run() [1/2]

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.run (   self,
  skyInfo,
  tempExpRefList,
  imageScalerList,
  weightList,
  supplementaryData = None 
)
Assemble the coadd.

Requires additional inputs Struct ``supplementaryData`` to contain a
``templateCoadd`` that serves as the model of the static sky.

Find artifacts and apply them to the warps' masks creating a list of
alternative masks with a new "CLIPPED" plane and updated "NO_DATA" plane
Then pass these alternative masks to the base class's assemble method.

Divide the ``templateCoadd`` evenly between each subfilter of a
``DcrModel`` as the starting best estimate of the true wavelength-
dependent sky. Forward model the ``DcrModel`` using the known
chromatic effects in each subfilter and calculate a convergence metric
based on how well the modeled template matches the input warps. If
the convergence has not yet reached the desired threshold, then shift
and stack the residual images to build a new ``DcrModel``. Apply
conditioning to prevent oscillating solutions between iterations or
between subfilters.

Once the ``DcrModel`` reaches convergence or the maximum number of
iterations has been reached, fill the metadata for each subfilter
image and make them proper ``coaddExposure``s.

Parameters
----------
skyInfo : `lsst.pipe.base.Struct`
    Patch geometry information, from getSkyInfo
tempExpRefList : `list` of `lsst.daf.persistence.ButlerDataRef`
    The data references to the input warped exposures.
imageScalerList : `list` of `lsst.pipe.task.ImageScaler`
    The image scalars correct for the zero point of the exposures.
weightList : `list` of `float`
    The weight to give each input exposure in the coadd
supplementaryData : `lsst.pipe.base.Struct`
    Result struct returned by ``makeSupplementaryData`` with components:

    - ``templateCoadd``: coadded exposure (`lsst.afw.image.Exposure`)

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

    - ``coaddExposure``: coadded exposure (`lsst.afw.image.Exposure`)
    - ``nImage``: exposure count image (`lsst.afw.image.ImageU`)
    - ``dcrCoadds``: `list` of coadded exposures for each subfilter
    - ``dcrNImages``: `list` of exposure count images for each subfilter

Definition at line 309 of file dcrAssembleCoadd.py.

◆ run() [2/2]

def lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.run (   self,
  skyInfo,
  tempExpRefList,
  imageScalerList,
  weightList,
  supplementaryData,
  args,
  kwargs 
)
inherited
Assemble the coadd.

Find artifacts and apply them to the warps' masks creating a list of
alternative masks with a new "CLIPPED" plane and updated "NO_DATA"
plane. Then pass these alternative masks to the base class's `run`
method.

Parameters
----------
skyInfo : `lsst.pipe.base.Struct`
    Patch geometry information.
tempExpRefList : `list`
    List of data references to warps.
imageScalerList : `list`
    List of image scalers.
weightList : `list`
    List of weights.
supplementaryData : `lsst.pipe.base.Struct`
    This Struct must contain a ``templateCoadd`` that serves as the
    model of the static sky.

Returns
-------
result : `lsst.pipe.base.Struct`
   Result struct with components:

   - ``coaddExposure``: coadded exposure (``lsst.afw.image.Exposure``).
   - ``nImage``: exposure count image (``lsst.afw.image.Image``), if requested.

Definition at line 2065 of file assembleCoadd.py.

◆ runDataRef()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.runDataRef (   self,
  dataRef,
  selectDataList = None,
  warpRefList = None 
)
Assemble a coadd from a set of warps.

Coadd a set of Warps. Compute weights to be applied to each Warp and
find scalings to match the photometric zeropoint to a reference Warp.
Assemble the Warps using run method.
Forward model chromatic effects across multiple subfilters,
and subtract from the input Warps to build sets of residuals.
Use the residuals to construct a new ``DcrModel`` for each subfilter,
and iterate until the model converges.
Interpolate over NaNs and optionally write the coadd to disk.
Return the coadded exposure.

Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
    Data reference defining the patch for coaddition and the
    reference Warp
selectDataList : `list` of `lsst.daf.persistence.ButlerDataRef`
    List of data references to warps. Data to be coadded will be
    selected from this list based on overlap with the patch defined by
    the data reference.

Returns
-------
results : `lsst.pipe.base.Struct`
    The Struct contains the following fields:

    - ``coaddExposure``: coadded exposure (`lsst.afw.image.Exposure`)
    - ``nImage``: exposure count image (`lsst.afw.image.ImageU`)
    - ``dcrCoadds``: `list` of coadded exposures for each subfilter
    - ``dcrNImages``: `list` of exposure count images for each subfilter

Definition at line 200 of file dcrAssembleCoadd.py.

◆ selectExposures()

def lsst.pipe.tasks.coaddBase.CoaddBaseTask.selectExposures (   self,
  patchRef,
  skyInfo = None,
  selectDataList = [] 
)
inherited

Select exposures to coadd.

Get the corners of the bbox supplied in skyInfo using afwGeom.Box2D and convert the pixel positions of the bbox corners to sky coordinates using skyInfo.wcs.pixelToSky. Use the WcsSelectImagesTask to select exposures that lie inside the patch indicated by the dataRef.

Parameters
[in]patchRefdata reference for sky map patch. Must include keys "tract", "patch", plus the camera-specific filter key (e.g. "filter" or "band")
[in]skyInfogeometry for the patch; output from getSkyInfo
Returns
a list of science exposures to coadd, as butler data references

Definition at line 113 of file coaddBase.py.

◆ setBrightObjectMasks()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.setBrightObjectMasks (   self,
  exposure,
  dataId,
  brightObjectMasks 
)
inherited
Set the bright object masks.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure under consideration.
dataId : `lsst.daf.persistence.dataId`
    Data identifier dict for patch.
brightObjectMasks : `lsst.afw.table`
    Table of bright objects to mask.

Definition at line 1048 of file assembleCoadd.py.

◆ setInexactPsf()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.setInexactPsf (   self,
  mask 
)
inherited
Set INEXACT_PSF mask plane.

If any of the input images isn't represented in the coadd (due to
clipped pixels or chip gaps), the `CoaddPsf` will be inexact. Flag
these pixels.

Parameters
----------
mask : `lsst.afw.image.Mask`
    Coadded exposure's mask, modified in-place.

Definition at line 1090 of file assembleCoadd.py.

◆ setRejectedMaskMapping()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.setRejectedMaskMapping (   statsCtrl)
staticinherited
Map certain mask planes of the warps to new planes for the coadd.

If a pixel is rejected due to a mask value other than EDGE, NO_DATA,
or CLIPPED, set it to REJECTED on the coadd.
If a pixel is rejected due to EDGE, set the coadd pixel to SENSOR_EDGE.
If a pixel is rejected due to CLIPPED, set the coadd pixel to CLIPPED.

Parameters
----------
statsCtrl : `lsst.afw.math.StatisticsControl`
    Statistics control object for coadd

Returns
-------
maskMap : `list` of `tuple` of `int`
    A list of mappings of mask planes of the warped exposures to
    mask planes of the coadd.

Definition at line 944 of file assembleCoadd.py.

◆ shrinkValidPolygons()

def lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.shrinkValidPolygons (   self,
  coaddInputs 
)
inherited
Shrink coaddInputs' ccds' ValidPolygons in place.

Either modify each ccd's validPolygon in place, or if CoaddInputs
does not have a validPolygon, create one from its bbox.

Parameters
----------
coaddInputs : `lsst.afw.image.coaddInputs`
    Original mask.

Definition at line 1004 of file assembleCoadd.py.

◆ stackCoadd()

def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.stackCoadd (   self,
  dcrCoadds 
)
Add a list of sub-band coadds together.

Parameters
----------
dcrCoadds : `list` of `lsst.afw.image.ExposureF`
    A list of coadd exposures, each exposure containing
    the model for one subfilter.

Returns
-------
coaddExposure : `lsst.afw.image.ExposureF`
    A single coadd exposure that is the sum of the sub-bands.

Definition at line 759 of file dcrAssembleCoadd.py.

Member Data Documentation

◆ brightObjectBitmask

lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.brightObjectBitmask
inherited

Definition at line 353 of file assembleCoadd.py.

◆ bufferSize

lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.bufferSize

Definition at line 301 of file dcrAssembleCoadd.py.

◆ ConfigClass

lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.ConfigClass = DcrAssembleCoaddConfig
static

Definition at line 196 of file dcrAssembleCoadd.py.

◆ RunnerClass

lsst.pipe.tasks.coaddBase.CoaddBaseTask.RunnerClass = CoaddTaskRunner
staticinherited

Definition at line 106 of file coaddBase.py.

◆ warpType

lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.warpType
inherited

Definition at line 359 of file assembleCoadd.py.


The documentation for this class was generated from the following file: