From a313009e83a1159ba760867ac4e1696e83e90682 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Wed, 22 Jan 2025 14:13:47 -0800 Subject: [PATCH 1/2] Use faster warping configs in getTemplate A smaller cacheSize, longer interpLength, and landczos3 instead of 5 should give us decent results and cuts the `warpExposure` runtime by about half. --- python/lsst/ip/diffim/getTemplate.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/lsst/ip/diffim/getTemplate.py b/python/lsst/ip/diffim/getTemplate.py index ff152798f..a36619e22 100644 --- a/python/lsst/ip/diffim/getTemplate.py +++ b/python/lsst/ip/diffim/getTemplate.py @@ -96,8 +96,15 @@ class GetTemplateConfig(pipeBase.PipelineTaskConfig, ) def setDefaults(self): - self.warp.warpingKernelName = 'lanczos5' - self.coaddPsf.warpingKernelName = 'lanczos5' + # Use a smaller cache: per SeparableKernel.computeCache, this should + # give a warping error of a fraction of a count (these must match). + self.warp.cacheSize = 100000 + self.coaddPsf.cacheSize = self.warp.cacheSize + # The WCS for LSST should be smoothly varying, so we can use a longer + # interpolation length for WCS evaluations. + self.warp.interpLength = 100 + self.warp.warpingKernelName = 'lanczos3' + self.coaddPsf.warpingKernelName = self.warp.warpingKernelName class GetTemplateTask(pipeBase.PipelineTask): From 16f6d3d9cfb5e8f5cebd40dbb0b3634e8baebecb Mon Sep 17 00:00:00 2001 From: Audrey Budlong Date: Tue, 28 Jan 2025 10:56:33 -0800 Subject: [PATCH 2/2] Update test tolerance --- tests/test_getTemplate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_getTemplate.py b/tests/test_getTemplate.py index 5359f4282..88f1941aa 100644 --- a/tests/test_getTemplate.py +++ b/tests/test_getTemplate.py @@ -197,7 +197,7 @@ def _checkPixels(self, template, config, box): # Variance plane ==2 in the original image, but the warped images will # have some structure due to the warping. self.assertImagesAlmostEqual(template.variance, self.exposure[expectedBox].variance, - rtol=0.5, msg="variance planes differ") + rtol=0.55, msg="variance planes differ") # Not checking the mask, as warping changes the sizes of the masks. def testRunOneTractInput(self): @@ -265,7 +265,7 @@ def testMissingPatches(self): no_data = (result.template.mask.array & result.template.mask.getPlaneBitMask("NO_DATA")) != 0 self.assertTrue(all(np.isnan(result.template.image.array[no_data]))) self.assertTrue(all(np.isnan(result.template.variance.array[no_data]))) - self.assertEqual(no_data.sum(), 22118) + self.assertEqual(no_data.sum(), 21548) def setup_module(module):