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 

26from lsst.daf.butler.core.utils import getFullTypeName 

27 

28"""Tests of the Instrument class. 

29""" 

30 

31 

32class DummyCam(Instrument): 

33 

34 filterDefinitions = FilterDefinitionCollection() 

35 

36 @classmethod 

37 def getName(cls): 

38 return "DummyCam" 

39 

40 def getCamera(self): 

41 return None 

42 

43 def register(self, registry): 

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

45 `Registry`. 

46 """ 

47 dataId = {"instrument": self.getName(), "class_name": getFullTypeName(DummyCam)} 

48 registry.insertDimensionData("instrument", dataId) 

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

50 registry.insertDimensionData("physical_filter", 

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

52 for d in (1, 2): 

53 registry.insertDimensionData("detector", 

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

55 

56 def getRawFormatter(self, dataId): 

57 # Docstring inherited fromt Instrument.getRawFormatter. 

58 return None 

59 

60 def writeCuratedCalibrations(self, butler): 

61 pass 

62 

63 def applyConfigOverrides(self, name, config): 

64 pass 

65 

66 

67class InstrumentTestCase(InstrumentTests, unittest.TestCase): 

68 """Test for Instrument. 

69 """ 

70 

71 instrument = DummyCam() 

72 

73 data = InstrumentTestData(name="DummyCam", 

74 nDetectors=2, 

75 firstDetectorName="1", 

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

77 

78 def test_getCamera(self): 

79 """No camera defined in DummyCam""" 

80 return 

81 

82 

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

84 unittest.main()