From 4063c76ccd0809b0a2576b230bea1a056ffb1831 Mon Sep 17 00:00:00 2001 From: Alex Broughton Date: Sun, 15 Dec 2024 14:37:30 -0800 Subject: [PATCH] Add deferrecCharge test cases --- pipelines/_ingredients/cpCti.yaml | 2 +- pipelines/_ingredients/cpCtiLSST.yaml | 2 +- tests/test_deferredCharge.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pipelines/_ingredients/cpCti.yaml b/pipelines/_ingredients/cpCti.yaml index d14bd0c2..44064147 100644 --- a/pipelines/_ingredients/cpCti.yaml +++ b/pipelines/_ingredients/cpCti.yaml @@ -26,6 +26,6 @@ tasks: class: lsst.cp.pipe.CpCtiSolveTask config: connections.inputMeasurements: "cpCtiStatistics" - connections.outputCalib: "cpCtiCalib" + connections.outputCalib: "cpCti" contracts: - cpCtiSolve.connections.inputMeasurements == cpCtiIsr.connections.outputStatistics diff --git a/pipelines/_ingredients/cpCtiLSST.yaml b/pipelines/_ingredients/cpCtiLSST.yaml index 75dda528..822f8475 100644 --- a/pipelines/_ingredients/cpCtiLSST.yaml +++ b/pipelines/_ingredients/cpCtiLSST.yaml @@ -24,6 +24,6 @@ tasks: class: lsst.cp.pipe.CpCtiSolveTask config: connections.inputMeasurements: "cpCtiStatistics" - connections.outputCalib: "cpCtiCalib" + connections.outputCalib: "cpCti" contracts: - cpCtiSolve.connections.inputMeasurements == cpCtiIsr.connections.outputStatistics diff --git a/tests/test_deferredCharge.py b/tests/test_deferredCharge.py index ac6350e0..8ea2e34c 100644 --- a/tests/test_deferredCharge.py +++ b/tests/test_deferredCharge.py @@ -23,6 +23,7 @@ """Test cases for lsst.cp.pipe.deferredCharge.""" import unittest +import numpy import lsst.utils import lsst.utils.tests @@ -277,6 +278,11 @@ def test_task(self): results = self.task.run(self.inputMeasurements, self.camera, self.inputDims) calib = results.outputCalib + + # Check that the signals array is sorted + for ampName in calib.signals.keys(): + assert numpy.all(numpy.diff(calib.signals[ampName]) > 0) + # Check that the result matches expectation. self.assertAlmostEqual(calib.globalCti['C:0,0'], 1.0e-7, 4) self.assertAlmostEqual(calib.driftScale['C:0,0'], 1.8105e-4, 4) @@ -287,6 +293,16 @@ def test_task(self): self.assertEqual(calib.globalCti['C:0,0'], calib.globalCti[ampName]) self.assertEqual(calib.driftScale['C:0,0'], calib.driftScale[ampName]) self.assertEqual(calib.decayTime['C:0,0'], calib.decayTime[ampName]) + self.assertEqual(calib.signals[ampName][-2], calib.serialCtiTurnoff[ampName]) + self.assertEqual(calib.signals[ampName][-1], calib.parallelCtiTurnoff[ampName]) + self.assertEqual( + (calib.signals[ampName][-1] - calib.signals[ampName][-3]) / 2.0, + calib.serialCtiTurnoffSamplingErr[ampName], + ) + self.assertEqual( + calib.signals[ampName][-1] - calib.signals[ampName][-2], + calib.parallelCtiTurnoffSamplingErr[ampName], + ) class TestMemory(lsst.utils.tests.MemoryTestCase):