Skip to content

Commit

Permalink
add unit test for NullSkyModel
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiang87 committed Jul 7, 2019
1 parent b3e9845 commit e04e752
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_skyModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit e04e752

Please sign in to comment.