Coverage for tests/test_jointcal_decam.py: 41%

Shortcuts 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

43 statements  

1# This file is part of jointcal. 

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 <https://www.gnu.org/licenses/>. 

21 

22import unittest 

23import os 

24 

25from astropy import units as u 

26 

27import lsst.geom 

28import lsst.utils 

29import lsst.pex.exceptions 

30 

31import jointcalTestBase 

32 

33 

34# for MemoryTestCase 

35def setup_module(module): 

36 lsst.utils.tests.init() 

37 

38 

39class JointcalTestDECAM(jointcalTestBase.JointcalTestBase, lsst.utils.tests.TestCase): 

40 """NOTE: the data used in this test has some bad input astrometry 

41 (particularly in visit 176837) so the data coming in to jointcal is of 

42 poor quality. The fitter logs many warnings about not having enough 

43 sources, and not being able to produce a good inverse model for the 

44 WCS output. This data does not represent a good test case for 

45 jointcal's fitter, but may serve as a useful test case for how to fail 

46 on a bad fit. 

47 """ 

48 @classmethod 

49 def setUpClass(cls): 

50 try: 

51 cls.data_dir = lsst.utils.getPackageDir('testdata_jointcal') 

52 except LookupError: 

53 raise unittest.SkipTest("testdata_jointcal not setup") 

54 try: 

55 lsst.utils.getPackageDir('obs_decam') 

56 except LookupError: 

57 raise unittest.SkipTest("obs_decam not setup") 

58 

59 def setUp(self): 

60 # See Readme for an explanation of this empirical value. 

61 self.dist_rms_absolute = 63e-3*u.arcsecond 

62 

63 do_plot = False 

64 

65 # center of the decam validation_data catalog 

66 center = lsst.geom.SpherePoint(150.1191666, 2.20583333, lsst.geom.degrees) 

67 radius = 3*lsst.geom.degrees 

68 

69 input_dir = os.path.join(self.data_dir, 'decam') 

70 all_visits = [176837, 176846] 

71 ccdnums = '^'.join(str(x) for x in (10, 11, 12, 14, 15, 16, 17, 18)) 

72 other_args = ['ccdnum=' + ccdnums, ] 

73 

74 self.setUp_base(center, radius, 

75 input_dir=input_dir, 

76 all_visits=all_visits, 

77 other_args=other_args, 

78 do_plot=do_plot, 

79 log_level="DEBUG") 

80 

81 def test_jointcalTask_2_visits(self): 

82 self.config = lsst.jointcal.jointcal.JointcalConfig() 

83 self.config.astrometryModel = "simple" 

84 self.config.photometryModel = "simpleFlux" 

85 

86 # See Readme for an explanation of these empirical values. 

87 relative_error = 19e-3*u.arcsecond 

88 pa1 = 0.24 

89 metrics = {'astrometry_collected_refStars': 7403, 

90 'photometry_collected_refStars': 147552, 

91 'astrometry_prepared_refStars': 467, 

92 'photometry_prepared_refStars': 4619, 

93 'astrometry_matched_fittedStars': 7839, 

94 'photometry_matched_fittedStars': 7839, 

95 'astrometry_prepared_fittedStars': 702, 

96 'photometry_prepared_fittedStars': 4624, 

97 'astrometry_prepared_ccdImages': 15, 

98 'photometry_prepared_ccdImages': 15, 

99 'astrometry_final_chi2': 2899.20, 

100 'astrometry_final_ndof': 896, 

101 'photometry_final_chi2': 11644.50, 

102 'photometry_final_ndof': 3672, 

103 } 

104 

105 self._testJointcalTask(2, relative_error, self.dist_rms_absolute, pa1, metrics=metrics) 

106 

107 

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

109 pass 

110 

111 

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

113 lsst.utils.tests.init() 

114 unittest.main()