LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask Class Reference
Inheritance diagram for lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask:

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def run (self, skyInfo, tempExpRefList, imageScalerList, weightList, *args, **kwargs)
 
def buildDifferenceImage (self, skyInfo, tempExpRefList, imageScalerList, weightList)
 
def detectClip (self, exp, tempExpRefList)
 
def detectClipBig (self, clipList, clipFootprints, clipIndices, detectionFootprints, maskClipValue, maskDetValue, coaddBBox)
 

Static Public Attributes

 ConfigClass
 

Detailed Description

Assemble a coadded image from a set of coadded temporary exposures,
being careful to clip & flag areas with potential artifacts.

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'. We populate this plane on the input
coaddTempExps and the final coadd where

    i. difference imaging suggests that there is an outlier and
    ii. this outlier appears on only one or two images.

Such 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.

``SafeClipAssembleCoaddTask`` uses a ``SourceDetectionTask``
"clipDetection" subtask and also sub-classes ``AssembleCoaddTask``.
You can retarget the ``SourceDetectionTask`` "clipDetection" subtask
if you wish.

Notes
-----
The `lsst.pipe.base.cmdLineTask.CmdLineTask` interface supports a
flag ``-d`` to import ``debug.py`` from your ``PYTHONPATH``;
see `baseDebug` for more about ``debug.py`` files.
`SafeClipAssembleCoaddTask` has no debug variables of its own.
The ``SourceDetectionTask`` "clipDetection" subtasks may support debug
variables. See the documetation for `SourceDetectionTask` "clipDetection"
for further information.

Examples
--------
`SafeClipAssembleCoaddTask` assembles a set of warped ``coaddTempExp``
images into a coadded image. The `SafeClipAssembleCoaddTask` is invoked by
running assembleCoadd.py *without* the flag '--legacyCoadd'.

Usage of ``assembleCoadd.py`` expects a data reference to the tract patch
and filter to be coadded (specified using
'--id = [KEY=VALUE1[^VALUE2[^VALUE3...] [KEY=VALUE1[^VALUE2[^VALUE3...] ...]]')
along with a list of coaddTempExps to attempt to coadd (specified using
'--selectId [KEY=VALUE1[^VALUE2[^VALUE3...] [KEY=VALUE1[^VALUE2[^VALUE3...] ...]]').
Only the coaddTempExps that cover the specified tract and patch will be
coadded. A list of the available optional arguments can be obtained by
calling assembleCoadd.py with the --help command line argument:

.. code-block:: none

   assembleCoadd.py --help

To demonstrate usage of the `SafeClipAssembleCoaddTask` in the larger
context of multi-band processing, we will generate the HSC-I & -R band
coadds from HSC engineering test data provided in the ci_hsc package.
To begin, assuming that the lsst stack has been already set up, we must
set up the obs_subaru and ci_hsc packages. This defines the environment
variable $CI_HSC_DIR and points at the location of the package. The raw
HSC data live in the ``$CI_HSC_DIR/raw`` directory. To begin assembling
the coadds, we must first

- ``processCcd``
    process the individual ccds in $CI_HSC_RAW to produce calibrated exposures
- ``makeSkyMap``
    create a skymap that covers the area of the sky present in the raw exposures
- ``makeCoaddTempExp``
    warp the individual calibrated exposures to the tangent plane of the coadd</DD>

We can perform all of these steps by running

.. code-block:: none

   $CI_HSC_DIR scons warp-903986 warp-904014 warp-903990 warp-904010 warp-903988

This will produce warped coaddTempExps for each visit. To coadd the
warped data, we call ``assembleCoadd.py`` as follows:

.. code-block:: none

   assembleCoadd.py $CI_HSC_DIR/DATA --id patch=5,4 tract=0 filter=HSC-I \
   --selectId visit=903986 ccd=16 --selectId visit=903986 ccd=22 --selectId visit=903986 ccd=23 \
   --selectId visit=903986 ccd=100--selectId visit=904014 ccd=1 --selectId visit=904014 ccd=6 \
   --selectId visit=904014 ccd=12 --selectId visit=903990 ccd=18 --selectId visit=903990 ccd=25 \
   --selectId visit=904010 ccd=4 --selectId visit=904010 ccd=10 --selectId visit=904010 ccd=100 \
   --selectId visit=903988 ccd=16 --selectId visit=903988 ccd=17 --selectId visit=903988 ccd=23 \
   --selectId visit=903988 ccd=24

This will process the HSC-I band data. The results are written in
``$CI_HSC_DIR/DATA/deepCoadd-results/HSC-I``.

You may also choose to run:

.. code-block:: none

   scons warp-903334 warp-903336 warp-903338 warp-903342 warp-903344 warp-903346 nnn
   assembleCoadd.py $CI_HSC_DIR/DATA --id patch=5,4 tract=0 filter=HSC-R --selectId visit=903334 ccd=16 \
   --selectId visit=903334 ccd=22 --selectId visit=903334 ccd=23 --selectId visit=903334 ccd=100 \
   --selectId visit=903336 ccd=17 --selectId visit=903336 ccd=24 --selectId visit=903338 ccd=18 \
   --selectId visit=903338 ccd=25 --selectId visit=903342 ccd=4 --selectId visit=903342 ccd=10 \
   --selectId visit=903342 ccd=100 --selectId visit=903344 ccd=0 --selectId visit=903344 ccd=5 \
   --selectId visit=903344 ccd=11 --selectId visit=903346 ccd=1 --selectId visit=903346 ccd=6 \
   --selectId visit=903346 ccd=12

to generate the coadd for the HSC-R band if you are interested in following
multiBand Coadd processing as discussed in ``pipeTasks_multiBand``.

Definition at line 1472 of file assembleCoadd.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1584 of file assembleCoadd.py.

1584  def __init__(self, *args, **kwargs):
1585  AssembleCoaddTask.__init__(self, *args, **kwargs)
1586  schema = afwTable.SourceTable.makeMinimalSchema()
1587  self.makeSubtask("clipDetection", schema=schema)
1588 

Member Function Documentation

◆ buildDifferenceImage()

def lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask.buildDifferenceImage (   self,
  skyInfo,
  tempExpRefList,
  imageScalerList,
  weightList 
)
Return an exposure that contains the difference between unclipped
and clipped coadds.

Generate a difference image between clipped and unclipped coadds.
Compute the difference image by subtracting an outlier-clipped coadd
from an outlier-unclipped coadd. Return the difference image.

Parameters
----------
skyInfo : `lsst.pipe.base.Struct`
    Patch geometry information, from getSkyInfo
tempExpRefList : `list`
    List of data reference to tempExp
imageScalerList : `list`
    List of image scalers
weightList : `list`
    List of weights

Returns
-------
exp : `lsst.afw.image.Exposure`
    Difference image of unclipped and clipped coadd wrapped in an Exposure

Definition at line 1647 of file assembleCoadd.py.

1647  def buildDifferenceImage(self, skyInfo, tempExpRefList, imageScalerList, weightList):
1648  """Return an exposure that contains the difference between unclipped
1649  and clipped coadds.
1650 
1651  Generate a difference image between clipped and unclipped coadds.
1652  Compute the difference image by subtracting an outlier-clipped coadd
1653  from an outlier-unclipped coadd. Return the difference image.
1654 
1655  Parameters
1656  ----------
1657  skyInfo : `lsst.pipe.base.Struct`
1658  Patch geometry information, from getSkyInfo
1659  tempExpRefList : `list`
1660  List of data reference to tempExp
1661  imageScalerList : `list`
1662  List of image scalers
1663  weightList : `list`
1664  List of weights
1665 
1666  Returns
1667  -------
1668  exp : `lsst.afw.image.Exposure`
1669  Difference image of unclipped and clipped coadd wrapped in an Exposure
1670  """
1671  config = AssembleCoaddConfig()
1672  # getattr necessary because subtasks do not survive Config.toDict()
1673  # exclude connections because the class of self.config.connections is not
1674  # the same as AssembleCoaddConfig.connections, and the connections are not
1675  # needed to run this task anyway.
1676  configIntersection = {k: getattr(self.config, k)
1677  for k, v in self.config.toDict().items()
1678  if (k in config.keys() and k != "connections")}
1679  configIntersection['doInputMap'] = False
1680  configIntersection['doNImage'] = False
1681  config.update(**configIntersection)
1682 
1683  # statistic MEAN copied from self.config.statistic, but for clarity explicitly assign
1684  config.statistic = 'MEAN'
1685  task = AssembleCoaddTask(config=config)
1686  coaddMean = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure
1687 
1688  config.statistic = 'MEANCLIP'
1689  task = AssembleCoaddTask(config=config)
1690  coaddClip = task.run(skyInfo, tempExpRefList, imageScalerList, weightList).coaddExposure
1691 
1692  coaddDiff = coaddMean.getMaskedImage().Factory(coaddMean.getMaskedImage())
1693  coaddDiff -= coaddClip.getMaskedImage()
1694  exp = afwImage.ExposureF(coaddDiff)
1695  exp.setPsf(coaddMean.getPsf())
1696  return exp
1697 
std::vector< SchemaItem< Flag > > * items

◆ detectClip()

def lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask.detectClip (   self,
  exp,
  tempExpRefList 
)
Detect clipped regions on an exposure and set the mask on the
individual tempExp masks.

Detect footprints in the difference image after smoothing the
difference image with a Gaussian kernal. Identify footprints that
overlap with one or two input ``coaddTempExps`` by comparing the
computed overlap fraction to thresholds set in the config. A different
threshold is applied depending on the number of overlapping visits
(restricted to one or two). If the overlap exceeds the thresholds,
the footprint is considered "CLIPPED" and is marked as such on the
coaddTempExp. Return a struct with the clipped footprints, the indices
of the ``coaddTempExps`` that end up overlapping with the clipped
footprints, and a list of new masks for the ``coaddTempExps``.

Parameters
----------
exp : `lsst.afw.image.Exposure`
    Exposure to run detection on.
tempExpRefList : `list`
    List of data reference to tempExp.

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

   - ``clipFootprints``: list of clipped footprints.
   - ``clipIndices``: indices for each ``clippedFootprint`` in
        ``tempExpRefList``.
   - ``clipSpans``: List of dictionaries containing spanSet lists
        to clip. Each element contains the new maskplane name
        ("CLIPPED") as the key and list of ``SpanSets`` as the value.
   - ``detectionFootprints``: List of DETECTED/DETECTED_NEGATIVE plane
        compressed into footprints.

Definition at line 1698 of file assembleCoadd.py.

1698  def detectClip(self, exp, tempExpRefList):
1699  """Detect clipped regions on an exposure and set the mask on the
1700  individual tempExp masks.
1701 
1702  Detect footprints in the difference image after smoothing the
1703  difference image with a Gaussian kernal. Identify footprints that
1704  overlap with one or two input ``coaddTempExps`` by comparing the
1705  computed overlap fraction to thresholds set in the config. A different
1706  threshold is applied depending on the number of overlapping visits
1707  (restricted to one or two). If the overlap exceeds the thresholds,
1708  the footprint is considered "CLIPPED" and is marked as such on the
1709  coaddTempExp. Return a struct with the clipped footprints, the indices
1710  of the ``coaddTempExps`` that end up overlapping with the clipped
1711  footprints, and a list of new masks for the ``coaddTempExps``.
1712 
1713  Parameters
1714  ----------
1715  exp : `lsst.afw.image.Exposure`
1716  Exposure to run detection on.
1717  tempExpRefList : `list`
1718  List of data reference to tempExp.
1719 
1720  Returns
1721  -------
1722  result : `lsst.pipe.base.Struct`
1723  Result struct with components:
1724 
1725  - ``clipFootprints``: list of clipped footprints.
1726  - ``clipIndices``: indices for each ``clippedFootprint`` in
1727  ``tempExpRefList``.
1728  - ``clipSpans``: List of dictionaries containing spanSet lists
1729  to clip. Each element contains the new maskplane name
1730  ("CLIPPED") as the key and list of ``SpanSets`` as the value.
1731  - ``detectionFootprints``: List of DETECTED/DETECTED_NEGATIVE plane
1732  compressed into footprints.
1733  """
1734  mask = exp.getMaskedImage().getMask()
1735  maskDetValue = mask.getPlaneBitMask("DETECTED") | mask.getPlaneBitMask("DETECTED_NEGATIVE")
1736  fpSet = self.clipDetection.detectFootprints(exp, doSmooth=True, clearMask=True)
1737  # Merge positive and negative together footprints together
1738  fpSet.positive.merge(fpSet.negative)
1739  footprints = fpSet.positive
1740  self.log.info('Found %d potential clipped objects', len(footprints.getFootprints()))
1741  ignoreMask = self.getBadPixelMask()
1742 
1743  clipFootprints = []
1744  clipIndices = []
1745  artifactSpanSets = [{'CLIPPED': list()} for _ in tempExpRefList]
1746 
1747  # for use by detectClipBig
1748  visitDetectionFootprints = []
1749 
1750  dims = [len(tempExpRefList), len(footprints.getFootprints())]
1751  overlapDetArr = numpy.zeros(dims, dtype=numpy.uint16)
1752  ignoreArr = numpy.zeros(dims, dtype=numpy.uint16)
1753 
1754  # Loop over masks once and extract/store only relevant overlap metrics and detection footprints
1755  for i, warpRef in enumerate(tempExpRefList):
1756  tmpExpMask = warpRef.get(datasetType=self.getTempExpDatasetName(self.warpType),
1757  immediate=True).getMaskedImage().getMask()
1758  maskVisitDet = tmpExpMask.Factory(tmpExpMask, tmpExpMask.getBBox(afwImage.PARENT),
1759  afwImage.PARENT, True)
1760  maskVisitDet &= maskDetValue
1761  visitFootprints = afwDet.FootprintSet(maskVisitDet, afwDet.Threshold(1))
1762  visitDetectionFootprints.append(visitFootprints)
1763 
1764  for j, footprint in enumerate(footprints.getFootprints()):
1765  ignoreArr[i, j] = countMaskFromFootprint(tmpExpMask, footprint, ignoreMask, 0x0)
1766  overlapDetArr[i, j] = countMaskFromFootprint(tmpExpMask, footprint, maskDetValue, ignoreMask)
1767 
1768  # build a list of clipped spans for each visit
1769  for j, footprint in enumerate(footprints.getFootprints()):
1770  nPixel = footprint.getArea()
1771  overlap = [] # hold the overlap with each visit
1772  indexList = [] # index of visit in global list
1773  for i in range(len(tempExpRefList)):
1774  ignore = ignoreArr[i, j]
1775  overlapDet = overlapDetArr[i, j]
1776  totPixel = nPixel - ignore
1777 
1778  # If we have more bad pixels than detection skip
1779  if ignore > overlapDet or totPixel <= 0.5*nPixel or overlapDet == 0:
1780  continue
1781  overlap.append(overlapDet/float(totPixel))
1782  indexList.append(i)
1783 
1784  overlap = numpy.array(overlap)
1785  if not len(overlap):
1786  continue
1787 
1788  keep = False # Should this footprint be marked as clipped?
1789  keepIndex = [] # Which tempExps does the clipped footprint belong to
1790 
1791  # If footprint only has one overlap use a lower threshold
1792  if len(overlap) == 1:
1793  if overlap[0] > self.config.minClipFootOverlapSingle:
1794  keep = True
1795  keepIndex = [0]
1796  else:
1797  # This is the general case where only visit should be clipped
1798  clipIndex = numpy.where(overlap > self.config.minClipFootOverlap)[0]
1799  if len(clipIndex) == 1:
1800  keep = True
1801  keepIndex = [clipIndex[0]]
1802 
1803  # Test if there are clipped objects that overlap two different visits
1804  clipIndex = numpy.where(overlap > self.config.minClipFootOverlapDouble)[0]
1805  if len(clipIndex) == 2 and len(overlap) > 3:
1806  clipIndexComp = numpy.where(overlap <= self.config.minClipFootOverlapDouble)[0]
1807  if numpy.max(overlap[clipIndexComp]) <= self.config.maxClipFootOverlapDouble:
1808  keep = True
1809  keepIndex = clipIndex
1810 
1811  if not keep:
1812  continue
1813 
1814  for index in keepIndex:
1815  globalIndex = indexList[index]
1816  artifactSpanSets[globalIndex]['CLIPPED'].append(footprint.spans)
1817 
1818  clipIndices.append(numpy.array(indexList)[keepIndex])
1819  clipFootprints.append(footprint)
1820 
1821  return pipeBase.Struct(clipFootprints=clipFootprints, clipIndices=clipIndices,
1822  clipSpans=artifactSpanSets, detectionFootprints=visitDetectionFootprints)
1823 
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:43
daf::base::PropertyList * list
Definition: fits.cc:913
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33
def countMaskFromFootprint(mask, footprint, bitmask, ignoreMask)

◆ detectClipBig()

def lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask.detectClipBig (   self,
  clipList,
  clipFootprints,
  clipIndices,
  detectionFootprints,
  maskClipValue,
  maskDetValue,
  coaddBBox 
)
Return individual warp footprints for large artifacts and append
them to ``clipList`` in place.

Identify big footprints composed of many sources in the coadd
difference that may have originated in a large diffuse source in the
coadd. We do this by indentifying all clipped footprints that overlap
significantly with each source in all the coaddTempExps.

Parameters
----------
clipList : `list`
    List of alt mask SpanSets with clipping information. Modified.
clipFootprints : `list`
    List of clipped footprints.
clipIndices : `list`
    List of which entries in tempExpClipList each footprint belongs to.
maskClipValue
    Mask value of clipped pixels.
maskDetValue
    Mask value of detected pixels.
coaddBBox : `lsst.geom.Box`
    BBox of the coadd and warps.

Returns
-------
bigFootprintsCoadd : `list`
    List of big footprints

Definition at line 1824 of file assembleCoadd.py.

1825  maskClipValue, maskDetValue, coaddBBox):
1826  """Return individual warp footprints for large artifacts and append
1827  them to ``clipList`` in place.
1828 
1829  Identify big footprints composed of many sources in the coadd
1830  difference that may have originated in a large diffuse source in the
1831  coadd. We do this by indentifying all clipped footprints that overlap
1832  significantly with each source in all the coaddTempExps.
1833 
1834  Parameters
1835  ----------
1836  clipList : `list`
1837  List of alt mask SpanSets with clipping information. Modified.
1838  clipFootprints : `list`
1839  List of clipped footprints.
1840  clipIndices : `list`
1841  List of which entries in tempExpClipList each footprint belongs to.
1842  maskClipValue
1843  Mask value of clipped pixels.
1844  maskDetValue
1845  Mask value of detected pixels.
1846  coaddBBox : `lsst.geom.Box`
1847  BBox of the coadd and warps.
1848 
1849  Returns
1850  -------
1851  bigFootprintsCoadd : `list`
1852  List of big footprints
1853  """
1854  bigFootprintsCoadd = []
1855  ignoreMask = self.getBadPixelMask()
1856  for index, (clippedSpans, visitFootprints) in enumerate(zip(clipList, detectionFootprints)):
1857  maskVisitDet = afwImage.MaskX(coaddBBox, 0x0)
1858  for footprint in visitFootprints.getFootprints():
1859  footprint.spans.setMask(maskVisitDet, maskDetValue)
1860 
1861  # build a mask of clipped footprints that are in this visit
1862  clippedFootprintsVisit = []
1863  for foot, clipIndex in zip(clipFootprints, clipIndices):
1864  if index not in clipIndex:
1865  continue
1866  clippedFootprintsVisit.append(foot)
1867  maskVisitClip = maskVisitDet.Factory(maskVisitDet.getBBox(afwImage.PARENT))
1868  afwDet.setMaskFromFootprintList(maskVisitClip, clippedFootprintsVisit, maskClipValue)
1869 
1870  bigFootprintsVisit = []
1871  for foot in visitFootprints.getFootprints():
1872  if foot.getArea() < self.config.minBigOverlap:
1873  continue
1874  nCount = countMaskFromFootprint(maskVisitClip, foot, maskClipValue, ignoreMask)
1875  if nCount > self.config.minBigOverlap:
1876  bigFootprintsVisit.append(foot)
1877  bigFootprintsCoadd.append(foot)
1878 
1879  for footprint in bigFootprintsVisit:
1880  clippedSpans["CLIPPED"].append(footprint.spans)
1881 
1882  return bigFootprintsCoadd
1883 
1884 

◆ run()

def lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask.run (   self,
  skyInfo,
  tempExpRefList,
  imageScalerList,
  weightList,
args,
**  kwargs 
)
Assemble the coadd for a region.

Compute the difference of coadds created with and without outlier
rejection to identify coadd pixels that have outlier values in some
individual visits.
Detect clipped regions on the difference image and mark these regions
on the one or two individual coaddTempExps where they occur if there
is significant overlap between the clipped region and a source. This
leaves us with a set of footprints from the difference image that have
been identified as having occured on just one or two individual visits.
However, these footprints were generated from a difference image. It
is conceivable for a large diffuse source to have become broken up
into multiple footprints acrosss the coadd difference in this process.
Determine the clipped region from all overlapping footprints from the
detected sources in each visit - these are big footprints.
Combine the small and big clipped footprints and mark them on a new
bad mask plane.
Generate the coadd using `AssembleCoaddTask.run` without outlier
removal. Clipped footprints will no longer make it into the coadd
because they are marked in the new bad mask plane.

Notes
-----
args and kwargs are passed but ignored in order to match the call
signature expected by the parent task.

Definition at line 1591 of file assembleCoadd.py.

1591  def run(self, skyInfo, tempExpRefList, imageScalerList, weightList, *args, **kwargs):
1592  """Assemble the coadd for a region.
1593 
1594  Compute the difference of coadds created with and without outlier
1595  rejection to identify coadd pixels that have outlier values in some
1596  individual visits.
1597  Detect clipped regions on the difference image and mark these regions
1598  on the one or two individual coaddTempExps where they occur if there
1599  is significant overlap between the clipped region and a source. This
1600  leaves us with a set of footprints from the difference image that have
1601  been identified as having occured on just one or two individual visits.
1602  However, these footprints were generated from a difference image. It
1603  is conceivable for a large diffuse source to have become broken up
1604  into multiple footprints acrosss the coadd difference in this process.
1605  Determine the clipped region from all overlapping footprints from the
1606  detected sources in each visit - these are big footprints.
1607  Combine the small and big clipped footprints and mark them on a new
1608  bad mask plane.
1609  Generate the coadd using `AssembleCoaddTask.run` without outlier
1610  removal. Clipped footprints will no longer make it into the coadd
1611  because they are marked in the new bad mask plane.
1612 
1613  Notes
1614  -----
1615  args and kwargs are passed but ignored in order to match the call
1616  signature expected by the parent task.
1617  """
1618  exp = self.buildDifferenceImage(skyInfo, tempExpRefList, imageScalerList, weightList)
1619  mask = exp.getMaskedImage().getMask()
1620  mask.addMaskPlane("CLIPPED")
1621 
1622  result = self.detectClip(exp, tempExpRefList)
1623 
1624  self.log.info('Found %d clipped objects', len(result.clipFootprints))
1625 
1626  maskClipValue = mask.getPlaneBitMask("CLIPPED")
1627  maskDetValue = mask.getPlaneBitMask("DETECTED") | mask.getPlaneBitMask("DETECTED_NEGATIVE")
1628  # Append big footprints from individual Warps to result.clipSpans
1629  bigFootprints = self.detectClipBig(result.clipSpans, result.clipFootprints, result.clipIndices,
1630  result.detectionFootprints, maskClipValue, maskDetValue,
1631  exp.getBBox())
1632  # Create mask of the current clipped footprints
1633  maskClip = mask.Factory(mask.getBBox(afwImage.PARENT))
1634  afwDet.setMaskFromFootprintList(maskClip, result.clipFootprints, maskClipValue)
1635 
1636  maskClipBig = maskClip.Factory(mask.getBBox(afwImage.PARENT))
1637  afwDet.setMaskFromFootprintList(maskClipBig, bigFootprints, maskClipValue)
1638  maskClip |= maskClipBig
1639 
1640  # Assemble coadd from base class, but ignoring CLIPPED pixels
1641  badMaskPlanes = self.config.badMaskPlanes[:]
1642  badMaskPlanes.append("CLIPPED")
1643  badPixelMask = afwImage.Mask.getPlaneBitMask(badMaskPlanes)
1644  return AssembleCoaddTask.run(self, skyInfo, tempExpRefList, imageScalerList, weightList,
1645  result.clipSpans, mask=badPixelMask)
1646 
def run(self, skyInfo, tempExpRefList, imageScalerList, weightList, altMaskList=None, mask=None, supplementaryData=None)

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.assembleCoadd.SafeClipAssembleCoaddTask.ConfigClass
static

Definition at line 1581 of file assembleCoadd.py.


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