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

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 

22"""Unit tests for DECam gen2 to gen3 conversion. 

23""" 

24 

25import itertools 

26import os 

27import unittest 

28 

29import lsst.utils.tests 

30from lsst.obs.base.gen2to3 import convertTests 

31import lsst.obs.decam 

32 

33testDataPackage = "testdata_decam" 

34try: 

35 testDataDirectory = lsst.utils.getPackageDir(testDataPackage) 

36except LookupError: 

37 testDataDirectory = None 

38 

39 

40@unittest.skipIf(testDataDirectory is None, f"{testDataPackage} not setup") 

41class DecamConvertGen2To3TestCase(convertTests.ConvertGen2To3TestCase, 

42 lsst.utils.tests.TestCase): 

43 

44 instrumentClassName = "lsst.obs.decam.DarkEnergyCamera" 

45 

46 def setUp(self): 

47 # NOTE: this test will produce a bunch of "Skipping ingestion for" warnings, 

48 # due to the bias/flat calibRegistry only having the same ccds as the 

49 # raws, even though the files themselves have more. 

50 self.gen2root = os.path.join(testDataDirectory, 'ingested') 

51 self.gen2calib = os.path.join(testDataDirectory, 'calibingested') 

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

53 "config", "convert2to3Config.py") 

54 self.kwargs = {} 

55 

56 detectors = (5, 10, 56, 60) 

57 dates = ('2015-02-18', '2015-03-13') 

58 self.biasName = 'cpBias' 

59 self.biases = [{'detector': detector, 'calibration_label': f"gen2/cpBias_{date}_{detector:03}", 

60 'instrument': 'DECam'} 

61 for detector, date in itertools.product(detectors, dates)] 

62 self.flatName = 'cpFlat' 

63 self.flats = [{'detector': detector, 

64 'calibration_label': f"gen2/cpFlat_{date}_{detector:03}_g", 

65 'instrument': 'DECam', 'physical_filter': 'g DECam SDSS c0001 4720.0 1520.0'} 

66 for detector, date in itertools.product(detectors, dates)] 

67 self.refcats = ['gaia', 'panstarrs'] 

68 super().setUp() 

69 self.collections.add("calib/DECam") 

70 

71 

72def setup_module(module): 

73 lsst.utils.tests.init() 

74 

75 

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

77 lsst.utils.tests.init() 

78 unittest.main()