Coverage for tests/test_camera.py: 47%
Shortcuts 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
Shortcuts 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#
4# Copyright 2008-2016 AURA/LSST.
5#
6# This product includes software developed by the
7# LSST Project (http://www.lsst.org/).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the LSST License Statement and
20# the GNU General Public License along with this program. If not,
21# see <https://www.lsstcorp.org/LegalNotices/>.
22#
23import unittest
24from collections import namedtuple
26import lsst.utils.tests
27from lsst.afw.image import Filter
28from lsst.obs.hsc import HscMapper
31class CameraTestCase(lsst.utils.tests.TestCase):
33 def setUp(self):
34 self.mapper = HscMapper(root=".", calibRoot=".")
35 self.camera = self.mapper.camera
37 def tearDown(self):
38 del self.camera
39 del self.mapper
41 def testName(self):
42 self.assertEqual(self.camera.getName(), "HSC")
44 def testNumCcds(self):
45 self.assertEqual(len(list(self.camera.getIdIter())), 112)
47 def testCcdSize(self):
48 for ccd in self.camera:
49 self.assertEqual(ccd.getBBox().getWidth(), 2048)
50 self.assertEqual(ccd.getBBox().getHeight(), 4176)
52 def testFilters(self):
53 # Check that the mapper has defined some standard filters.
54 # Note that this list is not intended to be comprehensive -- we
55 # anticipate that more filters can be added without causing the test
56 # to break -- but captures the standard HSC broad-band filters.
57 FilterName = namedtuple("FilterName", ["alias", "canonical"])
58 filterNames = (
59 FilterName(alias="HSC-G", canonical="g"),
60 FilterName(alias="HSC-R", canonical="r"),
61 FilterName(alias="HSC-I", canonical="i"),
62 FilterName(alias="HSC-Z", canonical="z"),
63 FilterName(alias="HSC-Y", canonical="y"),
64 FilterName(alias="unknown", canonical="unknown")
65 )
67 for filterName in filterNames:
68 self.assertIn(filterName.alias, self.mapper.filters)
69 self.assertEqual(Filter(filterName.alias).getCanonicalName(), filterName.canonical)
72class TestMemory(lsst.utils.tests.MemoryTestCase):
73 def setUp(self):
74 HscMapper.clearCache()
75 lsst.utils.tests.MemoryTestCase.setUp(self)
78def setup_module(module):
79 lsst.utils.tests.init()
82if __name__ == "__main__": 82 ↛ 83line 82 didn't jump to line 83, because the condition on line 82 was never true
83 lsst.utils.tests.init()
84 unittest.main()