|
lsst.ip.diffim gc8f3b5360e+abf5d1f27c
|
Classes | |
| class | GetTemplateConnections |
| class | GetDcrTemplateConnections |
Functions | |
| run (self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter, visit=None) | |
| _correctVariance (self, template, plateScaleFactor) | |
| _plateScaleFactor (self, coaddHandle, wcs, bbox) | |
| checkHighVariance (self, template) | |
| _makeExposureCatalog (self, exposureRefs, dataIds) | |
| _merge (self, maskedImages, bbox, wcs) | |
| _makePsf (self, template, catalog, wcs) | |
| _makeGaussianPsf (self, template) | |
| checkPatchList (self, patchList) | |
| getDcrModel (self, patchList, coaddRefs, visitInfo) | |
| _selectDataRef (coaddRef, tract, patch) | |
Variables | |
| int | _PSF_STAMP_SIGMAS = 5 |
| detectorPolygon = geom.Box2D(bbox) | |
| detectorCorners = wcs.pixelToSky(detectorPolygon.getCorners()) | |
| int | overlappingArea = 0 |
| coaddExposures = collections.defaultdict(list) | |
| dataIds = collections.defaultdict(list) | |
| dataId = coaddRef.dataId | |
| patchWcs = skymap[dataId["tract"]].getWcs() | |
| patchBBox = skymap[dataId["tract"]][dataId["patch"]].getOuterBBox() | |
| patchPolygon = afwGeom.Polygon(geom.Box2D(patchBBox)) | |
| detectorInPatchCoordinates = afwGeom.Polygon(patchWcs.skyToPixel(detectorCorners)) | |
| patchList = dict() | |
| subfilter = dataId["subfilter"] | |
| patchCorners = patchWcs.pixelToSky(geom.Box2D(patchBBox).getCorners()) | |
|
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 486 of file getTemplate.py.
|
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 643 of file getTemplate.py.
|
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 797 of file getTemplate.py.
|
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 762 of file getTemplate.py.
|
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 688 of file getTemplate.py.
|
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 534 of file getTemplate.py.
|
protected |
Definition at line 1066 of file getTemplate.py.
| 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 576 of file getTemplate.py.
| checkPatchList | ( | self, | |
| patchList ) |
Check that all of the DcrModel subfilters are present for each
patch.
Parameters
----------
patchList : `dict`
Dict of the patches containing valid data for each tract.
Raises
------
RuntimeError
If the number of exposures found for a patch does not match the
number of subfilters.
Definition at line 1005 of file getTemplate.py.
| getDcrModel | ( | self, | |
| patchList, | |||
| coaddRefs, | |||
| visitInfo ) |
Build DCR-matched coadds from a list of exposure references.
Parameters
----------
patchList : `dict`
Dict of the patches containing valid data for each tract.
coaddRefs : `list` [`lsst.daf.butler.DeferredDatasetHandle`]
Data references to `~lsst.afw.image.Exposure` representing
DcrModels that overlap the detector.
visitInfo : `lsst.afw.image.VisitInfo`
Metadata for the science image.
Returns
-------
coaddExposures : `list` [`lsst.afw.image.Exposure`]
Coadd exposures that overlap the detector.
Definition at line 1029 of file getTemplate.py.
| 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`
Template Bounding box of the detector geometry onto which to
resample the ``coaddExposureHandles``. Modified in-place to include the
template border.
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 335 of file getTemplate.py.
|
protected |
Definition at line 52 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.coaddExposures = collections.defaultdict(list) |
Definition at line 304 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.dataId = coaddRef.dataId |
Definition at line 308 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.dataIds = collections.defaultdict(list) |
Definition at line 305 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorCorners = wcs.pixelToSky(detectorPolygon.getCorners()) |
Definition at line 302 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorInPatchCoordinates = afwGeom.Polygon(patchWcs.skyToPixel(detectorCorners)) |
Definition at line 316 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorPolygon = geom.Box2D(bbox) |
Definition at line 301 of file getTemplate.py.
| int overlappingArea = 0 |
Definition at line 303 of file getTemplate.py.
Definition at line 310 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchCorners = patchWcs.pixelToSky(geom.Box2D(patchBBox).getCorners()) |
Definition at line 978 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchList = dict() |
Definition at line 972 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchPolygon = afwGeom.Polygon(geom.Box2D(patchBBox)) |
Definition at line 311 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchWcs = skymap[dataId["tract"]].getWcs() |
Definition at line 309 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.subfilter = dataId["subfilter"] |
Definition at line 975 of file getTemplate.py.