lsst.meas.algorithms
13.0-24-g22030a45+3
|
Detect positive and negative sources on an exposure and return a new table.SourceCatalog. More...
Public Member Functions | |
def | __init__ (self, schema=None, kwds) |
Create the detection task. More... | |
def | run (self, table, exposure, doSmooth=True, sigma=None, clearMask=True) |
Run source detection and create a SourceCatalog. More... | |
def | detectFootprints (self, exposure, doSmooth=True, sigma=None, clearMask=True) |
Detect footprints. More... | |
def | makeThreshold (self, image, thresholdParity) |
def | updatePeaks (self, fpSet, image, threshold) |
Static Public Member Functions | |
def | setEdgeBits (maskedImage, goodBBox, edgeBitmask) |
Set the edgeBitmask bits for all of maskedImage outside goodBBox. More... | |
Public Attributes | |
negativeFlagKey | |
Static Public Attributes | |
ConfigClass = SourceDetectionConfig | |
def | makeSourceCatalog = run |
An alias for run. More... | |
Detect positive and negative sources on an exposure and return a new table.SourceCatalog.
Detect positive and negative sources on an exposure and return a new table.SourceCatalog.
Create the detection task. Most arguments are simply passed onto pipe.base.Task.
schema | An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog |
**kwds | Keyword arguments passed to lsst.pipe.base.task.Task.__init__. |
If schema is not None and configured for 'both' detections, a 'flags.negative' field will be added to label detections made with a negative threshold.
Run source detection and create a SourceCatalog.
table | lsst.afw.table.SourceTable object that will be used to create the SourceCatalog. |
exposure | Exposure to process; DETECTED mask plane will be set in-place. |
doSmooth | if True, smooth the image before detection using a Gaussian of width sigma (default: True) |
sigma | sigma of PSF (pixels); used for smoothing and to grow detections; if None then measure the sigma of the PSF of the exposure (default: None) |
clearMask | Clear DETECTED{,_NEGATIVE} planes before running detection (default: True) |
ValueError | if flags.negative is needed, but isn't in table's schema |
lsst.pipe.base.TaskError | if sigma=None, doSmooth=True and the exposure has no PSF |
The command line task interface supports a flag -d
to import debug.py from your PYTHONPATH
; see baseDebug for more about debug.py files.
The available variables in SourceDetectionTask are:
display
This code is in measAlgTasks.py in the examples directory, and can be run as e.g.
Import the task (there are some other standard imports; read the file if you're confused)
We need to create our task before processing any data as the task constructor can add an extra column to the schema, but first we need an almost-empty Schema
We're now ready to process the data (we could loop over multiple exposures/catalogues using the same task objects). First create the output table:
And process the image
We can then unpack and use the results:
To investigate the Debug variables, put something like
into your debug.py file and run measAlgTasks.py with the –debug
flag.
Definition at line 126 of file detection.py.
def lsst.meas.algorithms.detection.SourceDetectionTask.__init__ | ( | self, | |
schema = None , |
|||
kwds | |||
) |
Create the detection task.
Most arguments are simply passed onto pipe.base.Task.
schema | An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog |
**kwds | Keyword arguments passed to lsst.pipe.base.task.Task.__init__. |
If schema is not None and configured for 'both' detections, a 'flags.negative' field will be added to label detections made with a negative threshold.
Definition at line 222 of file detection.py.
def lsst.meas.algorithms.detection.SourceDetectionTask.detectFootprints | ( | self, | |
exposure, | |||
doSmooth = True , |
|||
sigma = None , |
|||
clearMask = True |
|||
) |
Detect footprints.
exposure | Exposure to process; DETECTED{,_NEGATIVE} mask plane will be set in-place. |
doSmooth | if True, smooth the image before detection using a Gaussian of width sigma |
sigma | sigma of PSF (pixels); used for smoothing and to grow detections; if None then measure the sigma of the PSF of the exposure |
clearMask | Clear both DETECTED and DETECTED_NEGATIVE planes before running detection |
lsst.pipe.base.TaskError | if sigma=None and the exposure has no PSF |
Definition at line 296 of file detection.py.
def lsst.meas.algorithms.detection.SourceDetectionTask.makeThreshold | ( | self, | |
image, | |||
thresholdParity | |||
) |
Make an afw.detection.Threshold object corresponding to the task's configuration and the statistics of the given image. Parameters ---------- image : `afw.image.MaskedImage` Image to measure noise statistics from if needed. thresholdParity: `str` One of "positive" or "negative", to set the kind of fluctuations the Threshold will detect.
Definition at line 477 of file detection.py.
def lsst.meas.algorithms.detection.SourceDetectionTask.run | ( | self, | |
table, | |||
exposure, | |||
doSmooth = True , |
|||
sigma = None , |
|||
clearMask = True |
|||
) |
Run source detection and create a SourceCatalog.
table | lsst.afw.table.SourceTable object that will be used to create the SourceCatalog. |
exposure | Exposure to process; DETECTED mask plane will be set in-place. |
doSmooth | if True, smooth the image before detection using a Gaussian of width sigma (default: True) |
sigma | sigma of PSF (pixels); used for smoothing and to grow detections; if None then measure the sigma of the PSF of the exposure (default: None) |
clearMask | Clear DETECTED{,_NEGATIVE} planes before running detection (default: True) |
ValueError | if flags.negative is needed, but isn't in table's schema |
lsst.pipe.base.TaskError | if sigma=None, doSmooth=True and the exposure has no PSF |
Definition at line 252 of file detection.py.
|
static |
Set the edgeBitmask bits for all of maskedImage outside goodBBox.
[in,out] | maskedImage | image on which to set edge bits in the mask |
[in] | goodBBox | bounding box of good pixels, in LOCAL coordinates |
[in] | edgeBitmask | bit mask to OR with the existing mask bits in the region outside goodBBox |
Definition at line 552 of file detection.py.
def lsst.meas.algorithms.detection.SourceDetectionTask.updatePeaks | ( | self, | |
fpSet, | |||
image, | |||
threshold | |||
) |
Update the Peaks in a FootprintSet by detecting new Footprints and Peaks in an image and using the new Peaks instead of the old ones. Parameters ---------- fpSet : `afw.detection.FootprintSet` Set of Footprints whose Peaks should be updated. image : `afw.image.MaskedImage` Image to detect new Footprints and Peak in. threshold : `afw.detection.Threshold` Threshold object for detection. Input Footprints with fewer Peaks than self.config.nPeaksMaxSimple are not modified, and if no new Peaks are detected in an input Footprint, the brightest original Peak in that Footprint is kept.
Definition at line 509 of file detection.py.
|
static |
Definition at line 219 of file detection.py.
|
static |
An alias for run.
Definition at line 293 of file detection.py.
lsst.meas.algorithms.detection.SourceDetectionTask.negativeFlagKey |
Definition at line 237 of file detection.py.