Skip to content
Open
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
12 changes: 10 additions & 2 deletions python/lsst/ip/diffim/getTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import lsst.afw.image as afwImage
import lsst.geom as geom
import lsst.afw.geom as afwGeom
from lsst.afw.image import VisitInfo
import lsst.afw.table as afwTable
from lsst.afw.math._warper import computeWarpedBBox
import lsst.afw.math as afwMath
Expand Down Expand Up @@ -186,6 +187,7 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
wcs=wcs,
dataIds=results.dataIds,
physical_filter=physical_filter,
visit=outputRefs.template.dataId["visit"],
)
butlerQC.put(outputs, outputRefs)

Expand Down Expand Up @@ -276,7 +278,7 @@ def getExposures(self, coaddExposureHandles, bbox, skymap, wcs):
return pipeBase.Struct(coaddExposures=coaddExposures, dataIds=dataIds)

@timeMethod
def run(self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter):
def 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.

Expand Down Expand Up @@ -304,6 +306,10 @@ def run(self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter):
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
-------
Expand Down Expand Up @@ -383,9 +389,11 @@ def run(self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter):

# Set a mask plane for any regions with exceptionally high variance.
self.checkHighVariance(template)
template.setPsf(self._makePsf(template, catalog, wcs))
if visit is not None:
template.getInfo().setVisitInfo(VisitInfo(id=visit))
template.setFilter(afwImage.FilterLabel(band, physical_filter))
template.setPhotoCalib(photoCalib)
template.setPsf(self._makePsf(template, catalog, wcs))
return pipeBase.Struct(template=template)

def checkHighVariance(self, template):
Expand Down
Loading