From 4cfa7863edf4edb66bb7f452a5e8f1ea920a0e34 Mon Sep 17 00:00:00 2001 From: Hsin-Fang Chiang Date: Wed, 19 Aug 2026 17:21:15 -0700 Subject: [PATCH] Make the template_coadd dataset constrait a pipeline config The default is not using template_coadd datasets to constrain the initial butler query at graph generation. It would be convenient to configure it in a pipeline. --- python/lsst/ip/diffim/getTemplate.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/python/lsst/ip/diffim/getTemplate.py b/python/lsst/ip/diffim/getTemplate.py index 02ba35d5..1aa3d462 100644 --- a/python/lsst/ip/diffim/getTemplate.py +++ b/python/lsst/ip/diffim/getTemplate.py @@ -19,6 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import collections +import dataclasses import numpy as np @@ -86,6 +87,13 @@ class GetTemplateConnections( name="{fakesType}{coaddName}Diff_templateExp{warpTypeSuffix}", ) + def __init__(self, *, config=None): + if config.requireCoaddAtGraphBuild: + self.coaddExposures = dataclasses.replace( + self.coaddExposures, + deferGraphConstraint=False, + ) + class GetTemplateConfig( pipeBase.PipelineTaskConfig, pipelineConnections=GetTemplateConnections @@ -120,6 +128,12 @@ class GetTemplateConfig( doc="Minimum fraction of unmasked pixels needed to set the" " HIGH_VARIANCE mask plane.", ) + requireCoaddAtGraphBuild = pexConfig.Field( + dtype=bool, + default=False, + doc="If True, include the coadd dataset existence in the" + "initial butler query during QuantumGraph generation.", + ) def setDefaults(self): # Use a smaller cache: per SeparableKernel.computeCache, this should