Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions python/lsst/ip/diffim/dcrModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from lsst.afw.coord import differentialRefraction
import lsst.afw.image as afwImage
import lsst.geom as geom
import lsst.pipe.base as pipeBase

__all__ = ["DcrModel", "applyDcr", "calculateDcr", "calculateImageParallacticAngle"]

Expand Down Expand Up @@ -471,6 +472,48 @@ def buildMatchedExposure(self, exposure=None,
templateExposure.setPhotoCalib(self.photoCalib)
return templateExposure

def buildMatchedExposureHandle(self, exposure=None, visitInfo=None, bbox=None, mask=None):
"""Create in-memory butler dataset reference containing the DCR-matched
template.

Parameters
----------
exposure : `lsst.afw.image.Exposure`, optional
The input exposure to build a matched template for.
May be omitted if all of the metadata is supplied separately
visitInfo : `lsst.afw.image.VisitInfo`, optional
Metadata for the exposure. Ignored if ``exposure`` is set.
bbox : `lsst.afw.geom.Box2I`, optional
Sub-region of the coadd, or use the entire coadd if not supplied.
mask : `lsst.afw.image.Mask`, optional
reference mask to use for the template image.

Returns
-------
templateExposureHandle: `lsst.pipe.base.InMemoryDatasetHandle`
In-memory butler dataset reference containing the DCR-matched
template.

Raises
------
ValueError
If no `exposure` or `visitInfo` is set.
"""
if exposure is not None:
visitInfo = exposure.visitInfo
elif visitInfo is None:
raise ValueError("Either exposure or visitInfo must be set.")
templateExposure = self.buildMatchedExposure(
exposure=exposure, visitInfo=visitInfo, bbox=bbox, mask=mask
)
templateExposureHandle = pipeBase.InMemoryDatasetHandle(
templateExposure,
storageClass="ExposureF",
copy=False,
photoCalib=self.photoCalib
)
return templateExposureHandle

def conditionDcrModel(self, modelImages, bbox, gain=1.):
"""Average two iterations' solutions to reduce oscillations.

Expand Down
Loading