Skip to content

Commit c0cccb5

Browse files
committed
Add unittest for disabling summary stats updates
1 parent 6a76617 commit c0cccb5

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

tests/test_computeExposureSummaryStats.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,51 @@ def testComputeExposureSummary(self):
101101
background.append(backobj)
102102

103103
# Configure and run the task
104+
expSummaryTaskNoUpdates = ComputeExposureSummaryStatsTask()
104105
expSummaryTask = ComputeExposureSummaryStatsTask()
105106
# Configure nominal values for effective time calculation
106107
expSummaryTask.config.fiducialZeroPoint = {band: float(zp)}
107108
expSummaryTask.config.fiducialPsfSigma = {band: float(psfSize)}
108109
expSummaryTask.config.fiducialSkyBackground = {band: float(skyMean)}
109-
# Run the task
110+
111+
# Run the task with selective updates
112+
# Do update the basic PSF metrics (i.e. psfSigma, size/shape residuals)
113+
expSummaryTaskNoUpdates.config.doUpdatePsfStats = True
114+
# Do not update the PSF/ApCorr grid-based fidelity metrics
115+
expSummaryTaskNoUpdates.config.psfSampling = None
116+
expSummaryTaskNoUpdates.config.psfGridSampling = None
117+
expSummaryTaskNoUpdates.config.doUpdateWcsStats = False
118+
expSummaryTaskNoUpdates.config.doUpdatePhotoCalibStats = False
119+
expSummaryTaskNoUpdates.config.doUpdateBackgroundStats = False
120+
expSummaryTaskNoUpdates.config.doUpdateMaskedImageStats = False
121+
expSummaryTaskNoUpdates.config.doUpdateEffectiveTimeStats = False
122+
123+
summary = expSummaryTaskNoUpdates.run(exposure, None, background)
124+
# Test the outputs
125+
nan = float("nan")
126+
self.assertTrue(summary.ra, nan)
127+
self.assertTrue(summary.dec, nan)
128+
129+
self.assertFloatsAlmostEqual(summary.psfSigma, psfSize)
130+
self.assertFloatsAlmostEqual(summary.psfIxx, psfSize**2.)
131+
self.assertFloatsAlmostEqual(summary.psfIyy, psfSize**2.)
132+
self.assertFloatsAlmostEqual(summary.psfIxy, 0.0)
133+
self.assertFloatsAlmostEqual(summary.psfArea, 23.088975164455444)
134+
135+
self.assertTrue(summary.psfTraceRadiusDelta, nan)
136+
self.assertTrue(summary.psfApFluxDelta, nan)
137+
self.assertTrue(summary.psfApCorrSigmaScaledDelta, nan)
138+
self.assertTrue(summary.maxDistToNearestPsf, nan)
139+
self.assertTrue(summary.pixelScale, nan)
140+
141+
self.assertTrue(summary.zenithDistance, nan)
142+
self.assertTrue(summary.skyBg, nan)
143+
self.assertTrue(summary.skyNoise, nan)
144+
self.assertTrue(summary.meanVar, nan)
145+
self.assertTrue(summary.zeroPoint, nan)
146+
self.assertTrue(summary.expTime, nan)
147+
148+
# Run the task with updates
110149
summary = expSummaryTask.run(exposure, None, background)
111150

112151
# Test the outputs

0 commit comments

Comments
 (0)