Coverage for python/lsst/analysis/tools/atools/amplifierCorrelation.py: 38%
37 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-15 02:37 -0700
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-15 02:37 -0700
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 "ImageCorrelationPlot",
25 "OverscanCorrelationPlot",
26)
28from ..actions.plot.matrixPlot import MatrixPlot
29from ..actions.vector import LoadVector
30from ..interfaces import AnalysisTool
33class BaseCorrelationPlot(AnalysisTool):
34 """Base class for correlation plots of amplifier biases."""
36 # Do not iterate over multiple bands in a parameterized manner because this
37 # AnalysisTool does not support band as a name parameter.
38 parameterizedBand: bool = False
40 def setupPlot(self, matrixKey: str, title: str):
41 """
42 Set up a matrix plot action.
44 Parameters
45 ----------
46 matrixKey : `str`
47 Key for the matrix being plotted.
48 title : `str`
49 Title for the plot.
51 Returns
52 -------
53 action : `~lsst.analysis.tools.actions.plot.matrixPlot.MatrixPlot`
54 The resulting plot action.
55 """
56 action = MatrixPlot()
57 action.matrixKey = matrixKey
58 action.component1Key = "ampComp"
59 action.component2Key = "ampName"
60 action.componentGroup1Key = "detectorComp"
61 action.componentGroup2Key = "detector"
62 action.setPositionsAtPixelBoundaries = True
63 action.hideMinorTicks = ["x", "y"]
64 action.tickLabelsFontSize = 6
65 action.title = title
66 action.titleFontSize = 9
67 action.xAxisLabel = "Amplifiers in detector "
68 action.yAxisLabel = "Amplifiers in detector "
69 action.colorbarLabel = "Correlation value"
70 action.colorbarLabelFontSize = 9
71 action.colorbarTickLabelFontSize = 7.5
72 return action
74 def setDefaults(self):
75 super().setDefaults()
77 # Initialize plot with specific parameters.
78 action = self.setupPlot(matrixKey=self.matrixKey, title=self.plotTitle)
80 # Load the relevant columns.
81 for key in (
82 action.matrixKey,
83 action.component1Key,
84 action.component2Key,
85 action.componentGroup1Key,
86 action.componentGroup2Key,
87 ):
88 setattr(self.process.buildActions, key, LoadVector(vectorKey=key))
90 # Provide the plot action to the AnalysisTool.
91 self.produce.plot = action
94class ImageCorrelationPlot(BaseCorrelationPlot):
95 """Plot image correlation of amplifier biases."""
97 matrixKey = "imageCorr"
98 plotTitle = "Image correlations"
101class OverscanCorrelationPlot(BaseCorrelationPlot):
102 """Plot overscan correlation of amplifier biases."""
104 matrixKey = "overscanCorr"
105 plotTitle = "Overscan correlations"