From e04e7524bdfb6f6d807551bf45a237ec02402847 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Sun, 7 Jul 2019 16:43:29 -0700 Subject: [PATCH] add unit test for NullSkyModel --- tests/test_skyModel.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_skyModel.py b/tests/test_skyModel.py index f9d24d8e..6f0f0b61 100644 --- a/tests/test_skyModel.py +++ b/tests/test_skyModel.py @@ -171,5 +171,18 @@ def test_skycounts_function(self): skycounts_persec_u = skycounts_persec('u', 24) self.assertAlmostEqual(skycounts_persec_u.value, self.zp_u) + def test_NullSkyModel(self): + """Test that the NullSkyModel adds zero photons.""" + commands = copy.deepcopy(self.commands) + photParams = desc.imsim.photometricParameters(commands) + null_sky_model = desc.imsim.make_sky_model(self.obs_md, photParams, + disable_sky_model=True) + nx, ny = 30, 30 + image = galsim.Image(nx, ny) + image = null_sky_model.addNoiseAndBackground(image, + photParams=photParams, + detector=self.detector()) + self.assertEqual(0, np.sum(image.array.ravel())) + if __name__ == '__main__': unittest.main()