lsst.afw  14.0-49-g535656444+1
footprintMerge.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 
3 from ._footprintMerge import FootprintMergeList
4 
5 __all__ = [] # only imported for side effects
6 
7 
8 def getMergedSourceCatalog(self, catalogs, filters,
9  peakDist, schema, idFactory, samePeakDist):
10  """Add multiple catalogs and get the SourceCatalog with merged Footprints"""
11  import lsst.afw.table as afwTable
12 
13  table = afwTable.SourceTable.make(schema, idFactory)
14  mergedList = afwTable.SourceCatalog(table)
15 
16  # if peak is not an array, create an array the size of catalogs
17  try:
18  len(samePeakDist)
19  except:
20  samePeakDist = [samePeakDist] * len(catalogs)
21 
22  try:
23  len(peakDist)
24  except:
25  peakDist = [peakDist] * len(catalogs)
26 
27  if len(peakDist) != len(catalogs):
28  raise ValueError("Number of catalogs (%d) does not match length of peakDist (%d)"
29  % (len(catalogs), len(peakDist)))
30 
31  if len(samePeakDist) != len(catalogs):
32  raise ValueError("Number of catalogs (%d) does not match length of samePeakDist (%d)"
33  % (len(catalogs), len(samePeakDist)))
34 
35  if len(filters) != len(catalogs):
36  raise ValueError("Number of catalogs (%d) does not match number of filters (%d)"
37  % (len(catalogs), len(filters)))
38 
39  self.clearCatalog()
40  for cat, filter, dist, sameDist in zip(catalogs, filters, peakDist, samePeakDist):
41  self.addCatalog(table, cat, filter, dist, True, sameDist)
42 
43  self.getFinalSources(mergedList)
44  return mergedList
45 
46 
47 FootprintMergeList.getMergedSourceCatalog = getMergedSourceCatalog
def getMergedSourceCatalog(self, catalogs, filters, peakDist, schema, idFactory, samePeakDist)