Coverage for python/lsst/analysis/tools/atools/calibration.py: 35%
63 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-24 11:17 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-24 11:17 +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
23__all__ = (
24 "MedReadNoiseFocalPlanePlot",
25 "PtcGainFP",
26 "PtcNoiseFP",
27 "PtcA00FP",
28 "PtcTurnoffFP",
29 "PtcMaxRawMeansFP",
30 "PtcRowMeanVarianceSlopeFP",
31)
33from ..actions.plot.focalPlanePlot import FocalPlaneGeometryPlot
34from ..actions.vector import LoadVector
35from ..interfaces import AnalysisTool
38class CalibrationTool(AnalysisTool):
39 """Class to generate common calibration metrics for value/scatter
40 quantities.
41 """
43 parameterizedBand: bool = False
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()
52 self.produce.plot = FocalPlaneGeometryPlot()
53 self.produce.plot.statistic = "median"
56class MedReadNoiseFocalPlanePlot(AnalysisTool):
57 """Generates a plot of the focal plane, color-coded according to the
58 median bias read noise on a per-amp basis. The median is across
59 multiple bias exposures.
60 """
62 def setDefaults(self):
63 super().setDefaults()
65 self.process.buildActions.z = LoadVector()
66 self.process.buildActions.z.vectorKey = "biasReadNoise"
67 self.process.buildActions.detector = LoadVector()
68 self.process.buildActions.detector.vectorKey = "detector"
69 self.process.buildActions.amplifier = LoadVector()
70 self.process.buildActions.amplifier.vectorKey = "amplifier"
72 self.produce.plot = FocalPlaneGeometryPlot()
73 self.produce.plot.zAxisLabel = "Med. Readnoise"
74 self.produce.plot.statistic = "median"
77class PtcGainFP(CalibrationTool):
78 def setDefaults(self):
79 super().setDefaults()
80 self.process.buildActions.z.vectorKey = "ptcGain"
81 self.produce.plot.zAxisLabel = "PTC Gain (e-/ADU)"
82 self.produce.metric.newNames = {"z": "PTC_GAIN"}
85class PtcNoiseFP(CalibrationTool):
86 def setDefaults(self):
87 super().setDefaults()
88 self.process.buildActions.z.vectorKey = "ptcNoise"
89 self.produce.plot.zAxisLabel = "PTC Readout Noise (ADU^2)"
90 self.produce.metric.newNames = {"z": "PTC_NOISE"}
93class PtcA00FP(CalibrationTool):
94 def setDefaults(self):
95 super().setDefaults()
96 self.process.buildActions.z.vectorKey = "ptcBfeA00"
97 self.produce.plot.zAxisLabel = "PTC BFE A00 (1/e-)"
98 self.produce.metric.newNames = {"z": "PTC_BFE_A00"}
101class PtcTurnoffFP(CalibrationTool):
102 def setDefaults(self):
103 super().setDefaults()
104 self.process.buildActions.z.vectorKey = "ptcTurnoff"
105 self.produce.plot.zAxisLabel = "PTC turnoff (ADU)"
106 self.produce.metric.newNames = {"z": "PTC_TURNOFF"}
109class PtcMaxRawMeansFP(CalibrationTool):
110 def setDefaults(self):
111 super().setDefaults()
112 self.process.buildActions.z.vectorKey = "ptcMaxRawMeans"
113 self.produce.plot.zAxisLabel = "PTC Maximum of Raw Mean Flux (ADU)"
114 self.produce.metric.newNames = {"z": "PTC_MAX_RAW_MEANS"}
117class PtcRowMeanVarianceSlopeFP(CalibrationTool):
118 def setDefaults(self):
119 super().setDefaults()
120 self.process.buildActions.z.vectorKey = "ptcRowMeanVarianceSlope"
121 self.produce.plot.zAxisLabel = "PTC slope of row means vs variance (e-)"
122 self.produce.metric.newNames = {"z": "PTC_ROW_MEAN_VARIANCE_SLOPE"}