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 

27import lsst.obs.lsst.gen3 

28 

29testDataPackage = "obs_lsst" 

30try: 

31 testDataDirectory = lsst.utils.getPackageDir(testDataPackage) 

32except LookupError: 

33 testDataDirectory = None 

34 

35 

36class ConvertGen2To3TestCase(convertTests.ConvertGen2To3TestCase): 

37 detectorKey = "detector" 

38 exposureKey = "expId" 

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

40 "config", "convert2to3Config.py") 

41 

42 def setUp(self): 

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

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

45 

46 self.gen2root = rawpath 

47 if os.path.exists(calibpath): 

48 self.gen2calib = calibpath 

49 

50 super().setUp() 

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

52 

53 

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

55 instrumentName = "LATISS" 

56 instrumentDir = "latiss" 

57 instrumentClass = "lsst.obs.lsst.gen3.instrument.LatissInstrument" 

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

59 "instrument": instrumentName}] 

60 

61 

62class Ts8Gen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

63 

64 instrumentName = "LSST-TS8" 

65 instrumentDir = "ts8" 

66 instrumentClass = "lsst.obs.lsst.gen3.instrument.Ts8Instrument" 

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

68 "instrument": instrumentName}] 

69 

70 

71class Ts3Gen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

72 

73 instrumentName = "LSST-TS3" 

74 instrumentDir = "ts3" 

75 instrumentClass = "lsst.obs.lsst.gen3.instrument.Ts3Instrument" 

76 

77 

78class UcdCamGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

79 

80 instrumentName = "LSST-UCDCam" 

81 instrumentDir = "ucd" 

82 instrumentClass = "lsst.obs.lsst.gen3.instrument.UcdCamInstrument" 

83 

84 

85class PhosimGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

86 

87 instrumentName = "PhoSim" 

88 instrumentDir = "phosim" 

89 instrumentClass = "lsst.obs.lsst.gen3.instrument.PhosimInstrument" 

90 

91 

92class ImsimGen2To3TestCase(ConvertGen2To3TestCase, lsst.utils.tests.TestCase): 

93 

94 instrumentName = "LSST-ImSim" 

95 instrumentDir = "imsim" 

96 instrumentClass = "lsst.obs.lsst.gen3.instrument.ImsimInstrument" 

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

98 "instrument": instrumentName}] 

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

100 "instrument": instrumentName}] 

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

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

103 

104 

105def setup_module(module): 

106 lsst.utils.tests.init() 

107 

108 

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

110 lsst.utils.tests.init() 

111 unittest.main()