lsst.pipe.tasks gcf00bf066d+02752e367a
Loading...
Searching...
No Matches
lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask Class Reference
Inheritance diagram for lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask:
lsst.pipe.tasks.measurementDriver.MultiBandMeasurementDriverTask lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask

Public Member Functions

 __init__ (self, afwTable.Schema schema=None, afwTable.Schema peakSchema=None, **dict kwargs)
 
 __setattr__ (self, name, value)
 
pipeBase.Struct run (self, *args, **kwargs)
 

Public Attributes

afwTable.SchemaMapper schema = schema
 
 peakSchema = peakSchema
 
afwTable.SchemaMapper mapper
 
measAlgorithms.ScaleVarianceTask scaleVariance
 
measAlgorithms.SourceDetectionTask detection
 
measDeblender.SourceDeblendTask|scarlet.ScarletDeblendTask deblend
 
measBase.SingleFrameMeasurementTask|measBase.ForcedMeasurementTask measurement
 
measBase.ApplyApCorrTask applyApCorr
 
measBase.CatalogCalculationTask catalogCalculation
 
afwTable.Schema initSchema
 
 config
 

Static Public Attributes

 ConfigClass = MeasurementDriverBaseConfig
 

Protected Member Functions

 _ensureValidInputs (self, afwTable.SourceCatalog|None catalog)
 
 _initializeSchema (self, afwTable.SourceCatalog catalog=None)
 
 _addCoordErrorFieldsIfMissing (self, afwTable.Schema schema)
 
 _makeSubtasks (self)
 
afwTable.SourceCatalog|None _prepareSchemaAndSubtasks (self, afwTable.SourceCatalog|None catalog)
 
 _scaleVariance (self, afwImage.Exposure exposure, str band="a single")
 
afwTable.SourceCatalog|dict[str, afwTable.SourceCatalog] _toContiguous (self, afwTable.SourceCatalog|dict[str, afwTable.SourceCatalog] catalog)
 
afwTable.SourceCatalog _updateCatalogSchema (self, afwTable.SourceCatalog catalog)
 
tuple[afwTable.SourceCatalog, afwMath.BackgroundList] _detectSources (self, afwImage.Exposure|afwImage.MultibandExposure exposure, measBase.IdGenerator idGenerator)
 
 _deblendSources (self, *args, **kwargs)
 
 _measureSources (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator, afwTable.SourceCatalog|None refCat=None)
 
 _applyApCorr (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator)
 
 _runCatalogCalculation (self, afwTable.SourceCatalog catalog)
 
afwTable.SourceCatalog _processCatalog (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator, str band="a single", afwTable.SourceCatalog|None refCat=None)
 

Static Protected Attributes

str _DefaultName = "measurementDriverBase"
 
str _Deblender = ""
 

Detailed Description

Base class for the mid-level driver running variance scaling, detection,
deblending, measurement, apperture correction, and catalog calculation in
one go.

Users don't need to Butlerize their input data, which is a significant
advantage for quick data exploration and testing. This driver simplifies
the process of applying measurement algorithms to images by abstracting
away low-level implementation details such as Schema and table boilerplate.
It's a convenient way to process images into catalogs with a user-friendly
interface for non-developers while allowing extensive configuration and
integration into unit tests for developers. It also considerably improves
how demos and workflows are showcased in Jupyter notebooks.

Parameters
----------
schema :
    Schema used to create the output `~lsst.afw.table.SourceCatalog`,
    modified in place with fields that will be written by this task.
peakSchema :
    Schema of Footprint Peaks that will be passed to the deblender.
**kwargs :
    Additional kwargs to pass to lsst.pipe.base.Task.__init__()

Notes
-----
Subclasses (e.g., single-band vs. multi-band) share most methods and config
options but differ in handling and validating inputs by overriding the base
config class and any methods that require their own logic.

Definition at line 136 of file measurementDriver.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.__init__ ( self,
afwTable.Schema schema = None,
afwTable.Schema peakSchema = None,
**dict kwargs )

Definition at line 171 of file measurementDriver.py.

Member Function Documentation

◆ __setattr__()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.__setattr__ ( self,
name,
value )
Prevent external modifications of the initial Schema.

Definition at line 196 of file measurementDriver.py.

◆ _addCoordErrorFieldsIfMissing()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._addCoordErrorFieldsIfMissing ( self,
afwTable.Schema schema )
protected
Add coordinate error fields to the schema in-place if they are not
already present.

Parameters
----------
schema :
    Schema to be checked for coordinate error fields.

Definition at line 292 of file measurementDriver.py.

◆ _applyApCorr()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._applyApCorr ( self,
afwImage.Exposure exposure,
afwTable.SourceCatalog catalog,
measBase.IdGenerator idGenerator )
protected
Apply aperture corrections to the catalog.

Parameters
----------
exposure :
    Exposure on which to apply aperture corrections.
catalog :
    Catalog to be corrected using the aperture correction map from
    the exposure.
idGenerator :
    Generator for unique source IDs.

Definition at line 541 of file measurementDriver.py.

◆ _deblendSources()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._deblendSources ( self,
* args,
** kwargs )
protected
Run the deblending subtask to separate blended sources. Subclasses
must implement this method to handle task-specific deblending logic.

Reimplemented in lsst.pipe.tasks.measurementDriver.MultiBandMeasurementDriverTask, and lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask.

Definition at line 497 of file measurementDriver.py.

◆ _detectSources()

tuple[afwTable.SourceCatalog, afwMath.BackgroundList] lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._detectSources ( self,
afwImage.Exposure | afwImage.MultibandExposure exposure,
measBase.IdGenerator idGenerator )
protected
Run the detection subtask to identify sources in the image.

Parameters
----------
exposure :
    Exposure on which to run the detection algorithm.
idGenerator :
    Generator for unique source IDs.

Returns
-------
catalog :
    A catalog containing detected sources.
backgroundList :
    A list of background models obtained from the detection process,
    if available.

Definition at line 458 of file measurementDriver.py.

◆ _ensureValidInputs()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._ensureValidInputs ( self,
afwTable.SourceCatalog | None catalog )
protected
Perform validation and adjustments of inputs without heavy
computation.

Parameters
----------
catalog :
    Catalog to be extended by the driver task.

Reimplemented in lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask, and lsst.pipe.tasks.measurementDriver.MultiBandMeasurementDriverTask.

Definition at line 209 of file measurementDriver.py.

◆ _initializeSchema()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._initializeSchema ( self,
afwTable.SourceCatalog catalog = None )
protected
Initialize the Schema to be used for constructing the subtasks.

Though it may seem clunky, this workaround is necessary to ensure
Schema consistency across all subtasks.

Parameters
----------
catalog :
    Catalog from which to extract the Schema. If not provided, the
    user-provided Schema and if that is also not provided during
    initialization, a minimal Schema will be used.

Definition at line 233 of file measurementDriver.py.

◆ _makeSubtasks()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._makeSubtasks ( self)
protected
Construct subtasks based on the configuration and the Schema.

Definition at line 307 of file measurementDriver.py.

◆ _measureSources()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._measureSources ( self,
afwImage.Exposure exposure,
afwTable.SourceCatalog catalog,
measBase.IdGenerator idGenerator,
afwTable.SourceCatalog | None refCat = None )
protected
Run the measurement subtask to compute properties of sources.

Parameters
----------
exposure :
    Exposure on which to run the measurement algorithm.
catalog :
    Catalog containing sources on which to run the measurement subtask.
idGenerator :
    Generator for unique source IDs.
refCat :
    Reference catalog to be used for forced measurements, if any.
    If not provided, the measurement will be run on the sources in the
    catalog in a standard manner without reference.

Definition at line 503 of file measurementDriver.py.

◆ _prepareSchemaAndSubtasks()

afwTable.SourceCatalog | None lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._prepareSchemaAndSubtasks ( self,
afwTable.SourceCatalog | None catalog )
protected
Ensure subtasks are properly initialized according to the
configuration and the provided catalog.

Parameters
----------
catalog :
    Optional catalog to be used for initializing the Schema and the
    subtasks.

Returns
-------
catalog :
    Updated catalog to be passed to the subtasks, if it was provided.

Definition at line 357 of file measurementDriver.py.

◆ _processCatalog()

afwTable.SourceCatalog lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._processCatalog ( self,
afwImage.Exposure exposure,
afwTable.SourceCatalog catalog,
measBase.IdGenerator idGenerator,
str band = "a single",
afwTable.SourceCatalog | None refCat = None )
protected
Process a catalog through measurement, aperture correction, and
catalog calculation subtasks.

Parameters
----------
exposure :
    Exposure associated with the catalog.
catalog :
    Catalog to be processed by the subtasks.
idGenerator :
    Generator for unique source IDs.
band :
    Band associated with the exposure and catalog. Used for logging.
refCat :
    Reference catalog for forced measurements. If not provided, the
    measurement will be run on the sources in the catalog in a standard
    manner without reference.

Returns
-------
catalog :
    Catalog after processing through the configured subtasks.

Definition at line 575 of file measurementDriver.py.

◆ _runCatalogCalculation()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._runCatalogCalculation ( self,
afwTable.SourceCatalog catalog )
protected
Run the catalog calculation plugins on the catalog.

Parameters
----------
catalog :
    Catalog to be processed by the catalog calculation subtask.

Definition at line 565 of file measurementDriver.py.

◆ _scaleVariance()

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._scaleVariance ( self,
afwImage.Exposure exposure,
str band = "a single" )
protected
Scale the variance plane of an exposure to match the observed
variance.

Parameters
----------
exposure :
    Exposure on which to run the variance scaling algorithm.
band :
    Band associated with the exposure. Used for logging.

Definition at line 390 of file measurementDriver.py.

◆ _toContiguous()

afwTable.SourceCatalog | dict[str, afwTable.SourceCatalog] lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._toContiguous ( self,
afwTable.SourceCatalog | dict[str, afwTable.SourceCatalog] catalog )
protected
Make a catalog or catalogs contiguous if they are not already.

Parameters
----------
catalog :
    Catalog or dictionary of catalogs with bands as keys to be made
    contiguous.

Returns
-------
catalog :
    Contiguous catalog or dictionary of contiguous catalogs.

Definition at line 405 of file measurementDriver.py.

◆ _updateCatalogSchema()

afwTable.SourceCatalog lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._updateCatalogSchema ( self,
afwTable.SourceCatalog catalog )
protected
Update the Schema of the provided catalog to incorporate changes
made by the configured subtasks.

Parameters
----------
catalog :
    Catalog to be updated with the Schema changes.

Returns
-------
updatedCatalog :
    Catalog with the updated Schema.

Definition at line 432 of file measurementDriver.py.

◆ run()

pipeBase.Struct lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.run ( self,
* args,
** kwargs )
Run the measurement driver task. Subclasses must implement this
method using their own logic to handle single-band or multi-band data.

Reimplemented in lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask, lsst.pipe.tasks.measurementDriver.MultiBandMeasurementDriverTask, and lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask.

Definition at line 203 of file measurementDriver.py.

Member Data Documentation

◆ _Deblender

str lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._Deblender = ""
staticprotected

Definition at line 169 of file measurementDriver.py.

◆ _DefaultName

str lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask._DefaultName = "measurementDriverBase"
staticprotected

Definition at line 168 of file measurementDriver.py.

◆ applyApCorr

measBase.ApplyApCorrTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.applyApCorr

Definition at line 186 of file measurementDriver.py.

◆ catalogCalculation

measBase.CatalogCalculationTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.catalogCalculation

Definition at line 187 of file measurementDriver.py.

◆ config

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.config

Definition at line 310 of file measurementDriver.py.

◆ ConfigClass

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.ConfigClass = MeasurementDriverBaseConfig
static

Definition at line 167 of file measurementDriver.py.

◆ deblend

measDeblender.SourceDeblendTask | scarlet.ScarletDeblendTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.deblend

Definition at line 184 of file measurementDriver.py.

◆ detection

measAlgorithms.SourceDetectionTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.detection

Definition at line 183 of file measurementDriver.py.

◆ initSchema

afwTable.Schema lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.initSchema

Definition at line 190 of file measurementDriver.py.

◆ mapper

afwTable.SchemaMapper lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.mapper

Definition at line 181 of file measurementDriver.py.

◆ measurement

measBase.SingleFrameMeasurementTask | measBase.ForcedMeasurementTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.measurement

Definition at line 185 of file measurementDriver.py.

◆ peakSchema

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.peakSchema = peakSchema

Definition at line 178 of file measurementDriver.py.

◆ scaleVariance

measAlgorithms.ScaleVarianceTask lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.scaleVariance

Definition at line 182 of file measurementDriver.py.

◆ schema

lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.schema = schema

Definition at line 175 of file measurementDriver.py.


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