lsst.pipe.tasks gd5638573c2+392ae78cd2
Loading...
Searching...
No Matches
lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask Class Reference
Inheritance diagram for lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask:
lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask

Public Member Functions

 __init__ (self, *args, **kwargs)
pipeBase.Struct run (self, afwImage.Exposure exposure, afwTable.SourceCatalog|None catalog=None, measBase.IdGenerator|None idGenerator=None)
pipeBase.Struct runFromImage (self, afwImage.MaskedImage|afwImage.Image|np.ndarray image, afwImage.Mask|np.ndarray mask=None, afwImage.Image|np.ndarray variance=None, afwGeom.SkyWcs wcs=None, afwDetection.Psf|np.ndarray psf=None, afwImage.PhotoCalib photoCalib=None, afwTable.SourceCatalog catalog=None, measBase.IdGenerator idGenerator=None)
Public Member Functions inherited from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask
 __init__ (self, afwTable.Schema schema=None, afwTable.Schema peakSchema=None, **dict kwargs)
 __setattr__ (self, name, value)

Protected Member Functions

afwTable.SourceCatalog _deblendSources (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog)
Protected Member Functions inherited from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask
 _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)
 _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)

Additional Inherited Members

Public Attributes inherited from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask
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 inherited from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask
 ConfigClass = MeasurementDriverBaseConfig
Static Protected Attributes inherited from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask
str _DefaultName = "measurementDriverBase"
str _Deblender = ""

Detailed Description

Mid-level driver for processing single-band data.

Offers a helper method for direct handling of raw image data in addition to
the standard single-band exposure.

Examples
--------
Here is an example of how to use this class to run variance scaling,
detection, deblending, and measurement on a single-band exposure:

>>> from lsst.pipe.tasks.measurementDriver import (
...     SingleBandMeasurementDriverConfig,
...     SingleBandMeasurementDriverTask,
... )
>>> import lsst.meas.extensions.shapeHSM  # To register its plugins
>>> config = SingleBandMeasurementDriverConfig()
>>> config.doScaleVariance = True
>>> config.doDetect = True
>>> config.doDeblend = True
>>> config.doMeasure = True
>>> config.scaleVariance.background.binSize = 64
>>> config.detection.thresholdValue = 5.5
>>> config.deblend.tinyFootprintSize = 3
>>> config.measurement.plugins.names |= [
...     "base_SdssCentroid",
...     "base_SdssShape",
...     "ext_shapeHSM_HsmSourceMoments",
... ]
>>> config.measurement.slots.psfFlux = None
>>> config.measurement.doReplaceWithNoise = False
>>> exposure = butler.get("deepCoadd", dataId=...)
>>> driver = SingleBandMeasurementDriverTask(config=config)
>>> results = driver.run(exposure)
>>> results.catalog.writeFits("meas_catalog.fits")

Alternatively, if an exposure is not available, the driver can also process
raw image data:

>>> image = ...
>>> mask = ...
>>> variance = ...
>>> wcs = ...
>>> psf = ...
>>> photoCalib = ...
>>> results = driver.runFromImage(
...     image, mask, variance, wcs, psf, photoCalib
... )
>>> results.catalog.writeFits("meas_catalog.fits")

Member Function Documentation

◆ _deblendSources()

afwTable.SourceCatalog lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask._deblendSources ( self,
afwImage.Exposure exposure,
afwTable.SourceCatalog catalog )
protected
Run single-band deblending given an exposure and a catalog.

Parameters
----------
exposure :
    Exposure on which to run the deblending algorithm.
catalog :
    Catalog containing sources to be deblended.

Returns
-------
catalog :
    Catalog after deblending, with sources separated into their
    individual components if they were deblended.

Reimplemented from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.

◆ run()

pipeBase.Struct lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask.run ( self,
afwImage.Exposure exposure,
afwTable.SourceCatalog | None catalog = None,
measBase.IdGenerator | None idGenerator = None )
Process a single-band exposure through the configured subtasks and
return the results as a struct.

Parameters
----------
exposure :
    The exposure on which to run the driver task.
catalog :
    Catalog to be extended by the driver task. If not provided, an
    empty catalog will be created and populated.
idGenerator :
    Object that generates source IDs and provides random seeds.

Returns
-------
result :
    Results as a struct with attributes:

    ``catalog``
        Catalog containing the measured sources
        (`~lsst.afw.table.SourceCatalog`).
    ``backgroundList``
        List of backgrounds (`list[~lsst.afw.math.Background]`). Only
        populated if detection is enabled.

Reimplemented from lsst.pipe.tasks.measurementDriver.MeasurementDriverBaseTask.

Reimplemented in lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask.

◆ runFromImage()

pipeBase.Struct lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask.runFromImage ( self,
afwImage.MaskedImage | afwImage.Image | np.ndarray image,
afwImage.Mask | np.ndarray mask = None,
afwImage.Image | np.ndarray variance = None,
afwGeom.SkyWcs wcs = None,
afwDetection.Psf | np.ndarray psf = None,
afwImage.PhotoCalib photoCalib = None,
afwTable.SourceCatalog catalog = None,
measBase.IdGenerator idGenerator = None )
Convert image data to an `Exposure`, then run it through the
configured subtasks.

Parameters
----------
image :
    Input image data. Will be converted into an `Exposure` before
    processing.
mask :
    Mask data for the image. Used if ``image`` is a bare `array` or
    `Image`.
variance :
    Variance plane data for the image.
wcs :
    World Coordinate System to associate with the exposure that will
    be created from ``image``.
psf :
    PSF model for the exposure.
photoCalib :
    Photometric calibration model for the exposure.
catalog :
    Catalog to be extended by the driver task. If not provided, a new
    catalog will be created during detection and populated.
idGenerator :
    Generator for unique source IDs.

Returns
-------
result :
    Results as a struct with attributes:

    ``catalog``
        Catalog containing the measured sources
        (`~lsst.afw.table.SourceCatalog`).
    ``backgroundList``
        List of backgrounds (`list[~lsst.afw.math.Background]`).

Reimplemented in lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask.


The documentation for this class was generated from the following file:
  • python/lsst/pipe/tasks/measurementDriver.py