Coverage for python/lsst/faro/base/ConfigBase.py: 36%
18 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-01-06 02:59 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2023-01-06 02:59 -0800
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/>.
23from lsst.pex.config import Config, DictField, Field
24from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField
27class MeasurementTaskConfig(Config):
29 selectorActions = ConfigurableActionStructField(
30 doc="Which selectors to use to narrow down the data (independent of band).",
31 default={},
32 )
33 columns = DictField(
34 doc="""Columns required for metric calculation. These are full column names, encompassing all columns
35 in a SourceTable and columns that do not change name with band in an ObjectTable. If per-band columns
36 are required, use `columnsBand` instead.""",
37 keytype=str,
38 itemtype=str,
39 default={}
40 )
41 columnsBand = DictField(
42 doc="""Column suffixes used to identify the required columns for metric calculation. The band name
43 will be prepended to this stub to select the columns of interest. These values are used to select
44 flux columns in an objectTable.""",
45 keytype=str,
46 itemtype=str,
47 default={}
48 )
49 shelveName = Field(
50 doc="""Name of shelve file to persist in-memory objects sent as input to the metric
51 measurement run method. Used for testing, development, and debug work.""",
52 dtype=str,
53 default="",
54 )
56 def _getColumnName(self, keyName, band=None):
57 """Return column name corresponding to keyName if keyName is in columns or columnsBand"""
58 columnsKeysSet = set(self.columns.keys())
59 columnsBandKeysSet = set(self.columnsBand.keys())
60 allKeys = set.union(columnsKeysSet, columnsBandKeysSet)
62 assert (columnsKeysSet.isdisjoint(columnsBandKeysSet)), "duplicate key exists"
63 assert (keyName in allKeys), "Key is not defined in columns"
65 if keyName in columnsKeysSet:
66 columnName = self.columns[keyName]
67 elif keyName in columnsBandKeysSet:
68 columnName = band + '_' + self.columnsBand[keyName]
70 return columnName