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_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 os 

23import unittest 

24 

25import lsst.utils.tests 

26from lsst.obs.base.gen2to3 import convertTests 

27 

28testDataPackage = "obs_lsst" 

29try: 

30 testDataDirectory = lsst.utils.getPackageDir(testDataPackage) 

31except LookupError: 

32 testDataDirectory = None 

33 

34 

35class ConvertGen2To3TestCase(convertTests.ConvertGen2To3TestCase): 

36 detectorKey = "detector" 

37 exposureKey = "expId" 

38 config = os.path.join(os.path.abspath(os.path.dirname(__file__)), 

39 "config", "convert2to3Config.py") 

40 

41 def setUp(self): 

42 rawpath = os.path.join(testDataDirectory, f"data/input/{self.instrumentDir}") 

43 calibpath = os.path.join(testDataDirectory, f"{rawpath}/CALIB") 

44 

45 self.gen2root = rawpath 

46 if os.path.exists(calibpath): 

47 self.gen2calib = calibpath 

48 

49 super().setUp() 

50 self.collections.add(f"calib/{self.instrumentName}") 

51 

52 

53class LatissGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

54 instrumentName = "LATISS" 

55 instrumentDir = "latiss" 

56 instrumentClass = "lsst.obs.lsst.Latiss" 

57 biases = [{"detector": 0, "calibration_label": "gen2/bias_2018-09-21_000", 

58 "instrument": instrumentName}] 

59 

60 

61class TS8Gen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

62 

63 instrumentName = "LSST-TS8" 

64 instrumentDir = "ts8" 

65 instrumentClass = "lsst.obs.lsst.LsstTS8" 

66 biases = [{"detector": 67, "calibration_label": "gen2/bias_2018-07-24_067", 

67 "instrument": instrumentName}] 

68 

69 

70class TS3Gen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

71 

72 instrumentName = "LSST-TS3" 

73 instrumentDir = "ts3" 

74 instrumentClass = "lsst.obs.lsst.LsstTS3" 

75 

76 

77class UCDCamGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

78 

79 instrumentName = "LSST-UCDCam" 

80 instrumentDir = "ucd" 

81 instrumentClass = "lsst.obs.lsst.LsstUCDCam" 

82 

83 

84class PhoSimGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

85 

86 instrumentName = "LSST-PhoSim" 

87 instrumentDir = "phosim" 

88 instrumentClass = "lsst.obs.lsst.LsstPhoSim" 

89 

90 

91class ImSimGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

92 

93 instrumentName = "LSST-ImSim" 

94 instrumentDir = "imsim" 

95 instrumentClass = "lsst.obs.lsst.LsstImSim" 

96 biases = [{"detector": 42, "calibration_label": "gen2/bias_2022-01-01_042", 

97 "instrument": instrumentName}] 

98 darks = [{"detector": 42, "calibration_label": "gen2/dark_2022-01-01_042", 

99 "instrument": instrumentName}] 

100 flats = [{"detector": 42, "calibration_label": "gen2/flat_2022-08-06_042_i", 

101 "instrument": instrumentName, "physical_filter": "i"}] 

102 

103 

104def setup_module(module): 

105 lsst.utils.tests.init() 

106 

107 

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

109 lsst.utils.tests.init() 

110 unittest.main()