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.obs.hsc import HscMapper
30class CameraTestCase(lsst.utils.tests.TestCase):
32 def setUp(self):
33 self.mapper = HscMapper(root=".", calibRoot=".")
34 self.camera = self.mapper.camera
36 def tearDown(self):
37 del self.camera
38 del self.mapper
40 def testName(self):
41 self.assertEqual(self.camera.getName(), "HSC")
43 def testNumCcds(self):
44 self.assertEqual(len(list(self.camera.getIdIter())), 112)
46 def testCcdSize(self):
47 for ccd in self.camera:
48 self.assertEqual(ccd.getBBox().getWidth(), 2048)
49 self.assertEqual(ccd.getBBox().getHeight(), 4176)
51 def testFilters(self):
52 # Check that the mapper has defined some standard filters.
53 # Note that this list is not intended to be comprehensive -- we
54 # anticipate that more filters can be added without causing the test
55 # to break -- but captures the standard HSC broad-band filters.
56 FilterName = namedtuple("FilterName", ["alias", "canonical"])
57 filterNames = (
58 FilterName(alias="HSC-G", canonical="g"),
59 FilterName(alias="HSC-R", canonical="r"),
60 FilterName(alias="HSC-I", canonical="i"),
61 FilterName(alias="HSC-Z", canonical="z"),
62 FilterName(alias="HSC-Y", canonical="y"),
63 FilterName(alias="unknown", canonical="unknown")
64 )
66 for filterName in filterNames:
67 self.assertIn(filterName.alias, self.mapper.filters)
70class TestMemory(lsst.utils.tests.MemoryTestCase):
71 def setUp(self):
72 HscMapper.clearCache()
73 lsst.utils.tests.MemoryTestCase.setUp(self)
76def setup_module(module):
77 lsst.utils.tests.init()
80if __name__ == "__main__": 80 ↛ 81line 80 didn't jump to line 81, because the condition on line 80 was never true
81 lsst.utils.tests.init()
82 unittest.main()