Coverage for tests / test_setCoaddEdgeBits.py: 48%

25 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-30 08:50 +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# 

22 

23"""Test lsst.coadd.utils.setCoaddEdgeBits 

24""" 

25import unittest 

26 

27import numpy as np 

28 

29import lsst.utils.tests 

30import lsst.geom as geom 

31import lsst.afw.image as afwImage 

32import lsst.coadd.utils as coaddUtils 

33 

34 

35class SetCoaddEdgeBitsTestCase(lsst.utils.tests.TestCase): 

36 """A test case for setCoaddEdgeBits 

37 """ 

38 

39 def testRandomMap(self): 

40 """Test setCoaddEdgeBits using a random depth map 

41 """ 

42 imDim = geom.Extent2I(50, 55) 

43 coaddMask = afwImage.Mask(imDim) 

44 

45 np.random.seed(12345) 

46 depthMapArray = np.random.randint(0, 3, list((imDim[1], imDim[0]))).astype(np.uint16) 

47 depthMap = afwImage.makeImageFromArray(depthMapArray) 

48 

49 refCoaddMask = afwImage.Mask(imDim) 

50 edgeMask = afwImage.Mask.getPlaneBitMask("NO_DATA") 

51 refCoaddMask.array |= np.array(np.where(depthMapArray > 0, 0, edgeMask), 

52 dtype=refCoaddMask.array.dtype) 

53 

54 coaddUtils.setCoaddEdgeBits(coaddMask, depthMap) 

55 self.assertMasksEqual(coaddMask, refCoaddMask) 

56 

57 

58class MemoryTester(lsst.utils.tests.MemoryTestCase): 

59 pass 

60 

61 

62def setup_module(module): 

63 lsst.utils.tests.init() 

64 

65 

66if __name__ == "__main__": 66 ↛ 67line 66 didn't jump to line 67 because the condition on line 66 was never true

67 lsst.utils.tests.init() 

68 unittest.main()