Coverage for tests/test_setCoaddEdgeBits.py: 53%
28 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-10-05 10:09 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-10-05 10:09 +0000
1#
2# LSST Data Management System
3# Copyright 2008, 2009, 2010 LSST Corporation.
4#
5# This product includes software developed by the
6# LSST Project (http://www.lsst.org/).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the LSST License Statement and
19# the GNU General Public License along with this program. If not,
20# see <http://www.lsstcorp.org/LegalNotices/>.
21#
23"""Test lsst.coadd.utils.setCoaddEdgeBits
24"""
25import unittest
27import numpy as np
29import lsst.utils.tests
30import lsst.geom as geom
31import lsst.afw.image as afwImage
32import lsst.coadd.utils as coaddUtils
33from lsst.log import Log
35Log.getLogger("coadd.utils").setLevel(Log.INFO)
38class SetCoaddEdgeBitsTestCase(lsst.utils.tests.TestCase):
39 """A test case for setCoaddEdgeBits
40 """
42 def testRandomMap(self):
43 """Test setCoaddEdgeBits using a random depth map
44 """
45 imDim = geom.Extent2I(50, 55)
46 coaddMask = afwImage.Mask(imDim)
48 np.random.seed(12345)
49 depthMapArray = np.random.randint(0, 3, list((imDim[1], imDim[0]))).astype(np.uint16)
50 depthMap = afwImage.makeImageFromArray(depthMapArray)
52 refCoaddMask = afwImage.Mask(imDim)
53 edgeMask = afwImage.Mask.getPlaneBitMask("NO_DATA")
54 refCoaddMask.array |= np.array(np.where(depthMapArray > 0, 0, edgeMask),
55 dtype=refCoaddMask.array.dtype)
57 coaddUtils.setCoaddEdgeBits(coaddMask, depthMap)
58 self.assertMasksEqual(coaddMask, refCoaddMask)
61class MemoryTester(lsst.utils.tests.MemoryTestCase):
62 pass
65def setup_module(module):
66 lsst.utils.tests.init()
69if __name__ == "__main__": 69 ↛ 70line 69 didn't jump to line 70, because the condition on line 69 was never true
70 lsst.utils.tests.init()
71 unittest.main()