LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
A subtask for measuring the properties of sources on a single exposure. More...
Public Member Functions | |
def | __init__ |
Initialize the task. More... | |
def | run |
Run single frame measurement over an exposure and source catalog. More... | |
def | measure |
Backwards-compatibility alias for run() More... | |
Public Attributes | |
schema | |
Static Public Attributes | |
ConfigClass = SingleFrameMeasurementConfig | |
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__ |
Definition at line 232 of file sfm.py.
def lsst.meas.base.sfm.SingleFrameMeasurementTask.measure | ( | self, | |
measCat, | |||
exposure | |||
) |
Backwards-compatibility alias for run()
Definition at line 331 of file sfm.py.
def lsst.meas.base.sfm.SingleFrameMeasurementTask.run | ( | self, | |
measCat, | |||
exposure, | |||
noiseImage = None , |
|||
exposureId = None , |
|||
beginOrder = None , |
|||
endOrder = None , |
|||
allowApCorr = True |
|||
) |
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. |
[in] | allowApCorr | allow application of aperture correction? |
Definition at line 251 of file sfm.py.
|
static |