lsst.ip.diffim gfb11b3eabb+728cca2e53
Loading...
Searching...
No Matches
lsst.ip.diffim.getTemplate Namespace Reference

Classes

class  GetTemplateConnections
class  GetTemplateTask
class  GetDcrTemplateConnections

Functions

 setDefaults (self)
 checkPatchList (self, patchList)
 getDcrModel (self, patchList, coaddRefs, visitInfo)
 _selectDataRef (coaddRef, tract, patch)

Variables

int _PSF_STAMP_SIGMAS = 5
 output_image_type
type allowed
bool optional = False,
str default = "legacy",
 raiseOnUndefinedMaskMap
 detectorPolygon = geom.Box2D(bbox)
int overlappingArea = 0
 dataIds = collections.defaultdict(list)
 patchList = dict()
 dataId = coaddRef.dataId
 subfilter = dataId["subfilter"]
 patchWcs = skymap[dataId["tract"]].getWcs()
 patchBBox = skymap[dataId["tract"]][dataId["patch"]].getOuterBBox()
 patchCorners = patchWcs.pixelToSky(geom.Box2D(patchBBox).getCorners())
 patchPolygon = afwGeom.Polygon(wcs.skyToPixel(patchCorners))
 coaddExposures = self.getDcrModel(patchList, dcrCoaddExposureHandles, visitInfo)

Function Documentation

◆ _selectDataRef()

_selectDataRef ( coaddRef,
tract,
patch )
protected

Definition at line 1222 of file getTemplate.py.

◆ checkPatchList()

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 1161 of file getTemplate.py.

◆ getDcrModel()

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 1185 of file getTemplate.py.

◆ setDefaults()

setDefaults ( self)

Definition at line 222 of file getTemplate.py.

Variable Documentation

◆ _PSF_STAMP_SIGMAS

int lsst.ip.diffim.getTemplate._PSF_STAMP_SIGMAS = 5
protected

Definition at line 59 of file getTemplate.py.

◆ allowed

type lsst.ip.diffim.getTemplate.allowed
Initial value:
{
"legacy": "Write as a lsst.afw.image.ExposureF.",
"future": "Write as a lsst.images.DifferenceImage.",
},

Definition at line 205 of file getTemplate.py.

◆ coaddExposures

lsst.ip.diffim.getTemplate.coaddExposures = self.getDcrModel(patchList, dcrCoaddExposureHandles, visitInfo)

Definition at line 1158 of file getTemplate.py.

◆ dataId

lsst.ip.diffim.getTemplate.dataId = coaddRef.dataId

Definition at line 1130 of file getTemplate.py.

◆ dataIds

lsst.ip.diffim.getTemplate.dataIds = collections.defaultdict(list)

Definition at line 1127 of file getTemplate.py.

◆ default

str lsst.ip.diffim.getTemplate.default = "legacy",

Definition at line 211 of file getTemplate.py.

◆ detectorPolygon

lsst.ip.diffim.getTemplate.detectorPolygon = geom.Box2D(bbox)
numSubfilters = pexConfig.Field(
    doc="Number of subfilters in the DcrCoadd.",
    dtype=int,
    default=3,
)
effectiveWavelength = pexConfig.Field(
    doc="Effective wavelength of the filter in nm.",
    optional=False,
    dtype=float,
)
bandwidth = pexConfig.Field(
    doc="Bandwidth of the physical filter.",
    optional=False,
    dtype=float,
)

def validate(self):
    if self.effectiveWavelength is None or self.bandwidth is None:
        raise ValueError(
            "The effective wavelength and bandwidth of the physical filter "
            "must be set in the getTemplate config for DCR coadds. "
            "Required until transmission curves are used in DM-13668."
        )


class GetDcrTemplateTask(GetTemplateTask):
ConfigClass = GetDcrTemplateConfig
_DefaultName = "getDcrTemplate"

def runQuantum(self, butlerQC, inputRefs, outputRefs):
    inputs = butlerQC.get(inputRefs)
    detector = inputs.pop("detector")
    bbox = detector.getBBox()
    wcs = inputs.pop("wcs")
    dcrCoaddExposureHandles = inputs.pop("dcrCoadds")
    skymap = inputs.pop("skyMap")
    visitInfo = inputs.pop("visitInfo")
    # This task never converts its output, so the observation metadata
    # that the conversion needs is dropped here.
    inputs.pop("obs_info", None)

    # This should not happen with a properly configured execution context.
    assert not inputs, "runQuantum got more inputs than expected"

    results = self.getExposures(
        dcrCoaddExposureHandles, bbox, skymap, wcs, visitInfo
    )
    physical_filter = butlerQC.quantum.dataId["physical_filter"]
    outputs = self.run(
        coaddExposureHandles=results.coaddExposures,
        bbox=bbox,
        wcs=wcs,
        dataIds=results.dataIds,
        physical_filter=physical_filter,
    )
    butlerQC.put(outputs, outputRefs)

def getExposures(self, dcrCoaddExposureHandles, bbox, skymap, wcs, visitInfo):

Definition at line 1125 of file getTemplate.py.

◆ optional

bool lsst.ip.diffim.getTemplate.optional = False,

Definition at line 210 of file getTemplate.py.

◆ output_image_type

lsst.ip.diffim.getTemplate.output_image_type

Definition at line 84 of file getTemplate.py.

◆ overlappingArea

int lsst.ip.diffim.getTemplate.overlappingArea = 0

Definition at line 1126 of file getTemplate.py.

◆ patchBBox

lsst.ip.diffim.getTemplate.patchBBox = skymap[dataId["tract"]][dataId["patch"]].getOuterBBox()

Definition at line 1133 of file getTemplate.py.

◆ patchCorners

lsst.ip.diffim.getTemplate.patchCorners = patchWcs.pixelToSky(geom.Box2D(patchBBox).getCorners())

Definition at line 1134 of file getTemplate.py.

◆ patchList

lsst.ip.diffim.getTemplate.patchList = dict()

Definition at line 1128 of file getTemplate.py.

◆ patchPolygon

lsst.ip.diffim.getTemplate.patchPolygon = afwGeom.Polygon(wcs.skyToPixel(patchCorners))

Definition at line 1135 of file getTemplate.py.

◆ patchWcs

lsst.ip.diffim.getTemplate.patchWcs = skymap[dataId["tract"]].getWcs()

Definition at line 1132 of file getTemplate.py.

◆ raiseOnUndefinedMaskMap

lsst.ip.diffim.getTemplate.raiseOnUndefinedMaskMap
Initial value:
= pexConfig.Field(
dtype=bool,
default=False,
doc="Raise if the template has pixels set in a mask plane that"
" `lsst.images` does not map? If False, log a warning and drop that"
" plane from the output instead."
" Only used with output_image_type='future'.",
)

Definition at line 213 of file getTemplate.py.

◆ subfilter

lsst.ip.diffim.getTemplate.subfilter = dataId["subfilter"]

Definition at line 1131 of file getTemplate.py.