Coverage for python/lsst/pipe/tasks/multiBandUtils.py: 67%

14 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-08-18 12:36 -0700

1# This file is part of pipe_tasks. 

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

21import lsst.afw.table as afwTable 

22 

23from lsst.pex.config import Config, RangeField 

24 

25 

26def _makeGetSchemaCatalogs(datasetSuffix): 

27 """Construct a getSchemaCatalogs instance method 

28 

29 These are identical for most of the classes here, so we'll consolidate 

30 the code. 

31 

32 datasetSuffix: Suffix of dataset name, e.g., "src" for "deepCoadd_src" 

33 """ 

34 

35 def getSchemaCatalogs(self): 

36 """Return a dict of empty catalogs for each catalog dataset produced by this task.""" 

37 src = afwTable.SourceCatalog(self.schema) 

38 if hasattr(self, "algMetadata"): 

39 src.getTable().setMetadata(self.algMetadata) 

40 return {self.config.coaddName + "Coadd_" + datasetSuffix: src} 

41 return getSchemaCatalogs 

42 

43 

44class CullPeaksConfig(Config): 

45 """! 

46 @anchor CullPeaksConfig_ 

47 

48 @brief Configuration for culling garbage peaks after merging footprints. 

49 

50 Peaks may also be culled after detection or during deblending; this configuration object 

51 only deals with culling after merging Footprints. 

52 

53 These cuts are based on three quantities: 

54 - nBands: the number of bands in which the peak was detected 

55 - peakRank: the position of the peak within its family, sorted from brightest to faintest. 

56 - peakRankNormalized: the peak rank divided by the total number of peaks in the family. 

57 

58 The formula that identifie peaks to cull is: 

59 

60 nBands < nBandsSufficient 

61 AND (rank >= rankSufficient) 

62 AND (rank >= rankConsider OR rank >= rankNormalizedConsider) 

63 

64 To disable peak culling, simply set nBandsSufficient=1. 

65 """ 

66 

67 nBandsSufficient = RangeField(dtype=int, default=2, min=1, 

68 doc="Always keep peaks detected in this many bands") 

69 rankSufficient = RangeField(dtype=int, default=20, min=1, 

70 doc="Always keep this many peaks in each family") 

71 rankConsidered = RangeField(dtype=int, default=30, min=1, 

72 doc=("Keep peaks with less than this rank that also match the " 

73 "rankNormalizedConsidered condition.")) 

74 rankNormalizedConsidered = RangeField(dtype=float, default=0.7, min=0.0, 

75 doc=("Keep peaks with less than this normalized rank that" 

76 " also match the rankConsidered condition."))