Coverage for python / lsst / meas / extensions / multiprofit / input_config.py: 56%

21 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-24 08:55 +0000

1# This file is part of meas_extensions_multiprofit. 

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 

22import lsst.pex.config as pexConfig 

23from lsst.pex.config.configurableActions import ConfigurableActionField 

24import lsst.pipe.base.connectionTypes as connectionTypes 

25 

26from .catalog_actions import CatalogAction 

27 

28 

29class InputConfig(pexConfig.Config): 

30 """Config for inputs to ConsolidateAstropyTableTask.""" 

31 

32 doc = pexConfig.Field[str](doc="Doc for connection", optional=False) 

33 action = ConfigurableActionField[CatalogAction]( 

34 doc="Action to modify the input table", 

35 default=None, 

36 ) 

37 columns = pexConfig.ListField[str]( 

38 doc="Column names to copy; default of None copies all", optional=True, default=None 

39 ) 

40 column_id = pexConfig.Field[str](doc="ID column to merge", optional=False, default="objectId") 

41 is_multiband = pexConfig.Field[bool](doc="Whether the dataset is multiband or not", default=False) 

42 is_multipatch = pexConfig.Field[bool](doc="Whether the dataset is multipatch or not", default=False) 

43 join_column = pexConfig.Field[str]( 

44 doc="Column to join on if unequal length instead of stacking", default=None, optional=True 

45 ) 

46 storageClass = pexConfig.Field[str](doc="Storage class for DatasetType", default="ArrowAstropy") 

47 

48 def get_connection(self, name: str) -> connectionTypes.Input: 

49 dimensions = ["skymap", "tract"] 

50 if not self.is_multipatch: 

51 dimensions.append("patch") 

52 if not self.is_multiband: 

53 dimensions.append("band") 

54 connection = connectionTypes.Input( 

55 doc=self.doc, 

56 name=name, 

57 storageClass=self.storageClass, 

58 dimensions=dimensions, 

59 multiple=not (self.is_multiband and self.is_multipatch), 

60 deferLoad=self.columns is not None, 

61 ) 

62 return connection