|
| | __init__ (self, *args, **kwargs) |
| | runQuantum (self, butlerQC, inputRefs, outputRefs) |
| | convert_outputs_to_future (self, template, coadd_refs, detector, exposureRecord) |
| | getExposures (self, coaddExposureHandles, bbox, skymap, wcs) |
| | run (self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter, visit=None) |
| | checkHighVariance (self, template) |
|
| | warper = afwMath.Warper.fromConfig(self.config.warp) |
| | schema = afwTable.ExposureTable.makeMinimalSchema() |
|
| | _clearUnmappedMaskPlanes (self, mask, planeMap) |
| | _correctVariance (self, template, plateScaleFactor) |
| | _plateScaleFactor (self, coaddHandle, wcs, bbox) |
| | _makeExposureCatalog (self, exposureRefs, dataIds) |
| | _merge (self, maskedImages, bbox, wcs) |
| | _makePsf (self, template, catalog, wcs) |
| | _makeGaussianPsf (self, template) |
Definition at line 247 of file getTemplate.py.
◆ __init__()
| lsst.ip.diffim.getTemplate.GetTemplateTask.__init__ |
( |
| self, |
|
|
* | args, |
|
|
** | kwargs ) |
◆ _checkInputs()
| lsst.ip.diffim.getTemplate.GetTemplateTask._checkInputs |
( |
| dataIds, |
|
|
| coaddExposures ) |
|
staticprotected |
Check that the all the dataIds are from the same band and that
the exposures all have the same photometric calibration.
Parameters
----------
dataIds : `dict` [`int`, `list` [`lsst.daf.butler.DataCoordinate`]]
Record of the tract and patch of each coaddExposure.
coaddExposures : `dict` [`int`, `list` of \
[`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure` or
`lsst.afw.image.Exposure`]]
Coadds to be mosaicked.
Returns
-------
band : `str`
Filter band of all the input exposures.
photoCalib : `lsst.afw.image.PhotoCalib`
Photometric calibration of all of the input exposures.
Raises
------
RuntimeError
Raised if the bands or calibrations of the input exposures are not
all the same.
Definition at line 747 of file getTemplate.py.
◆ _clearUnmappedMaskPlanes()
| lsst.ip.diffim.getTemplate.GetTemplateTask._clearUnmappedMaskPlanes |
( |
| self, |
|
|
| mask, |
|
|
| planeMap ) |
|
protected |
Clear the pixels of every mask plane that conversion would reject.
Parameters
----------
mask : `lsst.afw.image.Mask`
Template mask to modify in place.
planeMap : `dict` [`str`, `lsst.images.MaskPlane`]
Plane map the template will be converted with. The optional
planes of `lsst.images.get_legacy_optional_mask_planes` are kept
as well, since conversion adds them when they have pixels set.
Definition at line 370 of file getTemplate.py.
◆ _correctVariance()
| lsst.ip.diffim.getTemplate.GetTemplateTask._correctVariance |
( |
| self, |
|
|
| template, |
|
|
| plateScaleFactor ) |
|
protected |
Correct the template variance plane for the effects of warping.
Compute a multiplicative correction factor for the template variance
if the plate scale of the coadd's constituent images is different than
the science image the template is being constructed for. This should
only be necessary if the coadd images were from a different instrument
than the science image. If the plate scale of the science instrument is
smaller than the plate scale of the coadd instrument, then the template
pixels will be correlated and the true variance will be higher than the
image pixel noise level would suggest.
Parameters
----------
template : `lsst.afw.image.Exposure`
Assembled template; its variance plane is modified in place.
plateScaleFactor : `float` or `None`
Correction for the change in pixel area, from `_plateScaleFactor`.
Raises
------
RuntimeError
Raised if ``doCorrectVariancePlateScale`` is set but the factor
could not be reconstructed from the coadd inputs.
Definition at line 632 of file getTemplate.py.
◆ _makeExposureCatalog()
| lsst.ip.diffim.getTemplate.GetTemplateTask._makeExposureCatalog |
( |
| self, |
|
|
| exposureRefs, |
|
|
| dataIds ) |
|
protected |
Make an exposure catalog for one tract.
Parameters
----------
exposureRefs : `list` of [`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`]
Exposures to include in the catalog.
dataIds : `list` [`lsst.daf.butler.DataCoordinate`]
Data ids of each of the included exposures; must have "tract" and
"patch" entries.
Returns
-------
images : `dict` [`lsst.afw.image.MaskedImage`]
MaskedImages of each of the input exposures, for warping.
catalog : `lsst.afw.table.ExposureCatalog`
Catalog of metadata for each exposure
totalBox : `lsst.geom.Box2I`
The union of the bounding boxes of all the input exposures.
Definition at line 789 of file getTemplate.py.
◆ _makeGaussianPsf()
| lsst.ip.diffim.getTemplate.GetTemplateTask._makeGaussianPsf |
( |
| self, |
|
|
| template ) |
|
protected |
Return a Gaussian PSF with the width of the template CoaddPsf.
Parameters
----------
template : `lsst.afw.image.Exposure`
Template with the CoaddPsf to approximate. The width is measured
at the average position of the PSF, or averaged over a grid of
positions if the PSF cannot be evaluated there.
Returns
-------
psf : `lsst.afw.detection.GaussianPsf`
Gaussian with the width of the template PSF.
Raises
------
ValueError
Raised if the PSF cannot be evaluated at any grid position.
Definition at line 943 of file getTemplate.py.
◆ _makePsf()
| lsst.ip.diffim.getTemplate.GetTemplateTask._makePsf |
( |
| self, |
|
|
| template, |
|
|
| catalog, |
|
|
| wcs ) |
|
protected |
Return a PSF containing the PSF at each of the input regions.
Note that although this includes all the exposures from the catalog,
the PSF knows which part of the template the inputs came from, so when
evaluated at a given position it will not include inputs that never
went in to those pixels.
Parameters
----------
template : `lsst.afw.image.Exposure`
Generated template the PSF is for.
catalog : `lsst.afw.table.ExposureCatalog`
Catalog of exposures that went into the template that contains all
of the input PSFs.
wcs : `lsst.afw.geom.SkyWcs`
WCS of the template, to warp the PSFs to.
Returns
-------
coaddPsf : `lsst.meas.algorithms.CoaddPsf`
The meta-psf constructed from all of the input catalogs.
Definition at line 908 of file getTemplate.py.
◆ _merge()
| lsst.ip.diffim.getTemplate.GetTemplateTask._merge |
( |
| self, |
|
|
| maskedImages, |
|
|
| bbox, |
|
|
| wcs ) |
|
protected |
Merge the images that came from one tract into one larger image,
ignoring NaN pixels and non-finite variance pixels from individual
exposures.
Parameters
----------
maskedImages : `dict` [`lsst.afw.image.MaskedImage` or
`lsst.afw.image.Exposure`]
Images to be merged into one larger bounding box.
bbox : `lsst.geom.Box2I`
Bounding box defining the image to merge into.
wcs : `lsst.afw.geom.SkyWcs`
WCS of all of the input images to set on the output image.
Returns
-------
merged : `lsst.afw.image.MaskedImage`
Merged image with all of the inputs at their respective bbox
positions.
count : `int`
Count of the number of good pixels (those with positive weights)
in the merged image.
included : `list` [`int`]
List of indexes of patches that were included in the merged
result, to be used to trim the exposure catalog.
Definition at line 834 of file getTemplate.py.
◆ _plateScaleFactor()
| lsst.ip.diffim.getTemplate.GetTemplateTask._plateScaleFactor |
( |
| self, |
|
|
| coaddHandle, |
|
|
| wcs, |
|
|
| bbox ) |
|
protected |
Compute the variance correction for the total change in pixel area
between the coadd's constituent images and the science image.
Parameters
----------
coaddHandle : `lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`
Handle to one of the input coadd patches. Only its ``coaddInputs``
component is read; the pixels are left alone.
wcs : `lsst.afw.geom.SkyWcs`
WCS of the science image the template is being built for.
bbox : `lsst.geom.Box2I`
Bounding box of the template, used only to choose where to
evaluate the science image pixel scale.
Returns
-------
factor : `float` or `None`
The correction factor equivalent to the ratio of the area of a pixel
from the coadd's instrument to the science instrument, or `None` if
this patch carries no input record from which it could be computed.
Definition at line 680 of file getTemplate.py.
◆ checkHighVariance()
| lsst.ip.diffim.getTemplate.GetTemplateTask.checkHighVariance |
( |
| self, |
|
|
| template ) |
Set a mask plane for regions with unusually high variance.
Parameters
----------
template : `lsst.afw.image.Exposure`
The warped template exposure, which will be modified in place.
Definition at line 722 of file getTemplate.py.
◆ convert_outputs_to_future()
| lsst.ip.diffim.getTemplate.GetTemplateTask.convert_outputs_to_future |
( |
| self, |
|
|
| template, |
|
|
| coadd_refs, |
|
|
| detector, |
|
|
| exposureRecord ) |
Convert a template image to DifferenceImage format.
This replaces ``template`` with an `lsst.images.DifferenceImage`
instance and records the coadds contributed to it. The Gaussian PSF
set by `run` is converted to an
`lsst.images.psfs.GaussianPointSpreadFunction`.
Parameters
----------
template : `lsst.afw.image.Exposure`
Template to convert. Its detector is replaced with ``detector``
and its mask is modified in place.
coadd_refs : `list` [`lsst.daf.butler.DatasetRef`]
References to the coadds that may have gone into the template.
May be a superset of the coadds that were used; supplies the
dataset id and RUN collection recorded for each coadd that was.
detector : `lsst.afw.cameraGeom.Detector`
Detector of the science image that the template was built for.
exposureRecord : `lsst.daf.butler.DimensionRecord`
The ``exposure`` record of the observation the template was built
for, which supplies the observation metadata recorded on the
output.
Returns
-------
convertedTemplate : `lsst.images.DifferenceImage`
The converted image.
Raises
------
RuntimeError
Raised if the template has pixels set in a mask plane that
`lsst.images.get_legacy_template_mask_planes` does not map and
``config.raiseOnUndefinedMaskMap`` is True, or if ``coadd_refs``
spans more than one skymap.
Definition at line 304 of file getTemplate.py.
◆ getExposures()
| lsst.ip.diffim.getTemplate.GetTemplateTask.getExposures |
( |
| self, |
|
|
| coaddExposureHandles, |
|
|
| bbox, |
|
|
| skymap, |
|
|
| wcs ) |
Return a data structure containing the coadds that overlap the
specified bbox projected onto the sky, and a corresponding data
structure of their dataIds.
These are the appropriate inputs to this task's `run` method.
The spatial index in the butler registry has generous padding and often
supplies patches near, but not directly overlapping the desired region.
This method filters the inputs so that `run` does not have to read in
all possibly-matching coadd exposures.
Parameters
----------
coaddExposureHandles : `iterable` \
[`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`]
Dataset handles to exposures that might overlap the desired
region.
bbox : `lsst.geom.Box2I`
Template bounding box of the pixel geometry onto which the
coaddExposures will be resampled.
skymap : `lsst.skymap.SkyMap`
Geometry of the tracts and patches the coadds are defined on.
wcs : `lsst.afw.geom.SkyWcs`
Template WCS onto which the coadds will be resampled.
Returns
-------
result : `lsst.pipe.base.Struct`
A struct with attributes:
``coaddExposures``
Dict of coadd exposures that overlap the projected bbox,
indexed on tract id
(`dict` [`int`, `list` [`lsst.daf.butler.DeferredDatasetHandle` of
`lsst.afw.image.Exposure`] ]).
``dataIds``
Dict of data IDs of the coadd exposures that overlap the
projected bbox, indexed on tract id
(`dict` [`int`, `list [`lsst.daf.butler.DataCoordinate`] ]).
Raises
------
NoWorkFound
Raised if no patches overlap the input detector bbox, or the input
WCS is None.
Definition at line 393 of file getTemplate.py.
◆ run()
| lsst.ip.diffim.getTemplate.GetTemplateTask.run |
( |
| self, |
|
|
* | , |
|
|
| coaddExposureHandles, |
|
|
| bbox, |
|
|
| wcs, |
|
|
| dataIds, |
|
|
| physical_filter, |
|
|
| visit = None ) |
Warp coadds from multiple tracts and patches to form a template to
subtract from a science image.
Tract and patch overlap regions are combined by a variance-weighted
average, and the variance planes are combined with the same weights,
not added in quadrature; the overlap regions are not statistically
independent, because they're derived from the same original data.
The PSF of the template is a Gaussian with the same width as the
CoaddPsf evaluated at the center of the detector.
Parameters
----------
coaddExposureHandles : `dict` [`int`, `list` of \
[`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`]]
Coadds to be mosaicked, indexed on tract id.
bbox : `lsst.geom.Box2I`
Input Bounding box of the detector geometry onto which to
resample the ``coaddExposureHandles``. The output template bbox
will be grown by ``templateBorderSize``.
wcs : `lsst.afw.geom.SkyWcs`
Template WCS onto which to resample the ``coaddExposureHandles``.
dataIds : `dict` [`int`, `list` [`lsst.daf.butler.DataCoordinate`]]
Record of the tract and patch of each coaddExposure, indexed on
tract id.
physical_filter : `str`
Physical filter of the science image.
visit : `int`, optional
If supplied, over-write the visit ID in the template's visitInfo
so that downstream source injection tasks can link the template and
science image for the visit.
Returns
-------
result : `lsst.pipe.base.Struct`
A struct with attributes:
``template``
A template coadd exposure assembled out of patches, with
pixels in nJy. Its PSF is a Gaussian approximation to the
CoaddPsf of its inputs (`lsst.afw.image.ExposureF`).
Raises
------
NoWorkFound
If no coadds are found with sufficient un-masked pixels.
Definition at line 480 of file getTemplate.py.
◆ runQuantum()
| lsst.ip.diffim.getTemplate.GetTemplateTask.runQuantum |
( |
| self, |
|
|
| butlerQC, |
|
|
| inputRefs, |
|
|
| outputRefs ) |
◆ _DefaultName
| str lsst.ip.diffim.getTemplate.GetTemplateTask._DefaultName = "getTemplate" |
|
staticprotected |
◆ ConfigClass
| lsst.ip.diffim.getTemplate.GetTemplateTask.ConfigClass = GetTemplateConfig |
|
static |
◆ schema
| lsst.ip.diffim.getTemplate.GetTemplateTask.schema = afwTable.ExposureTable.makeMinimalSchema() |
◆ warper
| lsst.ip.diffim.getTemplate.GetTemplateTask.warper = afwMath.Warper.fromConfig(self.config.warp) |
The documentation for this class was generated from the following file: