Coverage for tests/test_setCoaddEdgeBits.py : 52%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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 refCoaddMaskArray = refCoaddMask.getArray()
54 edgeMask = afwImage.Mask.getPlaneBitMask("NO_DATA")
55 refCoaddMaskArray |= np.array(np.where(depthMapArray > 0, 0, edgeMask),
56 dtype=refCoaddMaskArray.dtype)
58 coaddUtils.setCoaddEdgeBits(coaddMask, depthMap)
59 self.assertMasksEqual(coaddMask, refCoaddMask)
62class MemoryTester(lsst.utils.tests.MemoryTestCase):
63 pass
66def setup_module(module):
67 lsst.utils.tests.init()
70if __name__ == "__main__": 70 ↛ 71line 70 didn't jump to line 71, because the condition on line 70 was never true
71 lsst.utils.tests.init()
72 unittest.main()