lsst.meas.base  14.0-23-g2010ef9+1
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.base.forcedMeasurement.ForcedMeasurementTask Class Reference

A subtask for measuring the properties of sources on a single exposure, using an existing "reference" catalog to constrain some aspects of the measurement. More...

Inheritance diagram for lsst.meas.base.forcedMeasurement.ForcedMeasurementTask:
lsst.meas.base.baseMeasurement.BaseMeasurementTask

Public Member Functions

def __init__ (self, refSchema, algMetadata=None, kwds)
 Initialize the task. More...
 
def run (self, measCat, exposure, refCat, refWcs, exposureId=None, beginOrder=None, endOrder=None)
 Perform forced measurement. More...
 
def generateMeasCat (self, exposure, refCat, refWcs, idFactory=None)
 Initialize an output SourceCatalog using information from the reference catalog. More...
 
def attachTransformedFootprints (self, sources, refCat, exposure, refWcs)
 Default implementation for attaching Footprints to blank sources prior to measurement. More...
 
def getPluginLogName (self, pluginName)
 
def initializePlugins (self, kwds)
 
def callMeasure (self, measRecord, args, kwds)
 Call the measure() method on all plugins, handling exceptions in a consistent way. More...
 
def doMeasurement (self, plugin, measRecord, args, kwds)
 Call the measure() method on the nominated plugin, handling exceptions in a consistent way. More...
 
def callMeasureN (self, measCat, args, kwds)
 Call the measureN() method on all plugins, handling exceptions in a consistent way. More...
 
def doMeasurementN (self, plugin, measCat, args, kwds)
 Call the measureN() method on the nominated plugin, handling exceptions in a consistent way. More...
 

Public Attributes

 mapper
 
 schema
 
 plugins
 
 undeblendedPlugins
 
 algMetadata
 

Static Public Attributes

 ConfigClass = ForcedMeasurementConfig
 

Detailed Description

A subtask for measuring the properties of sources on a single exposure, using an existing "reference" catalog to constrain some aspects of the measurement.

The task is configured with a list of "plugins": each plugin defines the values it measures (i.e. the columns in a table it will fill) and conducts that measurement on each detected source (see ForcedPlugin). The job of the measurement task is to initialize the set of plugins (which includes setting up the catalog schema) from their configuration, and then invoke each plugin on each source.

Most of the time, ForcedMeasurementTask will be used via one of the subclasses of ForcedPhotImageTask, ForcedPhotCcdTask and ForcedPhotCoaddTask. These combine this measurement subtask with a "references" subtask (see BaseReferencesTask and CoaddSrcReferencesTask) to perform forced measurement using measurements performed on another image as the references. There is generally little reason to use ForcedMeasurementTask outside of one of these drivers, unless it is necessary to avoid using the Butler for I/O.

ForcedMeasurementTask has only three methods: init(), run(), and generateMeasCat(). For configuration options, see SingleFrameMeasurementConfig.

Notes

Forced measurement means that the plugins are provided with a reference source containing centroid and/or shape measurements that they may use however they see fit. Some plugins can use these to set the location and size of apertures, but others may choose to ignore this information, essentially performing an unforced measurement starting at the position of the reference source (which may nevertheless be useful for certain investigations). Knowing how the plugin uses the reference information is essential to interpreting its resulting measurements. Typically, centroid and shape measurement plugins (e.g., SdssCentroid and SdssShape) are performing unforced measurements.

Definition at line 197 of file forcedMeasurement.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.__init__ (   self,
  refSchema,
  algMetadata = None,
  kwds 
)

Initialize the task.

Set up the execution order of the plugins and initialize the plugins, giving each plugin an opportunity to add its measurement fields to the output schema and to record information in the task metadata.

Note that while SingleFrameMeasurementTask is passed an initial Schema that is appended to in order to create the output Schema, ForcedMeasurementTask is initialized with the Schema of the reference catalog, from which a new Schema for the output catalog is created. Fields to be copied directly from the reference Schema are added before Plugin fields are added.

Parameters
[in]refSchemaSchema of the reference catalog. Must match the catalog later passed to generateMeasCat() and/or run().
[in,out]algMetadatalsst.daf.base.PropertyList used to record information about each algorithm. An empty PropertyList will be created if None.
[in]**kwdsKeyword arguments passed from lsst.pipe.base.Task.__init__

Definition at line 240 of file forcedMeasurement.py.

Member Function Documentation

◆ attachTransformedFootprints()

def lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.attachTransformedFootprints (   self,
  sources,
  refCat,
  exposure,
  refWcs 
)

Default implementation for attaching Footprints to blank sources prior to measurement.

Footprints for forced photometry must be in the pixel coordinate system of the image being measured, while the actual detections may start out in a different coordinate system. This default implementation transforms the Footprints from the reference catalog from the refWcs to the exposure's Wcs, which downgrades HeavyFootprints into regular Footprints, destroying deblend information.

Note that ForcedPhotImageTask delegates to this method in its own attachFootprints method. attachFootprints can then be overridden by its subclasses to define how their Footprints should be generated.

See the documentation for run() for information about the relationships between run(), generateMeasCat(), and attachTransformedFootprints().

Definition at line 399 of file forcedMeasurement.py.

◆ callMeasure()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.callMeasure (   self,
  measRecord,
  args,
  kwds 
)
inherited

Call the measure() method on all plugins, handling exceptions in a consistent way.

Parameters
[in,out]measRecordlsst.afw.table.SourceRecord that corresponds to the object being measured, and where outputs should be written.
[in]*argsPositional arguments forwarded to Plugin.measure()
[in]**kwdsKeyword arguments. Two are handled locally:
  • beginOrder: beginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit.
  • endOrder: ending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit. the rest are forwarded to Plugin.measure()

This method can be used with plugins that have different signatures; the only requirement is that 'measRecord' be the first argument. Subsequent positional arguments and keyword arguments are forwarded directly to the plugin.

This method should be considered "protected"; it is intended for use by derived classes, not users.

Definition at line 255 of file baseMeasurement.py.

◆ callMeasureN()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.callMeasureN (   self,
  measCat,
  args,
  kwds 
)
inherited

Call the measureN() method on all plugins, handling exceptions in a consistent way.

Parameters
[in,out]measCatlsst.afw.table.SourceCatalog containing records for just the source family to be measured, and where outputs should be written.
[in]beginOrderbeginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit.
[in]endOrderending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit.
[in]*argsPositional arguments forwarded to Plugin.measure()
[in]**kwdsKeyword arguments. Two are handled locally:
  • beginOrder: beginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit.
  • endOrder: ending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit. the rest are forwarded to Plugin.measure()

This method can be used with plugins that have different signatures; the only requirement is that 'measRecord' be the first argument. Subsequent positional arguments and keyword arguments are forwarded directly to the plugin.

This method should be considered "protected"; it is intended for use by derived classes, not users.

Definition at line 315 of file baseMeasurement.py.

◆ doMeasurement()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.doMeasurement (   self,
  plugin,
  measRecord,
  args,
  kwds 
)
inherited

Call the measure() method on the nominated plugin, handling exceptions in a consistent way.

Parameters
[in]pluginPlugin that will measure
[in,out]measRecordlsst.afw.table.SourceRecord that corresponds to the object being measured, and where outputs should be written.
[in]*argsPositional arguments forwarded to plugin.measure()
[in]**kwdsKeyword arguments forwarded to plugin.measure()

This method can be used with plugins that have different signatures; the only requirement is that the 'plugin' and 'measRecord' be the first two arguments. Subsequent positional arguments and keyword arguments are forwarded directly to the plugin.

This method should be considered "protected"; it is intended for use by derived classes, not users.

Definition at line 284 of file baseMeasurement.py.

◆ doMeasurementN()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.doMeasurementN (   self,
  plugin,
  measCat,
  args,
  kwds 
)
inherited

Call the measureN() method on the nominated plugin, handling exceptions in a consistent way.

Parameters
[in]pluginPlugin that will measure
[in,out]measCatlsst.afw.table.SourceCatalog containing records for just the source family to be measured, and where outputs should be written.
[in]*argsPositional arguments forwarded to plugin.measureN()
[in]**kwdsKeyword arguments forwarded to plugin.measureN()

This method can be used with plugins that have different signatures; the only requirement is that the 'plugin' and 'measCat' be the first two arguments. Subsequent positional arguments and keyword arguments are forwarded directly to the plugin.

This method should be considered "protected"; it is intended for use by derived classes, not users.

Definition at line 349 of file baseMeasurement.py.

◆ generateMeasCat()

def lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.generateMeasCat (   self,
  exposure,
  refCat,
  refWcs,
  idFactory = None 
)

Initialize an output SourceCatalog using information from the reference catalog.

This generates a new blank SourceRecord for each record in refCat. Note that this method does not attach any Footprints. Doing so is up to the caller (who may call attachedTransformedFootprints or define their own method - see run() for more information).

Parameters
[in]exposureExposure to be measured
[in]refCatSequence (not necessarily a SourceCatalog) of reference SourceRecords.
[in]refWcsWcs that defines the X,Y coordinate system of refCat
[in]idFactoryfactory for creating IDs for sources
Returns
Source catalog ready for measurement

Definition at line 372 of file forcedMeasurement.py.

◆ getPluginLogName()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.getPluginLogName (   self,
  pluginName 
)
inherited

Definition at line 214 of file baseMeasurement.py.

◆ initializePlugins()

def lsst.meas.base.baseMeasurement.BaseMeasurementTask.initializePlugins (   self,
  kwds 
)
inherited
Initialize the plugins (and slots) according to the configuration.

Derived class constructors should call this method to fill the self.plugins
attribute and add correspond output fields and slot aliases to the output schema.

In addition to the attributes added by BaseMeasurementTask.__init__, a self.schema
attribute holding the output schema must also be present before this method is called, .

Keyword arguments are forwarded directly to plugin constructors, allowing derived
classes to use plugins with different signatures.

Definition at line 217 of file baseMeasurement.py.

◆ run()

def lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.run (   self,
  measCat,
  exposure,
  refCat,
  refWcs,
  exposureId = None,
  beginOrder = None,
  endOrder = None 
)

Perform forced measurement.

Parameters
[in]exposurelsst.afw.image.ExposureF to be measured; must have at least a Wcs attached.
[in]measCatSource catalog for measurement results; must be initialized with empty records already corresponding to those in refCat (via e.g. generateMeasCat).
[in]refCatA sequence of SourceRecord objects that provide reference information for the measurement. These will be passed to each Plugin in addition to the output SourceRecord.
[in]refWcsWcs that defines the X,Y coordinate system of refCat
[in]exposureIdoptional unique exposureId used to calculate random number generator seed in the NoiseReplacer.
[in]beginOrderbeginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit.
[in]endOrderending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit.

Fills the initial empty SourceCatalog with forced measurement results. Two steps must occur before run() can be called:

  • generateMeasCat() must be called to create the output measCat argument.
  • Footprints appropriate for the forced sources must be attached to the measCat records. The attachTransformedFootprints() method can be used to do this, but this degrades HeavyFootprints to regular Footprints, leading to non-deblended measurement, so most callers should provide Footprints some other way. Typically, calling code will have access to information that will allow them to provide HeavyFootprints - for instance, ForcedPhotCoaddTask uses the HeavyFootprints from deblending run in the same band just before non-forced is run measurement in that band.

Definition at line 270 of file forcedMeasurement.py.

Member Data Documentation

◆ algMetadata

lsst.meas.base.baseMeasurement.BaseMeasurementTask.algMetadata
inherited

Definition at line 212 of file baseMeasurement.py.

◆ ConfigClass

lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.ConfigClass = ForcedMeasurementConfig
static

Definition at line 238 of file forcedMeasurement.py.

◆ mapper

lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.mapper

Definition at line 259 of file forcedMeasurement.py.

◆ plugins

lsst.meas.base.baseMeasurement.BaseMeasurementTask.plugins
inherited

Definition at line 208 of file baseMeasurement.py.

◆ schema

lsst.meas.base.forcedMeasurement.ForcedMeasurementTask.schema

Definition at line 267 of file forcedMeasurement.py.

◆ undeblendedPlugins

lsst.meas.base.baseMeasurement.BaseMeasurementTask.undeblendedPlugins
inherited

Definition at line 209 of file baseMeasurement.py.


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