Coverage for python/lsst/faro/measurement/TractMeasurement.py : 69%

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__ = (
31 "TractMeasurementConnections",
32 "TractMeasurementConfig",
33 "TractMeasurementTask",
34 "TractMultiBandMeasurementConnections",
35 "TractMultiBandMeasurementConfig",
36 "TractMultiBandMeasurementTask",
37)
40class TractMeasurementConnections(
41 CatalogMeasurementBaseConnections,
42 dimensions=("tract", "skymap", "band"),
43 defaultTemplates={
44 "coaddName": "deepCoadd",
45 "photoCalibName": "deepCoadd_calexp.photoCalib",
46 "wcsName": "deepCoadd_calexp.wcs",
47 },
48):
50 catalogs = pipeBase.connectionTypes.Input(
51 doc="Object catalog.",
52 dimensions=("tract", "patch", "skymap", "band"),
53 storageClass="SourceCatalog",
54 name="deepCoadd_forced_src",
55 multiple=True,
56 )
58 photoCalibs = pipeBase.connectionTypes.Input(
59 doc="Photometric calibration object.",
60 dimensions=("tract", "patch", "skymap", "band"),
61 storageClass="PhotoCalib",
62 name="{photoCalibName}",
63 multiple=True,
64 )
66 astromCalibs = pipeBase.connectionTypes.Input(
67 doc="WCS for the catalog.",
68 dimensions=("tract", "patch", "skymap", "band"),
69 storageClass="Wcs",
70 name="{wcsName}",
71 multiple=True,
72 )
74 measurement = pipeBase.connectionTypes.Output(
75 doc="Per-tract measurement.",
76 dimensions=("tract", "skymap", "band"),
77 storageClass="MetricValue",
78 name="metricvalue_{package}_{metric}",
79 )
82class TractMeasurementConfig(
83 CatalogMeasurementBaseConfig, pipelineConnections=TractMeasurementConnections
84):
85 pass
88class TractMeasurementTask(CatalogMeasurementBaseTask):
90 ConfigClass = TractMeasurementConfig
91 _DefaultName = "tractMeasurementTask"
93 def run(self, catalogs, photoCalibs, astromCalibs, dataIds):
94 return self.measure.run(
95 self.config.connections.metric, catalogs, photoCalibs, astromCalibs, dataIds
96 )
98 def runQuantum(self, butlerQC, inputRefs, outputRefs):
99 inputs = butlerQC.get(inputRefs)
100 inputs["dataIds"] = [
101 butlerQC.registry.expandDataId(cat.dataId) for cat in inputRefs.catalogs
102 ]
103 outputs = self.run(**inputs)
104 if outputs.measurement is not None:
105 butlerQC.put(outputs, outputRefs)
106 else:
107 self.log.debug(
108 "Skipping measurement of {!r} on {} " "as not applicable.",
109 self,
110 inputRefs,
111 )
114class TractMultiBandMeasurementConnections(
115 TractMeasurementConnections,
116 dimensions=("tract", "skymap"),
117 defaultTemplates={
118 "coaddName": "deepCoadd",
119 "photoCalibName": "deepCoadd_calexp.photoCalib",
120 },
121):
123 cat = pipeBase.connectionTypes.Input(
124 doc="Object catalog.",
125 dimensions=("tract", "skymap", "patch", "band"),
126 storageClass="SourceCatalog",
127 name="deepCoadd_forced_src",
128 multiple=True,
129 )
131 photoCalibs = pipeBase.connectionTypes.Input(
132 doc="Photometric calibration object.",
133 dimensions=("tract", "skymap", "patch", "band"),
134 storageClass="PhotoCalib",
135 name="{photoCalibName}",
136 multiple=True,
137 )
139 measurement = pipeBase.connectionTypes.Output(
140 doc="Per-tract measurement.",
141 dimensions=("tract", "skymap"),
142 storageClass="MetricValue",
143 name="metricvalue_{package}_{metric}",
144 )
147class TractMultiBandMeasurementConfig(
148 CatalogMeasurementBaseConfig,
149 pipelineConnections=TractMultiBandMeasurementConnections,
150):
151 pass
154class TractMultiBandMeasurementTask(TractMeasurementTask):
156 ConfigClass = TractMultiBandMeasurementConfig
157 _DefaultName = "tractMultiBandMeasurementTask"