Skip to content

Commit 8ca438f

Browse files
committed
Add hist plotting to calexpMetrics
1 parent 6face5b commit 8ca438f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

python/lsst/analysis/tools/atools/calexpMetrics.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2121
from __future__ import annotations
2222

23-
__all__ = ("CalexpSummaryMetrics",)
23+
__all__ = (
24+
"CalexpSummaryMetrics",
25+
"CalexpMetricHists",
26+
)
2427

28+
from lsst.pex.config import DictField
29+
30+
from ..actions.plot import HistPanel, HistPlot
31+
from ..actions.vector import BandSelector, LoadVector
2532
from ..interfaces import AnalysisTool
2633

2734

@@ -77,3 +84,26 @@ def setDefaults(self):
7784

7885
self.prep.keysToLoad = list(self._units.keys())
7986
self.produce.metric.units = self._units
87+
88+
89+
class CalexpMetricHists(AnalysisTool):
90+
"""
91+
Class to generate histograms of metrics extracted from a Metrics Table.
92+
One plot per band.
93+
"""
94+
95+
parameterizedBand: bool = False
96+
metrics = DictField[str, str](doc="The metrics to plot and their respective labels.")
97+
98+
def setDefaults(self):
99+
super().setDefaults()
100+
101+
# Band is passed as a kwarg from the calling task.
102+
self.prep.selectors.bandSelector = BandSelector()
103+
self.produce.plot = HistPlot()
104+
105+
def finalize(self):
106+
107+
for metric, label in self.metrics.items():
108+
setattr(self.process.buildActions, metric, LoadVector(vectorKey=metric))
109+
self.produce.plot.panels[metric] = HistPanel(hists={metric: "Number of calexps"}, label=label)

0 commit comments

Comments
 (0)