Hide keyboard shortcuts

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# This file is part of obs_base. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://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 unittest 

23 

24from lsst.obs.base import Instrument, FilterDefinitionCollection 

25from lsst.obs.base.instrument_tests import InstrumentTests, InstrumentTestData 

26 

27"""Tests of the Instrument class. 

28""" 

29 

30 

31class DummyCam(Instrument): 

32 

33 filterDefinitions = FilterDefinitionCollection() 

34 

35 @classmethod 

36 def getName(cls): 

37 return "DummyCam" 

38 

39 def getCamera(self): 

40 return None 

41 

42 def register(self, registry): 

43 """Insert Instrument, physical_filter, and detector entries into a 

44 `Registry`. 

45 """ 

46 dataId = {"instrument": self.getName()} 

47 registry.insertDimensionData("instrument", dataId) 

48 for f in ("dummy_g", "dummy_u"): 

49 registry.insertDimensionData("physical_filter", 

50 dict(dataId, physical_filter=f, abstract_filter=f[-1])) 

51 for d in (1, 2): 

52 registry.insertDimensionData("detector", 

53 dict(dataId, id=d, full_name=str(d))) 

54 

55 def getRawFormatter(self, dataId): 

56 # Docstring inherited fromt Instrument.getRawFormatter. 

57 return None 

58 

59 def writeCuratedCalibrations(self, butler): 

60 pass 

61 

62 def applyConfigOverrides(self, name, config): 

63 pass 

64 

65 

66class InstrumentTestCase(InstrumentTests, unittest.TestCase): 

67 """Test for Instrument. 

68 """ 

69 

70 instrument = DummyCam() 

71 

72 data = InstrumentTestData(name="DummyCam", 

73 nDetectors=2, 

74 firstDetectorName="1", 

75 physical_filters={"dummy_g", "dummy_u"}) 

76 

77 def test_getCamera(self): 

78 """No camera defined in DummyCam""" 

79 return 

80 

81 

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

83 unittest.main()