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