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_test. 

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 sys 

24import unittest 

25 

26import lsst.afw.geom 

27import lsst.utils.tests 

28from lsst.utils import getPackageDir 

29from lsst.geom import arcseconds, Extent2I 

30import lsst.obs.base.tests 

31import lsst.obs.test 

32 

33 

34class TestObsTest(lsst.obs.base.tests.ObsTests, lsst.utils.tests.TestCase): 

35 """Run standard obs_base unit tests. 

36 """ 

37 def setUp(self): 

38 product_dir = getPackageDir('obs_test') 

39 data_dir = os.path.join(product_dir, 'data', 'input') 

40 

41 butler = lsst.daf.persistence.Butler(root=data_dir) 

42 mapper = lsst.obs.test.TestMapper(root=data_dir) 

43 dataIds = {'raw': {'visit': 1, 'filter': 'g'}, 

44 'bias': {'visit': 1}, 

45 'flat': {'visit': 1}, 

46 'dark': unittest.SkipTest 

47 } 

48 self.setUp_tests(butler, mapper, dataIds) 

49 

50 ccdExposureId_bits = 41 

51 exposureIds = {'raw': 1, 'bias': 1, 'flat': 1} 

52 filters = {'raw': 'g', 'bias': '_unknown_', 'flat': 'g'} 

53 exptimes = {'raw': 15.0, 'bias': 0.0, 'flat': 0.0} 

54 detectorIds = {'raw': 0, 'bias': 0, 'flat': 0} 

55 detector_names = {'raw': '0', 'bias': '0', 'flat': '0'} 

56 detector_serials = {'raw': '0000011', 'bias': '0000011', 'flat': '0000011'} 

57 dimensions = {'raw': Extent2I(1026, 2000), 

58 'bias': Extent2I(1018, 2000), 

59 'flat': Extent2I(1018, 2000) 

60 } 

61 sky_origin = (79.24521968, -9.702295415) 

62 raw_subsets = (({'level': 'sensor', 'filter': 'g'}, 2), 

63 ({'level': 'sensor', 'visit': 1}, 1), 

64 ({'level': 'filter', 'visit': 1}, 1), 

65 ({'level': 'visit', 'filter': 'g'}, 2) 

66 ) 

67 linearizer_type = unittest.SkipTest 

68 

69 path_to_raw = os.path.join(data_dir, "raw", "raw_v1_fg.fits.gz") 

70 raw_header_wcs = lsst.afw.geom.makeSkyWcs(lsst.afw.fits.readMetadata(path_to_raw)) 

71 

72 self.setUp_butler_get(ccdExposureId_bits=ccdExposureId_bits, 

73 exposureIds=exposureIds, 

74 filters=filters, 

75 exptimes=exptimes, 

76 detectorIds=detectorIds, 

77 detector_names=detector_names, 

78 detector_serials=detector_serials, 

79 dimensions=dimensions, 

80 sky_origin=sky_origin, 

81 raw_subsets=raw_subsets, 

82 linearizer_type=linearizer_type, 

83 raw_header_wcs=raw_header_wcs 

84 ) 

85 

86 keys = set(('filter', 'name', 'patch', 'tract', 'visit', 'pixel_id', 'subfilter', 

87 'fgcmcycle', 'numSubfilters', 'label', 'detector', 'expId', 'subdir')) 

88 query_format = ["visit", "filter"] 

89 queryMetadata = (({'visit': 1}, [(1, 'g')]), 

90 ({'visit': 2}, [(2, 'g')]), 

91 ({'visit': 3}, [(3, 'r')]), 

92 ({'filter': 'g'}, [(1, 'g'), (2, 'g')]), 

93 ({'filter': 'r'}, [(3, 'r')]), 

94 ) 

95 map_python_type = 'lsst.afw.image.DecoratedImageU' 

96 map_cpp_type = 'DecoratedImageU' 

97 map_storage_name = 'FitsStorage' 

98 metadata_output_path = os.path.join('processCcd_metadata', 'v1_fg.yaml') 

99 raw_filename = 'raw_v1_fg.fits.gz' 

100 default_level = 'visit' 

101 raw_levels = (('skyTile', set(['filter'])), 

102 ('filter', set(['filter', 'visit'])), 

103 ('visit', set(['filter', 'visit'])) 

104 ) 

105 self.setUp_mapper(output=data_dir, 

106 path_to_raw=path_to_raw, 

107 keys=keys, 

108 query_format=query_format, 

109 queryMetadata=queryMetadata, 

110 metadata_output_path=metadata_output_path, 

111 map_python_type=map_python_type, 

112 map_cpp_type=map_cpp_type, 

113 map_storage_name=map_storage_name, 

114 raw_filename=raw_filename, 

115 default_level=default_level, 

116 raw_levels=raw_levels, 

117 ) 

118 

119 self.setUp_camera(camera_name='test', 

120 n_detectors=1, 

121 first_detector_name='0', 

122 plate_scale=20 * arcseconds, 

123 ) 

124 

125 super(TestObsTest, self).setUp() 

126 

127 

128class MemoryTester(lsst.utils.tests.MemoryTestCase): 

129 pass 

130 

131 

132def setup_module(module): 

133 lsst.utils.tests.init() 

134 

135 

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

137 setup_module(sys.modules[__name__]) 

138 unittest.main()