lsst.meas.base
14.0-21-gb9e430a
|
A subtask for measuring the properties of sources on a single exposure. More...
Public Member Functions | |
def | __init__ (self, schema, algMetadata=None, kwds) |
Initialize the task. More... | |
def | run (self, measCat, exposure, noiseImage=None, exposureId=None, beginOrder=None, endOrder=None) |
Run single frame measurement over an exposure and source catalog. More... | |
def | runPlugins (self, noiseReplacer, measCat, exposure, beginOrder=None, endOrder=None) |
def | measure (self, measCat, exposure) |
Backwards-compatibility alias for run() 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 | |
schema | |
doBlendedness | |
blendPlugin | |
plugins | |
undeblendedPlugins | |
algMetadata | |
Static Public Attributes | |
ConfigClass = SingleFrameMeasurementConfig | |
string | NOISE_SEED_MULTIPLIER = "NOISE_SEED_MULTIPLIER" |
string | NOISE_SOURCE = "NOISE_SOURCE" |
string | NOISE_OFFSET = "NOISE_OFFSET" |
string | NOISE_EXPOSURE_ID = "NOISE_EXPOSURE_ID" |
A subtask for measuring the properties of sources on a single exposure.
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 SingleFramePlugin). 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.
When run after the deblender (see lsst.meas.deblender.SourceDeblendTask), SingleFrameMeasurementTask also replaces each source's neighbors with noise before measuring each source, utilizing the HeavyFootprints created by the deblender (see NoiseReplacer).
SingleFrameMeasurementTask has only two methods: init() and run(). For configuration options, see SingleFrameMeasurementConfig.
The code below is in examples/runSingleFrameTask.py
See meas_algorithms_detection_Example for more information on SourceDetectionTask.
First, import the required tasks (there are some other standard imports; read the file if you're confused):
We need to create our tasks before processing any data as the task constructors can add extra columns to the schema. The most important argument we pass these to these is an lsst.afw.table.Schema object, which contains information about the fields (i.e. columns) of the measurement catalog we'll create, including names, types, and additional documentation. Tasks that operate on a catalog are typically passed a Schema upon construction, to which they add the fields they'll fill later when run. We construct a mostly empty Schema that contains just the fields required for a SourceCatalog like this:
Now we can configure and create the SourceDetectionTask:
We then move on to configuring the measurement task:
While a reasonable set of plugins is configured by default, we'll customize the list. We also need to unset one of the slots at the same time, because we're not running the algorithm that it's set to by default, and that would cause problems later:
Now, finally, we can construct the measurement task:
After constructing all the tasks, we can inspect the Schema we've created:
All of the fields in the schema can be accessed via the get() method on a record object. See afwTable for more information.
We're now ready to process the data (we could loop over multiple exposures/catalogs using the same task objects). First create the output table and process the image to find sources:
Then measure them:
We then might plot the results (e.g. if you set --ds9
on the command line)
and end up with something like
def lsst.meas.base.sfm.SingleFrameMeasurementTask.__init__ | ( | self, | |
schema, | |||
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.
[in,out] | schema | lsst.afw.table.Schema, to be initialized to include the measurement fields from the plugins already |
[in,out] | algMetadata | lsst.daf.base.PropertyList used to record information about each algorithm. An empty PropertyList will be created if None. |
[in] | **kwds | Keyword arguments forwarded to lsst.pipe.base.Task.__init__ |
|
inherited |
Call the measure() method on all plugins, handling exceptions in a consistent way.
[in,out] | measRecord | lsst.afw.table.SourceRecord that corresponds to the object being measured, and where outputs should be written. |
[in] | *args | Positional arguments forwarded to Plugin.measure() |
[in] | **kwds | Keyword arguments. Two are handled locally:
|
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.
|
inherited |
Call the measureN() method on all plugins, handling exceptions in a consistent way.
[in,out] | measCat | lsst.afw.table.SourceCatalog containing records for just the source family to be measured, and where outputs should be written. |
[in] | beginOrder | beginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit. |
[in] | endOrder | ending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit. |
[in] | *args | Positional arguments forwarded to Plugin.measure() |
[in] | **kwds | Keyword arguments. Two are handled locally:
|
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.
|
inherited |
Call the measure() method on the nominated plugin, handling exceptions in a consistent way.
[in] | plugin | Plugin that will measure |
[in,out] | measRecord | lsst.afw.table.SourceRecord that corresponds to the object being measured, and where outputs should be written. |
[in] | *args | Positional arguments forwarded to plugin.measure() |
[in] | **kwds | Keyword 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.
|
inherited |
Call the measureN() method on the nominated plugin, handling exceptions in a consistent way.
[in] | plugin | Plugin that will measure |
[in,out] | measCat | lsst.afw.table.SourceCatalog containing records for just the source family to be measured, and where outputs should be written. |
[in] | *args | Positional arguments forwarded to plugin.measureN() |
[in] | **kwds | Keyword 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.
|
inherited |
Definition at line 214 of file baseMeasurement.py.
|
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.
def lsst.meas.base.sfm.SingleFrameMeasurementTask.measure | ( | self, | |
measCat, | |||
exposure | |||
) |
def lsst.meas.base.sfm.SingleFrameMeasurementTask.run | ( | self, | |
measCat, | |||
exposure, | |||
noiseImage = None , |
|||
exposureId = None , |
|||
beginOrder = None , |
|||
endOrder = None |
|||
) |
Run single frame measurement over an exposure and source catalog.
[in,out] | measCat | lsst.afw.table.SourceCatalog to be filled with outputs. Must contain all the SourceRecords to be measured (with Footprints attached), and have a schema that is a superset of self.schema. |
[in] | exposure | lsst.afw.image.ExposureF, containing the pixel data to be measured and the associated Psf, Wcs, etc. |
[in] | noiseImage | optional lsst.afw.image.ImageF for test which need to control noiseReplacement |
[in] | exposureId | optional unique exposureId used to calculate random number generator seed in the NoiseReplacer. |
[in] | beginOrder | beginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit. |
[in] | endOrder | ending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit. |
def lsst.meas.base.sfm.SingleFrameMeasurementTask.runPlugins | ( | self, | |
noiseReplacer, | |||
measCat, | |||
exposure, | |||
beginOrder = None , |
|||
endOrder = None |
|||
) |
Function which calls the defined measument plugins on an exposure Parameters ---------- noiseReplacer : lsst.meas.base.NoiseReplacer noiseReplacer to fill sources not being measured with noise. measCat : lsst.afw.table.SourceCatalog SourceCatalog to be filled with outputs. Must contain all the SourceRecords to be measured (with Footprints attached), and have a schema that is a superset of self.schema. exposure : lsst.afw.image.ExposureF Exposure contaning the pixel data to be measured and the associated PSF, WCS, etc. beginOrder : float beginning execution order (inclusive): measurements with executionOrder < beginOrder are not executed. None for no limit. endOrder : float ending execution order (exclusive): measurements with executionOrder >= endOrder are not executed. None for no limit.
|
inherited |
Definition at line 212 of file baseMeasurement.py.
|
static |
|
static |
|
static |
|
static |
|
static |
|
inherited |
Definition at line 208 of file baseMeasurement.py.
|
inherited |
Definition at line 209 of file baseMeasurement.py.