Coverage for python/lsst/faro/base/ConfigBase.py: 39%

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

17 statements  

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/>. 

21 

22 

23from lsst.pex.config import Config, DictField 

24from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField 

25 

26 

27class MeasurementTaskConfig(Config): 

28 

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 

47 def _getColumnName(self, keyName, band=None): 

48 """Return column name corresponding to keyName if keyName is in columns or columnsBand""" 

49 columnsKeysSet = set(self.columns.keys()) 

50 columnsBandKeysSet = set(self.columnsBand.keys()) 

51 allKeys = set.union(columnsKeysSet, columnsBandKeysSet) 

52 

53 assert (columnsKeysSet.isdisjoint(columnsBandKeysSet)), "duplicate key exists" 

54 assert (keyName in allKeys), "Key is not defined in columns" 

55 

56 if keyName in columnsKeysSet: 

57 columnName = self.columns[keyName] 

58 elif keyName in columnsBandKeysSet: 

59 columnName = band + '_' + self.columnsBand[keyName] 

60 

61 return columnName