Coverage for python/lsst/analysis/tools/atools/calibration.py: 33%

67 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-15 13:26 +0000

1# This file is part of analysis_tools. 

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

21from __future__ import annotations 

22 

23__all__ = ( 

24 "MedReadNoiseFocalPlanePlot", 

25 "PtcGainFP", 

26 "PtcNoiseFP", 

27 "PtcA00FP", 

28 "PtcTurnoffFP", 

29 "PtcMaxRawMeansFP", 

30 "PtcRowMeanVarianceSlopeFP", 

31) 

32 

33from ..actions.plot.focalPlanePlot import FocalPlaneGeometryPlot 

34from ..actions.vector import LoadVector 

35from ..interfaces import AnalysisTool 

36 

37 

38class CalibrationTool(AnalysisTool): 

39 """Class to generate common calibration metrics for value/scatter 

40 quantities. 

41 """ 

42 

43 parameterizedBand: bool = False 

44 

45 def setDefaults(self): 

46 self.process.buildActions.x = LoadVector(vectorKey="detector") 

47 self.process.buildActions.y = LoadVector(vectorKey="amplifier") 

48 self.process.buildActions.detector = LoadVector(vectorKey="detector") 

49 self.process.buildActions.amplifier = LoadVector(vectorKey="amplifier") 

50 self.process.buildActions.z = LoadVector() 

51 

52 self.produce.plot = FocalPlaneGeometryPlot() 

53 self.produce.plot.statistic = "median" 

54 self.produce.plot.xAxisLabel = "x (focal plane)" 

55 self.produce.plot.yAxisLabel = "y (focal plane)" 

56 

57 

58class MedReadNoiseFocalPlanePlot(AnalysisTool): 

59 """Generates a plot of the focal plane, color-coded according to the 

60 median bias read noise on a per-amp basis. The median is across 

61 multiple bias exposures. 

62 """ 

63 

64 def setDefaults(self): 

65 super().setDefaults() 

66 

67 self.process.buildActions.z = LoadVector() 

68 self.process.buildActions.z.vectorKey = "biasReadNoise" 

69 self.process.buildActions.detector = LoadVector() 

70 self.process.buildActions.detector.vectorKey = "detector" 

71 self.process.buildActions.amplifier = LoadVector() 

72 self.process.buildActions.amplifier.vectorKey = "amplifier" 

73 

74 self.produce.plot = FocalPlaneGeometryPlot() 

75 self.produce.plot.xAxisLabel = "x (mm)" 

76 self.produce.plot.yAxisLabel = "y (mm)" 

77 self.produce.plot.zAxisLabel = "Med. Readnoise" 

78 self.produce.plot.statistic = "median" 

79 

80 

81class PtcGainFP(CalibrationTool): 

82 def setDefaults(self): 

83 super().setDefaults() 

84 self.process.buildActions.z.vectorKey = "ptcGain" 

85 self.produce.plot.zAxisLabel = "PTC Gain (ADU)" 

86 self.produce.metric.newNames = {"z": "PTC_GAIN"} 

87 

88 

89class PtcNoiseFP(CalibrationTool): 

90 def setDefaults(self): 

91 super().setDefaults() 

92 self.process.buildActions.z.vectorKey = "ptcNoise" 

93 self.produce.plot.zAxisLabel = "PTC Readout Noise (ADU^2)" 

94 self.produce.metric.newNames = {"z": "PTC_NOISE"} 

95 

96 

97class PtcA00FP(CalibrationTool): 

98 def setDefaults(self): 

99 super().setDefaults() 

100 self.process.buildActions.z.vectorKey = "ptcBfeA00" 

101 self.produce.plot.zAxisLabel = "PTC BFE A00 (1/e-)" 

102 self.produce.metric.newNames = {"z": "PTC_BFE_A00"} 

103 

104 

105class PtcTurnoffFP(CalibrationTool): 

106 def setDefaults(self): 

107 super().setDefaults() 

108 self.process.buildActions.z.vectorKey = "ptcTurnoff" 

109 self.produce.plot.zAxisLabel = "PTC turnoff (ADU)" 

110 self.produce.metric.newNames = {"z": "PTC_TURNOFF"} 

111 

112 

113class PtcMaxRawMeansFP(CalibrationTool): 

114 def setDefaults(self): 

115 super().setDefaults() 

116 self.process.buildActions.z.vectorKey = "ptcMaxRawMeans" 

117 self.produce.plot.zAxisLabel = "PTC Maximum of Raw Mean Flux (ADU)" 

118 self.produce.metric.newNames = {"z": "PTC_MAX_RAW_MEANS"} 

119 

120 

121class PtcRowMeanVarianceSlopeFP(CalibrationTool): 

122 def setDefaults(self): 

123 super().setDefaults() 

124 self.process.buildActions.z.vectorKey = "ptcRowMeanVarianceSlope" 

125 self.produce.plot.zAxisLabel = "PTC slope of row means vs variance (e-)" 

126 self.produce.metric.newNames = {"z": "PTC_ROW_MEAN_VARIANCE_SLOPE"}