Coverage for python/lsst/faro/base/CatalogSummaryBase.py: 82%
17 statements
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-20 01:48 -0700
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-20 01:48 -0700
1# This file is part of faro.
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/>.
22from lsst.verify.tasks import MetricTask, MetricConfig, MetricConnections
23import lsst.pipe.base as pipeBase
24import lsst.pex.config as pexConfig
26from .BaseSubTasks import NumpySummaryTask
28__all__ = (
29 "CatalogSummaryBaseConnections",
30 "CatalogSummaryBaseConfig",
31 "CatalogSummaryBaseTask",
32)
35# Dimensions of the Connections class define the iterations of runQuantum
36class CatalogSummaryBaseConnections(
37 MetricConnections,
38 defaultTemplates={"agg_name": None},
39 dimensions=("band", "tract", "instrument", "skymap"),
40):
41 # Make this an LSST verify Measurement
42 measurement = pipeBase.connectionTypes.Output(
43 doc="{agg_name} {package}_{metric}.",
44 dimensions=("instrument", "tract", "band"),
45 storageClass="MetricValue",
46 name="metricvalue_{agg_name}_{package}_{metric}",
47 )
50class CatalogSummaryBaseConfig(
51 MetricConfig, pipelineConnections=CatalogSummaryBaseConnections
52):
53 agg = pexConfig.ConfigurableField(
54 # This task is meant to make measurements of various types.
55 # The default task is, therefore, a bit of a place holder.
56 # It is expected that this will be overridden in the pipeline
57 # definition in most cases.
58 target=NumpySummaryTask,
59 doc="Numpy aggregation task",
60 )
63class CatalogSummaryBaseTask(MetricTask):
65 ConfigClass = CatalogSummaryBaseConfig
66 _DefaultName = "catalogSummaryBaseTask"
68 def __init__(self, config, *args, **kwargs):
69 super().__init__(*args, config=config, **kwargs)
70 self.makeSubtask("agg")
72 def run(self, measurements):
73 return self.agg.run(
74 measurements,
75 self.config.connections.agg_name,
76 self.config.connections.package,
77 self.config.connections.metric,
78 )