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 (CatalogMeasurementBaseConfig,
23 CatalogMeasurementBaseTask)
25__all__ = ("PatchMeasurementConnections", "PatchMeasurementConfig", "PatchMeasurementTask")
28class PatchMeasurementConnections(MetricConnections,
29 dimensions=("tract", "patch", "skymap",
30 "band")):
32 cat = pipeBase.connectionTypes.Input(doc="Object catalog.",
33 dimensions=("tract", "patch", "skymap",
34 "band"),
35 storageClass="SourceCatalog",
36 name="deepCoadd_forced_src")
38 measurement = pipeBase.connectionTypes.Output(doc="Per-patch measurement.",
39 dimensions=("tract", "patch", "skymap",
40 "band"),
41 storageClass="MetricValue",
42 name="metricvalue_{package}_{metric}")
45class PatchMeasurementConfig(CatalogMeasurementBaseConfig,
46 pipelineConnections=PatchMeasurementConnections):
47 pass
50class PatchMeasurementTask(CatalogMeasurementBaseTask):
52 ConfigClass = PatchMeasurementConfig
53 _DefaultName = "patchMeasurementTask"
55 def run(self, cat, vIds):
56 return self.measure.run(cat, self.config.connections.metric, vIds)
58 def runQuantum(self, butlerQC, inputRefs, outputRefs):
59 inputs = butlerQC.get(inputRefs)
60 inputs['vIds'] = inputRefs.cat.dataId
61 outputs = self.run(**inputs)
62 if outputs.measurement is not None:
63 butlerQC.put(outputs, outputRefs)
64 else:
65 self.log.debug("Skipping measurement of {!r} on {} "
66 "as not applicable.", self, inputRefs)