Skip to content

Commit 35570a7

Browse files
committed
Add unit test for sky backround lumpiness
1 parent 1c1a94b commit 35570a7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/test_computeExposureSummaryStats.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,20 @@ def testComputeExposureSummary(self):
106106

107107
# Compute the background image
108108
bgGridSize = 10
109-
bctrl = afwMath.BackgroundControl(afwMath.Interpolate.NATURAL_SPLINE)
110-
bctrl.setNxSample(int(exposure.getMaskedImage().getWidth()/bgGridSize) + 1)
111-
bctrl.setNySample(int(exposure.getMaskedImage().getHeight()/bgGridSize) + 1)
109+
nx = int(exposure.getMaskedImage().getWidth()/bgGridSize) + 1
110+
ny = int(exposure.getMaskedImage().getHeight()/bgGridSize) + 1
111+
bctrl = afwMath.BackgroundControl(nx, ny)
112+
interpStyle = afwMath.Interpolate.AKIMA_SPLINE
113+
undersampleStyle = afwMath.REDUCE_INTERP_ORDER
114+
approxStyle = afwMath.ApproximateControl.UNKNOWN
115+
approxOrderX = 0
116+
approxOrderY = 0
117+
approxWeighting = False
112118
backobj = afwMath.makeBackground(exposure.getMaskedImage().getImage(), bctrl)
113119
background = afwMath.BackgroundList()
114-
background.append(backobj)
120+
background.append(
121+
(backobj, interpStyle, undersampleStyle, approxStyle, approxOrderX, approxOrderY, approxWeighting)
122+
)
115123

116124
# Configure and run the task
117125
expSummaryTask = ComputeExposureSummaryStatsTask()
@@ -156,6 +164,7 @@ def testComputeExposureSummary(self):
156164
self.assertFloatsAlmostEqual(summary.skyBg, skyMean, rtol=1e-3)
157165
self.assertFloatsAlmostEqual(summary.meanVar, skySigma**2.)
158166

167+
self.assertFloatsAlmostEqual(summary.skyBgLumpiness, 0.47303, atol=1e-5)
159168
self.assertFloatsAlmostEqual(summary.zenithDistance, 30.57112, atol=1e-5)
160169

161170
# Effective exposure time and depth

0 commit comments

Comments
 (0)