Coverage for python/lsst/faro/measurement/VisitMeasurement.py : 60%

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__ = ("VisitMeasurementConfig", "VisitMeasurementTask")
30class VisitMeasurementConnections(
31 MetricConnections,
32 dimensions=("instrument", "visit", "band"),
33 defaultTemplates={"photoCalibName": "calexp.photoCalib", "wcsName": "calexp.wcs"},
34):
36 catalogs = pipeBase.connectionTypes.Input(
37 doc="Source catalogs.",
38 dimensions=("instrument", "visit", "detector", "band"),
39 storageClass="SourceCatalog",
40 name="src",
41 multiple=True,
42 )
44 photoCalibs = pipeBase.connectionTypes.Input(
45 doc="Photometric calibration object.",
46 dimensions=("instrument", "visit", "detector", "band"),
47 storageClass="PhotoCalib",
48 name="{photoCalibName}",
49 multiple=True,
50 )
52 astromCalibs = pipeBase.connectionTypes.Input(
53 doc="WCS for the catalog.",
54 dimensions=("instrument", "visit", "detector", "band"),
55 storageClass="Wcs",
56 name="{wcsName}",
57 multiple=True,
58 )
60 measurement = pipeBase.connectionTypes.Output(
61 doc="Per-visit measurement.",
62 dimensions=("instrument", "visit", "band"),
63 storageClass="MetricValue",
64 name="metricvalue_{package}_{metric}",
65 )
68class VisitMeasurementConfig(
69 CatalogMeasurementBaseConfig, pipelineConnections=VisitMeasurementConnections
70):
71 pass
74class VisitMeasurementTask(CatalogMeasurementBaseTask):
75 ConfigClass = VisitMeasurementConfig
76 _DefaultName = "visitMeasurementTask"
78 def runQuantum(self, butlerQC, inputRefs, outputRefs):
79 inputs = butlerQC.get(inputRefs)
80 inputs["dataIds"] = [
81 butlerQC.registry.expandDataId(c.dataId) for c in inputRefs.catalogs
82 ]
83 outputs = self.run(**inputs)
84 if outputs.measurement is not None:
85 butlerQC.put(outputs, outputRefs)
86 else:
87 self.log.debug(
88 "Skipping measurement of {!r} on {} " "as not applicable.",
89 self,
90 inputRefs,
91 )