lsst.pipe.tasks
17.0.1-25-gd5522830
|
Public Member Functions | |
def | __init__ (self, args, kwargs) |
def | runDataRef (self, dataRef, selectDataList=None, warpRefList=None) |
def | processResults (self, coaddExposure, dataRef) |
def | prepareDcrInputs (self, templateCoadd, warpRefList, weightList) |
def | run (self, skyInfo, warpRefList, imageScalerList, weightList, supplementaryData=None) |
def | calculateNImage (self, dcrModels, bbox, warpRefList, spanSetMaskList, statsCtrl) |
def | dcrAssembleSubregion (self, dcrModels, subExposures, bbox, dcrBBox, warpRefList, 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, warpRefList, weightList, statsCtrl) |
def | calculateSingleConvergence (self, dcrModels, exposure, significanceImage, statsCtrl) |
def | stackCoadd (self, dcrCoadds) |
def | fillCoadd (self, dcrModels, skyInfo, warpRefList, 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, warpRefList, imageScalerList, spanSetMaskList) |
def | selectCoaddPsf (self, templateCoadd, warpRefList) |
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 | 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 | |
makeIdFactory = _makeMakeIdFactory("CoaddId") | |
RunnerClass = CoaddTaskRunner | |
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 174 of file dcrAssembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.__init__ | ( | self, | |
args, | |||
kwargs | |||
) |
Definition at line 225 of file dcrAssembleCoadd.py.
|
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 393 of file assembleCoadd.py.
|
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 2120 of file assembleCoadd.py.
|
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 983 of file assembleCoadd.py.
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 1015 of file dcrAssembleCoadd.py.
|
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 812 of file assembleCoadd.py.
|
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 869 of file assembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateConvergence | ( | self, | |
dcrModels, | |||
subExposures, | |||
bbox, | |||
warpRefList, | |||
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 warpRefList : `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 745 of file dcrAssembleCoadd.py.
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 901 of file dcrAssembleCoadd.py.
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 982 of file dcrAssembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.calculateNImage | ( | self, | |
dcrModels, | |||
bbox, | |||
warpRefList, | |||
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. warpRefList : `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 535 of file dcrAssembleCoadd.py.
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 786 of file dcrAssembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.dcrAssembleSubregion | ( | self, | |
dcrModels, | |||
subExposures, | |||
bbox, | |||
dcrBBox, | |||
warpRefList, | |||
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. warpRefList : `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 593 of file dcrAssembleCoadd.py.
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 662 of file dcrAssembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.fillCoadd | ( | self, | |
dcrModels, | |||
skyInfo, | |||
warpRefList, | |||
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 warpRefList : `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 846 of file dcrAssembleCoadd.py.
|
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 2274 of file assembleCoadd.py.
|
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 2139 of file assembleCoadd.py.
|
inherited |
Convenience method to provide the bitmask from the mask plane names.
Definition at line 199 of file coaddBase.py.
|
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.
|
inherited |
Return input dataset type descriptors Remove input dataset types not used by the Task
Definition at line 379 of file assembleCoadd.py.
|
inherited |
Return output dataset type descriptors Remove output dataset types not produced by the Task
Definition at line 368 of file assembleCoadd.py.
|
inherited |
Definition at line 390 of file assembleCoadd.py.
|
inherited |
Use getSkyinfo to return the skyMap, tract and patch information, wcs and the outer bbox of the patch.
[in] | patchRef | data reference for sky map. Must include keys "tract" and "patch" |
Definition at line 133 of file coaddBase.py.
|
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.
|
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 611 of file assembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.loadSubExposures | ( | self, | |
bbox, | |||
statsCtrl, | |||
warpRefList, | |||
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 warpRefList : `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 1035 of file dcrAssembleCoadd.py.
|
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 2030 of file assembleCoadd.py.
|
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 1983 of file assembleCoadd.py.
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 688 of file dcrAssembleCoadd.py.
|
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 2242 of file assembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.prepareDcrInputs | ( | self, | |
templateCoadd, | |||
warpRefList, | |||
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. warpRefList : `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 320 of file dcrAssembleCoadd.py.
|
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 635 of file assembleCoadd.py.
|
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 707 of file assembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.processResults | ( | self, | |
coaddExposure, | |||
dataRef | |||
) |
Interpolate over missing data and mask bright stars. Also detect sources on the coadd exposure and measure the final PSF, if ``doCalculatePsf`` is set. Parameters ---------- coaddExposure : `lsst.afw.image.Exposure` The final coadded exposure. dataRef : `lsst.daf.persistence.ButlerDataRef` Data reference defining the patch for coaddition and the reference Warp
Definition at line 291 of file dcrAssembleCoadd.py.
|
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 1037 of file assembleCoadd.py.
|
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 938 of file assembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.run | ( | self, | |
skyInfo, | |||
warpRefList, | |||
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 warpRefList : `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 376 of file dcrAssembleCoadd.py.
|
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 2076 of file assembleCoadd.py.
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 234 of file dcrAssembleCoadd.py.
def lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.selectCoaddPsf | ( | self, | |
templateCoadd, | |||
warpRefList | |||
) |
Compute the PSF of the coadd from the exposures with the best seeing. Parameters ---------- templateCoadd : `lsst.afw.image.ExposureF` The initial coadd exposure before accounting for DCR. warpRefList : `list` of `lsst.daf.persistence.ButlerDataRef` The data references to the input warped exposures. Returns ------- psf : `lsst.meas.algorithms.CoaddPsf` The average PSF of the input exposures with the best seeing.
Definition at line 1077 of file dcrAssembleCoadd.py.
|
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.
[in] | patchRef | data reference for sky map patch. Must include keys "tract", "patch", plus the camera-specific filter key (e.g. "filter" or "band") |
[in] | skyInfo | geometry for the patch; output from getSkyInfo |
Definition at line 113 of file coaddBase.py.
|
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 1059 of file assembleCoadd.py.
|
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 1101 of file assembleCoadd.py.
|
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 955 of file assembleCoadd.py.
|
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 1015 of file assembleCoadd.py.
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 826 of file dcrAssembleCoadd.py.
|
inherited |
Definition at line 359 of file assembleCoadd.py.
lsst.pipe.tasks.dcrAssembleCoadd.DcrAssembleCoaddTask.bufferSize |
Definition at line 367 of file dcrAssembleCoadd.py.
|
static |
Definition at line 221 of file dcrAssembleCoadd.py.
|
static |
Definition at line 223 of file dcrAssembleCoadd.py.
|
staticinherited |
Definition at line 106 of file coaddBase.py.
|
inherited |
Definition at line 365 of file assembleCoadd.py.