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