|
lsst.ip.diffim gd25ada3778+8d267d22c2
|
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) | |
| checkPatchList (self, patchList) | |
| getDcrModel (self, patchList, coaddRefs, visitInfo) | |
| _selectDataRef (coaddRef, tract, patch) | |
Variables | |
| 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 462 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 619 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 738 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 664 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 510 of file getTemplate.py.
|
protected |
Definition at line 1001 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 552 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 940 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 964 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 on the template is created by combining the CoaddPsf on each
template image into a meta-CoaddPsf.
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
(`lsst.afw.image.ExposureF`).
Raises
------
NoWorkFound
If no coadds are found with sufficient un-masked pixels.
Definition at line 317 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.coaddExposures = collections.defaultdict(list) |
Definition at line 286 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.dataId = coaddRef.dataId |
Definition at line 290 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.dataIds = collections.defaultdict(list) |
Definition at line 287 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorCorners = wcs.pixelToSky(detectorPolygon.getCorners()) |
Definition at line 284 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorInPatchCoordinates = afwGeom.Polygon(patchWcs.skyToPixel(detectorCorners)) |
Definition at line 298 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.detectorPolygon = geom.Box2D(bbox) |
Definition at line 283 of file getTemplate.py.
| int overlappingArea = 0 |
Definition at line 285 of file getTemplate.py.
Definition at line 292 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchCorners = patchWcs.pixelToSky(geom.Box2D(patchBBox).getCorners()) |
Definition at line 913 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchList = dict() |
Definition at line 907 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchPolygon = afwGeom.Polygon(geom.Box2D(patchBBox)) |
Definition at line 293 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.patchWcs = skymap[dataId["tract"]].getWcs() |
Definition at line 291 of file getTemplate.py.
| lsst.ip.diffim.getTemplate.subfilter = dataId["subfilter"] |
Definition at line 910 of file getTemplate.py.