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.gen2to3 import TranslatorFactory 

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

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

28 

29"""Tests of the Instrument class. 

30""" 

31 

32 

33class DummyCam(Instrument): 

34 

35 filterDefinitions = FilterDefinitionCollection() 

36 

37 @classmethod 

38 def getName(cls): 

39 return "DummyCam" 

40 

41 def getCamera(self): 

42 return None 

43 

44 def register(self, registry): 

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

46 `Registry`. 

47 """ 

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

49 registry.insertDimensionData("instrument", dataId) 

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

51 registry.insertDimensionData("physical_filter", 

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

53 for d in (1, 2): 

54 registry.insertDimensionData("detector", 

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

56 

57 def getRawFormatter(self, dataId): 

58 # Docstring inherited fromt Instrument.getRawFormatter. 

59 return None 

60 

61 def writeCuratedCalibrations(self, butler): 

62 pass 

63 

64 def applyConfigOverrides(self, name, config): 

65 pass 

66 

67 def makeDataIdTranslatorFactory(self) -> TranslatorFactory: 

68 return TranslatorFactory() 

69 

70 

71class InstrumentTestCase(InstrumentTests, unittest.TestCase): 

72 """Test for Instrument. 

73 """ 

74 

75 instrument = DummyCam() 

76 

77 data = InstrumentTestData(name="DummyCam", 

78 nDetectors=2, 

79 firstDetectorName="1", 

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

81 

82 def test_getCamera(self): 

83 """No camera defined in DummyCam""" 

84 return 

85 

86 

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

88 unittest.main()