Coverage for python/lsst/faro/base/ConfigBase.py: 42%
Shortcuts 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
Shortcuts 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/>.
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. Should be all columns in SourceTable contexts,
35 and columns that do not change name with band in ObjectTable contexts""",
36 keytype=str,
37 itemtype=str,
38 default={}
39 )
40 columnsBand = DictField(
41 doc="""Columns required for metric calculation that change with band in ObjectTable contexts""",
42 keytype=str,
43 itemtype=str,
44 default={}
45 )
46 shelveName = Field(
47 doc="""Name of shelve file to persist in-memory objects sent as input to the metric
48 measurement run method. Used for testing, development, and debug work.""",
49 dtype=str,
50 default="",
51 )
53 def _getColumnName(self, keyName, band=None):
54 """Return column name corresponding to keyName if keyName is in columns or columnsBand"""
55 columnsKeysSet = set(self.columns.keys())
56 columnsBandKeysSet = set(self.columnsBand.keys())
57 allKeys = set.union(columnsKeysSet, columnsBandKeysSet)
59 assert (columnsKeysSet.isdisjoint(columnsBandKeysSet)), "duplicate key exists"
60 assert (keyName in allKeys), "Key is not defined in columns"
62 if keyName in columnsKeysSet:
63 columnName = self.columns[keyName]
64 elif keyName in columnsBandKeysSet:
65 columnName = band + '_' + self.columnsBand[keyName]
67 return columnName