From 2800e60d1b180af88cb56bb3dba2554b14e41964 Mon Sep 17 00:00:00 2001 From: Yusra AlSayyad Date: Thu, 21 Sep 2017 17:36:43 -0400 Subject: [PATCH] Make coadd template warp type configurable Use `--config getTemplate.warpType=psfMatched` to get PSF-matched coadds as templates. --- python/lsst/ip/diffim/getTemplate.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/python/lsst/ip/diffim/getTemplate.py b/python/lsst/ip/diffim/getTemplate.py index f051d7cd..ce387d08 100644 --- a/python/lsst/ip/diffim/getTemplate.py +++ b/python/lsst/ip/diffim/getTemplate.py @@ -43,6 +43,11 @@ class GetCoaddAsTemplateConfig(pexConfig.Config): dtype=str, default="deep", ) + warpType = pexConfig.Field( + doc="Warp type of the coadd template: one of 'direct' or 'psfMatched'", + dtype=str, + default="direct", + ) class GetCoaddAsTemplateTask(pipeBase.Task): @@ -100,7 +105,7 @@ def run(self, exposure, sensorRef, templateIdList=None): patchSubBBox = patchInfo.getOuterBBox() patchSubBBox.clip(coaddBBox) patchArgDict = dict( - datasetType=self.config.coaddName + "Coadd_sub", + datasetType=self.getCoaddDatasetName() + "_sub", bbox=patchSubBBox, tract=tractInfo.getId(), patch="%s,%s" % (patchInfo.getIndex()[0], patchInfo.getIndex()[1]), @@ -135,6 +140,19 @@ def run(self, exposure, sensorRef, templateIdList=None): return pipeBase.Struct(exposure=coaddExposure, sources=None) + def getCoaddDatasetName(self): + """Return coadd name for given task config + + Returns + ------- + CoaddDatasetName : `string` + + TODO: This nearly duplicates a method in CoaddBaseTask (DM-11985) + """ + warpType = self.config.warpType + suffix = "" if warpType == "direct" else warpType[0].upper() + warpType[1:] + return self.config.coaddName + "Coadd" + suffix + class GetCalexpAsTemplateConfig(pexConfig.Config): doAddCalexpBackground = pexConfig.Field(