Coverage for tests/test_lsstCam.py: 40%
43 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-08 02:56 -0700
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-08 02:56 -0700
1# This file is part of obs_lsst.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
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 GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22import sys
23import unittest
25import lsst.utils.tests
26from lsst.geom import arcseconds, Extent2I
27import lsst.afw.image
29from lsst.obs.lsst.testHelper import ObsLsstButlerTests, ObsLsstObsBaseOverrides
30from lsst.obs.lsst import LsstCam
33class TestLsstCam(ObsLsstObsBaseOverrides, ObsLsstButlerTests):
34 instrumentDir = "lsstCam"
36 @classmethod
37 def getInstrument(cls):
38 return LsstCam()
40 def setUp(self):
41 dataIds = {'raw': {'exposure': 3019031900001, 'name_in_raft': 'S02', 'raft': 'R10'},
42 'bias': unittest.SkipTest,
43 'flat': unittest.SkipTest,
44 'dark': unittest.SkipTest,
45 }
46 self.setUp_tests(self._butler, dataIds)
48 ccdExposureId_bits = 52
49 exposureIds = {'raw': 3019031900001029,
50 }
51 filters = {'raw': 'unknown',
52 }
53 exptimes = {'raw': 0.0,
54 }
55 detectorIds = {'raw': 29,
56 }
57 detector_names = {'raw': 'R10_S02',
58 }
59 # This name comes from the camera and not from the butler
60 detector_serials = {'raw': 'ITL-3800C-167',
61 }
62 dimensions = {'raw': Extent2I(4608, 4096),
63 }
64 sky_origin = unittest.SkipTest
65 raw_subsets = (({}, 3),
66 ({'physical_filter': 'unknown'}, 2),
67 ({'physical_filter': 'foo'}, 0),
68 ({'exposure': 3019031900001}, 2),
69 ({'exposure': 3019032200002}, 1),
70 ({'exposure': 9999999999999}, 0),
71 ({'physical_filter': 'SDSSi~ND_OD0.5'}, 1),
72 )
73 linearizer_type = unittest.SkipTest
74 self.setUp_butler_get(ccdExposureId_bits=ccdExposureId_bits,
75 exposureIds=exposureIds,
76 filters=filters,
77 exptimes=exptimes,
78 detectorIds=detectorIds,
79 detector_names=detector_names,
80 detector_serials=detector_serials,
81 dimensions=dimensions,
82 sky_origin=sky_origin,
83 raw_subsets=raw_subsets,
84 linearizer_type=linearizer_type
85 )
87 self.raw_filename = '3019031900001-R10-S02-det029.fits'
89 self.setUp_camera(camera_name='LSSTCam',
90 n_detectors=205,
91 first_detector_name='R01_S00',
92 plate_scale=20.0 * arcseconds,
93 )
95 super().setUp()
97 def testObsid(self):
98 """Check that we can retrieve data using the obsid."""
99 dataId = {'exposure': "MC_C_20190319_000001", 'name_in_raft': 'S02',
100 'raft': 'R10'}
101 raw = self.butler.get('raw', dataId)
102 self.assertIsNotNone(raw)
104 # And that we can get just the header
105 md = self.butler.get('raw.metadata', dataId)
106 self.assertEqual(md["TELESCOP"], "LSST")
109class MemoryTester(lsst.utils.tests.MemoryTestCase):
110 pass
113def setup_module(module):
114 lsst.utils.tests.init()
117if __name__ == '__main__': 117 ↛ 118line 117 didn't jump to line 118, because the condition on line 117 was never true
118 setup_module(sys.modules[__name__])
119 unittest.main()