Skip to content

Commit 99192fb

Browse files
committed
Add hist plotting to calexpMetrics
1 parent 8617a57 commit 99192fb

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

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

Lines changed: 29 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,24 @@ 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+
# Band is passed as a kwarg from the calling task.
100+
self.prep.selectors.bandSelector = BandSelector()
101+
self.produce.plot = HistPlot()
102+
103+
def finalize(self):
104+
105+
for metric, label in self.metrics.items():
106+
setattr(self.process.buildActions, metric, LoadVector(vectorKey=metric))
107+
self.produce.plot.panels[metric] = HistPanel(hists={metric: "Number of calexps"}, label=label)

0 commit comments

Comments
 (0)