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

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 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/>.
22import lsst.pipe.base as pipeBase
24from lsst.faro.base.CatalogMeasurementBase import (
25 CatalogMeasurementBaseConnections,
26 CatalogMeasurementBaseConfig,
27 CatalogMeasurementBaseTask,
28)
30__all__ = ("VisitMeasurementConfig", "VisitMeasurementTask")
33class VisitMeasurementConnections(
34 CatalogMeasurementBaseConnections,
35 dimensions=("instrument", "visit", "band"),
36 defaultTemplates={"photoCalibName": "calexp.photoCalib", "wcsName": "calexp.wcs"},
37):
39 catalogs = pipeBase.connectionTypes.Input(
40 doc="Source catalogs.",
41 dimensions=("instrument", "visit", "detector", "band"),
42 storageClass="SourceCatalog",
43 name="src",
44 multiple=True,
45 )
47 photoCalibs = pipeBase.connectionTypes.Input(
48 doc="Photometric calibration object.",
49 dimensions=("instrument", "visit", "detector", "band"),
50 storageClass="PhotoCalib",
51 name="{photoCalibName}",
52 multiple=True,
53 )
55 astromCalibs = pipeBase.connectionTypes.Input(
56 doc="WCS for the catalog.",
57 dimensions=("instrument", "visit", "detector", "band"),
58 storageClass="Wcs",
59 name="{wcsName}",
60 multiple=True,
61 )
63 measurement = pipeBase.connectionTypes.Output(
64 doc="Per-visit measurement.",
65 dimensions=("instrument", "visit", "band"),
66 storageClass="MetricValue",
67 name="metricvalue_{package}_{metric}",
68 )
71class VisitMeasurementConfig(
72 CatalogMeasurementBaseConfig, pipelineConnections=VisitMeasurementConnections
73):
74 pass
77class VisitMeasurementTask(CatalogMeasurementBaseTask):
78 ConfigClass = VisitMeasurementConfig
79 _DefaultName = "visitMeasurementTask"
81 def runQuantum(self, butlerQC, inputRefs, outputRefs):
82 inputs = butlerQC.get(inputRefs)
83 inputs["dataIds"] = [
84 butlerQC.registry.expandDataId(c.dataId) for c in inputRefs.catalogs
85 ]
86 outputs = self.run(**inputs)
87 if outputs.measurement is not None:
88 butlerQC.put(outputs, outputRefs)
89 else:
90 self.log.debug(
91 "Skipping measurement of {!r} on {} " "as not applicable.",
92 self,
93 inputRefs,
94 )