lsst.pipe.tasks g68a3911fdd+bdac146de2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask Class Reference
Inheritance diagram for lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask:
lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask lsst.pipe.tasks.coaddBase.CoaddBaseTask

Public Member Functions

 __init__ (self, *args, **kwargs)
 
 run (self, skyInfo, tempExpRefList, imageScalerList, weightList, supplementaryData)
 
 applyAltEdgeMask (self, mask, altMaskList)
 
 findArtifacts (self, templateCoadd, tempExpRefList, imageScalerList)
 
 prefilterArtifacts (self, spanSetList, exp)
 
 filterArtifacts (self, spanSetList, epochCountImage, nImage, footprintsToExclude=None)
 

Static Public Attributes

 ConfigClass = CompareWarpAssembleCoaddConfig
 

Protected Member Functions

 _makeSupplementaryData (self, butlerQC, inputRefs, outputRefs)
 
 _noTemplateMessage (self, warpType)
 
 _readAndComputeWarpDiff (self, warpRef, imageScaler, templateCoadd)
 

Static Protected Attributes

str _DefaultName = "compareWarpAssembleCoadd"
 

Detailed Description

Assemble a compareWarp coadded image from a set of warps
by masking artifacts detected by comparing PSF-matched warps.

In ``AssembleCoaddTask``, we compute the coadd as an clipped mean (i.e.,
we clip outliers). The problem with doing this is that when computing the
coadd PSF at a given location, individual visit PSFs from visits with
outlier pixels contribute to the coadd PSF and cannot be treated correctly.
In this task, we correct for this behavior by creating a new badMaskPlane
'CLIPPED' which marks pixels in the individual warps suspected to contain
an artifact. We populate this plane on the input warps by comparing
PSF-matched warps with a PSF-matched median coadd which serves as a
model of the static sky. Any group of pixels that deviates from the
PSF-matched template coadd by more than config.detect.threshold sigma,
is an artifact candidate. The candidates are then filtered to remove
variable sources and sources that are difficult to subtract such as
bright stars. This filter is configured using the config parameters
``temporalThreshold`` and ``spatialThreshold``. The temporalThreshold is
the maximum fraction of epochs that the deviation can appear in and still
be considered an artifact. The spatialThreshold is the maximum fraction of
pixels in the footprint of the deviation that appear in other epochs
(where other epochs is defined by the temporalThreshold). If the deviant
region meets this criteria of having a significant percentage of pixels
that deviate in only a few epochs, these pixels have the 'CLIPPED' bit
set in the mask. These regions will not contribute to the final coadd.
Furthermore, any routine to determine the coadd PSF can now be cognizant
of clipped regions. Note that the algorithm implemented by this task is
preliminary and works correctly for HSC data. Parameter modifications and
or considerable redesigning of the algorithm is likley required for other
surveys.

``CompareWarpAssembleCoaddTask`` sub-classes
``AssembleCoaddTask`` and instantiates ``AssembleCoaddTask``
as a subtask to generate the TemplateCoadd (the model of the static sky).

Notes
-----
Debugging:
This task supports the following debug variables:
- ``saveCountIm``
    If True then save the Epoch Count Image as a fits file in the `figPath`
- ``figPath``
    Path to save the debug fits images and figures

Definition at line 1375 of file assembleCoadd.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.__init__ (   self,
args,
**  kwargs 
)

Reimplemented from lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.

Definition at line 1423 of file assembleCoadd.py.

Member Function Documentation

◆ _makeSupplementaryData()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask._makeSupplementaryData (   self,
  butlerQC,
  inputRefs,
  outputRefs 
)
protected
Generate a templateCoadd to use as a naive model of static sky to
subtract from PSF-Matched warps.

Returns
-------
result : `~lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``templateCoadd``
        Coadded exposure (`lsst.afw.image.Exposure`).
    ``nImage``
        Keeps track of exposure count for each pixel (`lsst.afw.image.ImageU`).

Raises
------
RuntimeError
    Raised if ``templateCoadd`` is `None`.

Reimplemented from lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.

Definition at line 1436 of file assembleCoadd.py.

◆ _noTemplateMessage()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask._noTemplateMessage (   self,
  warpType 
)
protected

Definition at line 1484 of file assembleCoadd.py.

◆ _readAndComputeWarpDiff()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask._readAndComputeWarpDiff (   self,
  warpRef,
  imageScaler,
  templateCoadd 
)
protected
Fetch a warp from the butler and return a warpDiff.

Parameters
----------
warpRef : `lsst.daf.butler.DeferredDatasetHandle`
    Handle for the warp.
imageScaler : `lsst.pipe.tasks.scaleZeroPoint.ImageScaler`
    An image scaler object.
templateCoadd : `lsst.afw.image.Exposure`
    Exposure to be substracted from the scaled warp.

Returns
-------
warp : `lsst.afw.image.Exposure`
    Exposure of the image difference between the warp and template.

Definition at line 1769 of file assembleCoadd.py.

◆ applyAltEdgeMask()

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

Parameters
----------
mask : `lsst.afw.image.Mask`
    Original mask.
altMaskList : `list` of `dict`
    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 1540 of file assembleCoadd.py.

◆ filterArtifacts()

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

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

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

Definition at line 1717 of file assembleCoadd.py.

◆ findArtifacts()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.findArtifacts (   self,
  templateCoadd,
  tempExpRefList,
  imageScalerList 
)
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` of `dict`
    List of dicts containing information about CLIPPED
    (i.e., artifacts), NO_DATA, and EDGE pixels.

Definition at line 1559 of file assembleCoadd.py.

◆ prefilterArtifacts()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.prefilterArtifacts (   self,
  spanSetList,
  exp 
)
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` of `lsst.afw.geom.SpanSet`
    List of SpanSets representing artifact candidates.
exp : `lsst.afw.image.Exposure`
    Exposure containing mask planes used to prefilter.

Returns
-------
returnSpanSetList : `list` of `lsst.afw.geom.SpanSet`
    List of SpanSets with artifacts.

Definition at line 1685 of file assembleCoadd.py.

◆ run()

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.run (   self,
  skyInfo,
  tempExpRefList,
  imageScalerList,
  weightList,
  supplementaryData 
)
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.

Reimplemented from lsst.pipe.tasks.assembleCoadd.AssembleCoaddTask.

Definition at line 1501 of file assembleCoadd.py.

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask._DefaultName = "compareWarpAssembleCoadd"
staticprotected

Definition at line 1421 of file assembleCoadd.py.

◆ ConfigClass

lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask.ConfigClass = CompareWarpAssembleCoaddConfig
static

Definition at line 1420 of file assembleCoadd.py.


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