From 24d49d87236e597dbb4231ef3ba347d906ae377d Mon Sep 17 00:00:00 2001 From: Ian Sullivan Date: Fri, 12 Jun 2026 16:16:09 -0700 Subject: [PATCH] Set coaddInputs in getTemplate to record the patches that contributed. --- python/lsst/ip/diffim/getTemplate.py | 4 ++++ tests/test_getTemplate.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/python/lsst/ip/diffim/getTemplate.py b/python/lsst/ip/diffim/getTemplate.py index 2ec7c30a3..02ba35d5b 100644 --- a/python/lsst/ip/diffim/getTemplate.py +++ b/python/lsst/ip/diffim/getTemplate.py @@ -394,6 +394,10 @@ def run(self, *, coaddExposureHandles, bbox, wcs, dataIds, physical_filter, visi template.setFilter(afwImage.FilterLabel(band, physical_filter)) template.setPhotoCalib(photoCalib) template.setPsf(self._makePsf(template, catalog, wcs)) + # Record the input coadd patches as the template's coadd inputs. + coaddInputs = afwImage.CoaddInputs(afwTable.ExposureTable.makeMinimalSchema(), self.schema) + coaddInputs.ccds.extend(catalog, deep=True) + template.getInfo().setCoaddInputs(coaddInputs) return pipeBase.Struct(template=template) def checkHighVariance(self, template): diff --git a/tests/test_getTemplate.py b/tests/test_getTemplate.py index 6e888392c..bad896f58 100644 --- a/tests/test_getTemplate.py +++ b/tests/test_getTemplate.py @@ -191,6 +191,8 @@ def _checkMetadata(self, template, config, box, wcs, nPsfs): self.assertEqual(template.filter.bandLabel, "a") self.assertEqual(template.filter.physicalLabel, "a_test") self.assertEqual(template.psf.getComponentCount(), nPsfs) + self.assertTrue(template.getInfo().hasCoaddInputs()) + self.assertEqual(len(template.getInfo().getCoaddInputs().ccds), nPsfs) def _checkPixels(self, template, config, box): """Check that the pixel values in the template are close to the