LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes | List of all members
lsst.pipe.tasks.multiBand.MergeSourcesTask Class Reference
Inheritance diagram for lsst.pipe.tasks.multiBand.MergeSourcesTask:
lsst.pipe.tasks.multiBand.MergeDetectionsTask lsst.pipe.tasks.multiBand.MergeMeasurementsTask

Public Member Functions

def getInputSchema
 
def __init__
 
def run
 
def readCatalog
 
def mergeCatalogs
 
def write
 
def writeMetadata
 

Static Public Attributes

 ConfigClass = MergeSourcesConfig
 
 RunnerClass = MergeSourcesRunner
 
 inputDataset = None
 
 outputDataset = None
 
 getSchemaCatalogs = None
 

Private Member Functions

def _makeArgumentParser
 

Static Private Attributes

 _DefaultName = None
 

Detailed Description

A base class for merging source catalogs

Merging detections (MergeDetectionsTask) and merging measurements
(MergeMeasurementsTask) are currently so similar that it makes
sense to re-use the code, in the form of this abstract base class.

Sub-classes should set the following class variables:
* _DefaultName: name of Task
* inputDataset: name of dataset to read
* outputDataset: name of dataset to write
* getSchemaCatalogs to the output of _makeGetSchemaCatalogs(outputDataset)

In addition, sub-classes must implement the mergeCatalogs method.

Definition at line 242 of file multiBand.py.

Constructor & Destructor Documentation

def lsst.pipe.tasks.multiBand.MergeSourcesTask.__init__ (   self,
  butler = None,
  schema = None,
  kwargs 
)
Initialize the task.

Keyword arguments (in addition to those forwarded to CmdLineTask.__init__):
 - schema: the schema of the detection catalogs used as input to this one
 - butler: a butler used to read the input schema from disk, if schema is None

Derived classes should use the getInputSchema() method to handle the additional
arguments and retreive the actual input schema.

Definition at line 285 of file multiBand.py.

286  def __init__(self, butler=None, schema=None, **kwargs):
287  """Initialize the task.
288 
289  Keyword arguments (in addition to those forwarded to CmdLineTask.__init__):
290  - schema: the schema of the detection catalogs used as input to this one
291  - butler: a butler used to read the input schema from disk, if schema is None
292 
293  Derived classes should use the getInputSchema() method to handle the additional
294  arguments and retreive the actual input schema.
295  """
296  CmdLineTask.__init__(self, **kwargs)

Member Function Documentation

def lsst.pipe.tasks.multiBand.MergeSourcesTask._makeArgumentParser (   cls)
private
Create a suitable ArgumentParser

We will use the ArgumentParser to get a provide a list of data
references for patches; the RunnerClass will sort them into lists
of data references for the same patch

Definition at line 265 of file multiBand.py.

266  def _makeArgumentParser(cls):
267  """Create a suitable ArgumentParser
268 
269  We will use the ArgumentParser to get a provide a list of data
270  references for patches; the RunnerClass will sort them into lists
271  of data references for the same patch
272  """
273  parser = ArgumentParser(name=cls._DefaultName)
274  parser.add_id_argument("--id", "deepCoadd_" + cls.inputDataset,
275  ContainerClass=ExistingCoaddDataIdContainer,
276  help="data ID, e.g. --id tract=12345 patch=1,2 filter=g^r^i")
277  return parser
def lsst.pipe.tasks.multiBand.MergeSourcesTask.getInputSchema (   self,
  butler = None,
  schema = None 
)

Definition at line 278 of file multiBand.py.

279  def getInputSchema(self, butler=None, schema=None):
280  if schema is None:
281  assert butler is not None, "Neither butler nor schema specified"
282  schema = butler.get(self.config.coaddName + "Coadd_" + self.inputDataset + "_schema",
283  immediate=True).schema
284  return schema
def lsst.pipe.tasks.multiBand.MergeSourcesTask.mergeCatalogs (   self,
  catalogs,
  patchRef 
)
Merge multiple catalogs

catalogs: dict mapping filter name to source catalog

Returns: merged catalog

Definition at line 317 of file multiBand.py.

318  def mergeCatalogs(self, catalogs, patchRef):
319  """Merge multiple catalogs
320 
321  catalogs: dict mapping filter name to source catalog
322 
323  Returns: merged catalog
324  """
325  raise NotImplementedError()
def lsst.pipe.tasks.multiBand.MergeSourcesTask.readCatalog (   self,
  patchRef 
)
Read input catalog

We read the input dataset provided by the 'inputDataset'
class variable.

Definition at line 306 of file multiBand.py.

307  def readCatalog(self, patchRef):
308  """Read input catalog
309 
310  We read the input dataset provided by the 'inputDataset'
311  class variable.
312  """
313  filterName = patchRef.dataId["filter"]
314  catalog = patchRef.get(self.config.coaddName + "Coadd_" + self.inputDataset, immediate=True)
315  self.log.info("Read %d sources for filter %s: %s" % (len(catalog), filterName, patchRef.dataId))
316  return filterName, catalog
def lsst.pipe.tasks.multiBand.MergeSourcesTask.run (   self,
  patchRefList 
)
Merge coadd sources from multiple bands

patchRefList: list of patch data reference for each filter

Definition at line 297 of file multiBand.py.

298  def run(self, patchRefList):
299  """Merge coadd sources from multiple bands
300 
301  patchRefList: list of patch data reference for each filter
302  """
303  catalogs = dict(self.readCatalog(patchRef) for patchRef in patchRefList)
304  mergedCatalog = self.mergeCatalogs(catalogs, patchRefList[0])
305  self.write(patchRefList[0], mergedCatalog)
def lsst.pipe.tasks.multiBand.MergeSourcesTask.write (   self,
  patchRef,
  catalog 
)
Write the output

We write as the dataset provided by the 'outputDataset'
class variable.

Definition at line 326 of file multiBand.py.

327  def write(self, patchRef, catalog):
328  """Write the output
329 
330  We write as the dataset provided by the 'outputDataset'
331  class variable.
332  """
333  patchRef.put(catalog, self.config.coaddName + "Coadd_" + self.outputDataset)
334  # since the filter isn't actually part of the data ID for the dataset we're saving,
335  # it's confusing to see it in the log message, even if the butler simply ignores it.
336  mergeDataId = patchRef.dataId.copy()
337  del mergeDataId["filter"]
338  self.log.info("Wrote merged catalog: %s" % (mergeDataId,))
def lsst.pipe.tasks.multiBand.MergeSourcesTask.writeMetadata (   self,
  dataRefList 
)
No metadata to write, and not sure how to write it for a list of dataRefs

Definition at line 339 of file multiBand.py.

340  def writeMetadata(self, dataRefList):
341  """No metadata to write, and not sure how to write it for a list of dataRefs"""
342  pass
343 

Member Data Documentation

lsst.pipe.tasks.multiBand.MergeSourcesTask._DefaultName = None
staticprivate

Definition at line 257 of file multiBand.py.

lsst.pipe.tasks.multiBand.MergeSourcesTask.ConfigClass = MergeSourcesConfig
static

Definition at line 258 of file multiBand.py.

lsst.pipe.tasks.multiBand.MergeSourcesTask.getSchemaCatalogs = None
static

Definition at line 262 of file multiBand.py.

lsst.pipe.tasks.multiBand.MergeSourcesTask.inputDataset = None
static

Definition at line 260 of file multiBand.py.

lsst.pipe.tasks.multiBand.MergeSourcesTask.outputDataset = None
static

Definition at line 261 of file multiBand.py.

lsst.pipe.tasks.multiBand.MergeSourcesTask.RunnerClass = MergeSourcesRunner
static

Definition at line 259 of file multiBand.py.


The documentation for this class was generated from the following file: