Detection of sources on an image with a dynamic threshold
We first detect sources using a lower threshold than normal (see config
parameter ``prelimThresholdFactor``) in order to identify good sky regions
(configurable ``skyObjects``). Then we perform forced PSF photometry on
those sky regions. Using those PSF flux measurements and estimated errors,
we set the threshold so that the stdev of the measurements matches the
median estimated error.
Besides the usual initialisation of configurables, we also set up
the forced measurement which is deliberately not represented in
this Task's configuration parameters because we're using it as
part of the algorithm and we don't want to allow it to be modified.
Definition at line 72 of file dynamicDetection.py.
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.calculateThreshold |
( |
|
self, |
|
|
|
exposure, |
|
|
|
seed, |
|
|
|
sigma = None |
|
) |
| |
Calculate new threshold
This is the main functional addition to the vanilla
`SourceDetectionTask`.
We identify sky objects and perform forced PSF photometry on
them. Using those PSF flux measurements and estimated errors,
we set the threshold so that the stdev of the measurements
matches the median estimated error.
Parameters
----------
exposureOrig : `lsst.afw.image.Exposure`
Exposure on which we're detecting sources.
seed : `int`
RNG seed to use for finding sky objects.
sigma : `float`, optional
Gaussian sigma of smoothing kernel; if not provided,
will be deduced from the exposure's PSF.
Returns
-------
result : `lsst.pipe.base.Struct`
Result struct with components:
``multiplicative``
Multiplicative factor to be applied to the
configured detection threshold (`float`).
``additive``
Additive factor to be applied to the background
level (`float`).
Raises
------
NoWorkFound
Raised if the number of good sky sources found is less than the
minimum fraction (``self.config.minFractionSources``) of the number
requested (``self.skyObjects.config.nSources``).
Definition at line 106 of file dynamicDetection.py.
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.detectFootprints |
( |
|
self, |
|
|
|
exposure, |
|
|
|
doSmooth = True , |
|
|
|
sigma = None , |
|
|
|
clearMask = True , |
|
|
|
expId = None |
|
) |
| |
Detect footprints with a dynamic threshold
This varies from the vanilla ``detectFootprints`` method because we
do detection three times: first with a high threshold to detect
"bright" (both positive and negative, the latter to identify very
over-subtracted regions) sources for which we grow the DETECTED and
DETECTED_NEGATIVE masks significantly to account for wings. Second,
with a low threshold to mask all non-empty regions of the image. These
two masks are combined and used to identify regions of sky
uncontaminated by objects. A final round of detection is then done
with the new calculated threshold.
Parameters
----------
exposure : `lsst.afw.image.Exposure`
Exposure to process; DETECTED{,_NEGATIVE} mask plane will be
set in-place.
doSmooth : `bool`, optional
If True, smooth the image before detection using a Gaussian
of width ``sigma``.
sigma : `float`, optional
Gaussian Sigma of PSF (pixels); used for smoothing and to grow
detections; if `None` then measure the sigma of the PSF of the
``exposure``.
clearMask : `bool`, optional
Clear both DETECTED and DETECTED_NEGATIVE planes before running
detection.
expId : `int`, optional
Exposure identifier, used as a seed for the random number
generator. If absent, the seed will be the sum of the image.
Returns
-------
resutls : `lsst.pipe.base.Struct`
The results `~lsst.pipe.base.Struct` contains:
``positive``
Positive polarity footprints.
(`lsst.afw.detection.FootprintSet` or `None`)
``negative``
Negative polarity footprints.
(`lsst.afw.detection.FootprintSet` or `None`)
``numPos``
Number of footprints in positive or 0 if detection polarity was
negative. (`int`)
``numNeg``
Number of footprints in negative or 0 if detection polarity was
positive. (`int`)
``background``
Re-estimated background. `None` if
``reEstimateBackground==False``.
(`lsst.afw.math.BackgroundList`)
``factor``
Multiplication factor applied to the configured detection
threshold. (`float`)
``prelim``
Results from preliminary detection pass.
(`lsst.pipe.base.Struct`)
Reimplemented from lsst.meas.algorithms.detection.SourceDetectionTask.
Definition at line 193 of file dynamicDetection.py.