LSSTApplications  16.0-10-g1758552+4,16.0-10-g4f78f78+4,16.0-10-gc1446dd+30,16.0-11-g39ac3c7+2,16.0-13-g066a532+3,16.0-14-g6c7ed55+4,16.0-14-gd373004+3,16.0-15-g072d20e+4,16.0-15-gb461e1a+2,16.0-16-g48c959a+3,16.0-16-g89065d4+2,16.0-16-gd8e3590+4,16.0-19-gb830ed4e+4,16.0-2-g0febb12+20,16.0-2-g9d5294e+53,16.0-2-ga8830df+3,16.0-20-g17d57d5+2,16.0-22-gf7a7fdf+3,16.0-27-g78173a71+3,16.0-3-g324faa9+3,16.0-3-gcfd6c53+51,16.0-3-ge00e371+9,16.0-4-g03cf288+42,16.0-4-g5f3a788+19,16.0-4-ga3eb747+9,16.0-4-gabf74b7+4,16.0-4-gb13d127+3,16.0-5-g6a53317+9,16.0-5-gb3f8a4b+62,16.0-5-gef99c9f+4,16.0-57-g90e7ba260+2,16.0-6-g0838257+3,16.0-6-g9321be7+3,16.0-6-gcbc7b31+3,16.0-6-gf49912c+4,16.0-7-gd2eeba5+12,16.0-8-g21fd5fe+4,16.0-8-g3a9f023+4,16.0-9-g85d1a16+4,master-g7b902255af+4,w.2018.43
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | List of all members
lsst.pipe.tasks.multiBand.MergeSourcesTask Class Reference

A base class for merging source catalogs. More...

Inheritance diagram for lsst.pipe.tasks.multiBand.MergeSourcesTask:
lsst.pipe.tasks.multiBand.MergeDetectionsTask lsst.pipe.tasks.multiBand.MergeMeasurementsTask lsst.pipe.tasks.dcrMultiBand.MergeDcrDetectionsTask lsst.pipe.tasks.dcrMultiBand.MergeDcrMeasurementsTask

Public Member Functions

def getInputSchema (self, butler=None, schema=None)
 Obtain the input schema either directly or froma butler reference. More...
 
def __init__ (self, butler=None, schema=None, kwargs)
 Initialize the task. More...
 
def runDataRef (self, patchRefList)
 Merge coadd sources from multiple bands. More...
 
def readCatalog (self, patchRef)
 Read input catalog. More...
 
def run (self, catalogs, patchRef)
 Merge multiple catalogs. More...
 
def write (self, patchRef, catalog)
 Write the output. More...
 
def writeMetadata (self, dataRefList)
 No metadata to write, and not sure how to write it for a list of dataRefs. More...
 

Static Public Attributes

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

Detailed Description

A base class for merging source catalogs.

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

NB: Do not use this class directly. Instead use one of the child classes that inherit from MergeSourcesTask such as MergeDetectionsTask or MergeMeasurementsTask

Sub-classes should set the following class variables:

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

Definition at line 494 of file multiBand.py.

Constructor & Destructor Documentation

◆ __init__()

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__):

Parameters
[in]schemathe schema of the detection catalogs used as input to this one
[in]butlera 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 550 of file multiBand.py.

550  def __init__(self, butler=None, schema=None, **kwargs):
551  """!
552  @brief Initialize the task.
553 
554  Keyword arguments (in addition to those forwarded to CmdLineTask.__init__):
555  @param[in] schema the schema of the detection catalogs used as input to this one
556  @param[in] butler a butler used to read the input schema from disk, if schema is None
557 
558  Derived classes should use the getInputSchema() method to handle the additional
559  arguments and retreive the actual input schema.
560  """
561  CmdLineTask.__init__(self, **kwargs)
562 
def __init__(self, minimum, dataRange, Q)

Member Function Documentation

◆ getInputSchema()

def lsst.pipe.tasks.multiBand.MergeSourcesTask.getInputSchema (   self,
  butler = None,
  schema = None 
)

Obtain the input schema either directly or froma butler reference.

Parameters
[in]butlerbutler reference to obtain the input schema from
[in]schemathe input schema

Definition at line 537 of file multiBand.py.

537  def getInputSchema(self, butler=None, schema=None):
538  """!
539  @brief Obtain the input schema either directly or froma butler reference.
540 
541  @param[in] butler butler reference to obtain the input schema from
542  @param[in] schema the input schema
543  """
544  if schema is None:
545  assert butler is not None, "Neither butler nor schema specified"
546  schema = butler.get(self.config.coaddName + "Coadd_" + self.inputDataset + "_schema",
547  immediate=True).schema
548  return schema
549 

◆ readCatalog()

def lsst.pipe.tasks.multiBand.MergeSourcesTask.readCatalog (   self,
  patchRef 
)

Read input catalog.

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

Parameters
[in]patchRefdata reference for patch
Returns
tuple consisting of the filter name and the catalog

Definition at line 574 of file multiBand.py.

574  def readCatalog(self, patchRef):
575  """!
576  @brief Read input catalog.
577 
578  We read the input dataset provided by the 'inputDataset'
579  class variable.
580 
581  @param[in] patchRef data reference for patch
582  @return tuple consisting of the filter name and the catalog
583  """
584  filterName = patchRef.dataId["filter"]
585  catalog = patchRef.get(self.config.coaddName + "Coadd_" + self.inputDataset, immediate=True)
586  self.log.info("Read %d sources for filter %s: %s" % (len(catalog), filterName, patchRef.dataId))
587  return filterName, catalog
588 

◆ run()

def lsst.pipe.tasks.multiBand.MergeSourcesTask.run (   self,
  catalogs,
  patchRef 
)

Merge multiple catalogs.

This function must be defined in all subclasses that inherit from MergeSourcesTask.

Parameters
[in]catalogsdict mapping filter name to source catalog
Returns
merged catalog

Definition at line 589 of file multiBand.py.

589  def run(self, catalogs, patchRef):
590  """!
591  @brief Merge multiple catalogs. This function must be defined in all subclasses that inherit from
592  MergeSourcesTask.
593 
594  @param[in] catalogs dict mapping filter name to source catalog
595 
596  @return merged catalog
597  """
598  raise NotImplementedError()
599 

◆ runDataRef()

def lsst.pipe.tasks.multiBand.MergeSourcesTask.runDataRef (   self,
  patchRefList 
)

Merge coadd sources from multiple bands.

Calls run which must be defined in subclasses that inherit from MergeSourcesTask.

Parameters
[in]patchRefListlist of data references for each filter

Definition at line 563 of file multiBand.py.

563  def runDataRef(self, patchRefList):
564  """!
565  @brief Merge coadd sources from multiple bands. Calls @ref `run` which must be defined in
566  subclasses that inherit from MergeSourcesTask.
567 
568  @param[in] patchRefList list of data references for each filter
569  """
570  catalogs = dict(self.readCatalog(patchRef) for patchRef in patchRefList)
571  mergedCatalog = self.run(catalogs, patchRefList[0])
572  self.write(patchRefList[0], mergedCatalog)
573 

◆ write()

def lsst.pipe.tasks.multiBand.MergeSourcesTask.write (   self,
  patchRef,
  catalog 
)

Write the output.

Parameters
[in]patchRefdata reference for patch
[in]catalogcatalog

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

Definition at line 600 of file multiBand.py.

600  def write(self, patchRef, catalog):
601  """!
602  @brief Write the output.
603 
604  @param[in] patchRef data reference for patch
605  @param[in] catalog catalog
606 
607  We write as the dataset provided by the 'outputDataset'
608  class variable.
609  """
610  patchRef.put(catalog, self.config.coaddName + "Coadd_" + self.outputDataset)
611  # since the filter isn't actually part of the data ID for the dataset we're saving,
612  # it's confusing to see it in the log message, even if the butler simply ignores it.
613  mergeDataId = patchRef.dataId.copy()
614  del mergeDataId["filter"]
615  self.log.info("Wrote merged catalog: %s" % (mergeDataId,))
616 

◆ writeMetadata()

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 617 of file multiBand.py.

617  def writeMetadata(self, dataRefList):
618  """!
619  @brief No metadata to write, and not sure how to write it for a list of dataRefs.
620  """
621  pass
622 
623 

Member Data Documentation

◆ ConfigClass

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

Definition at line 516 of file multiBand.py.

◆ getSchemaCatalogs

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

Definition at line 520 of file multiBand.py.

◆ inputDataset

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

Definition at line 518 of file multiBand.py.

◆ outputDataset

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

Definition at line 519 of file multiBand.py.

◆ RunnerClass

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

Definition at line 517 of file multiBand.py.


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