Coverage for python/lsst/faro/measurement/PatchMeasurement.py : 61%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This product includes software developed by the LSST Project
2# (https://www.lsst.org).
3# See the COPYRIGHT file at the top-level directory of this distribution
4# for details of code ownership.
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <https://www.gnu.org/licenses/>.
19import lsst.pipe.base as pipeBase
20from lsst.verify.tasks import MetricConnections
22from lsst.faro.base.CatalogMeasurementBase import (
23 CatalogMeasurementBaseConfig,
24 CatalogMeasurementBaseTask,
25)
27__all__ = (
28 "PatchMeasurementConnections",
29 "PatchMeasurementConfig",
30 "PatchMeasurementTask",
31)
34class PatchMeasurementConnections(
35 MetricConnections, dimensions=("tract", "patch", "skymap", "band")
36):
38 cat = pipeBase.connectionTypes.Input(
39 doc="Object catalog.",
40 dimensions=("tract", "patch", "skymap", "band"),
41 storageClass="SourceCatalog",
42 name="deepCoadd_forced_src",
43 )
45 measurement = pipeBase.connectionTypes.Output(
46 doc="Per-patch measurement.",
47 dimensions=("tract", "patch", "skymap", "band"),
48 storageClass="MetricValue",
49 name="metricvalue_{package}_{metric}",
50 )
53class PatchMeasurementConfig(
54 CatalogMeasurementBaseConfig, pipelineConnections=PatchMeasurementConnections
55):
56 pass
59class PatchMeasurementTask(CatalogMeasurementBaseTask):
61 ConfigClass = PatchMeasurementConfig
62 _DefaultName = "patchMeasurementTask"
64 def run(self, cat, vIds):
65 return self.measure.run(cat, self.config.connections.metric, vIds)
67 def runQuantum(self, butlerQC, inputRefs, outputRefs):
68 inputs = butlerQC.get(inputRefs)
69 inputs["vIds"] = inputRefs.cat.dataId
70 outputs = self.run(**inputs)
71 if outputs.measurement is not None:
72 butlerQC.put(outputs, outputRefs)
73 else:
74 self.log.debug(
75 "Skipping measurement of {!r} on {} " "as not applicable.",
76 self,
77 inputRefs,
78 )