lsst.meas.algorithms gbe01a4569f+c282027174
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask Class Reference
Inheritance diagram for lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask:
lsst.meas.algorithms.detection.SourceDetectionTask

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def calculateThreshold (self, exposure, seed, sigma=None)
 
def detectFootprints (self, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None)
 
def tweakBackground (self, exposure, bgLevel, bgList=None)
 

Public Attributes

 skySchema
 
 skyMeasurement
 

Static Public Attributes

 ConfigClass = DynamicDetectionConfig
 

Detailed Description

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 37 of file dynamicDetection.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.__init__ (   self,
args,
**  kwargs 
)

Reimplemented from lsst.meas.algorithms.detection.SourceDetectionTask.

Definition at line 55 of file dynamicDetection.py.

Member Function Documentation

◆ calculateThreshold()

def 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
----------
exposure : `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`).

Definition at line 71 of file dynamicDetection.py.

◆ detectFootprints()

def 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 twice: one with a low threshold so that we can find
sky uncontaminated by objects, then one more 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.

Return Struct contents
----------------------
positive : `lsst.afw.detection.FootprintSet`
    Positive polarity footprints (may be `None`)
negative : `lsst.afw.detection.FootprintSet`
    Negative polarity footprints (may be `None`)
numPos : `int`
    Number of footprints in positive or 0 if detection polarity was
    negative.
numNeg : `int`
    Number of footprints in negative or 0 if detection polarity was
    positive.
background : `lsst.afw.math.BackgroundList`
    Re-estimated background.  `None` if
    ``reEstimateBackground==False``.
factor : `float`
    Multiplication factor applied to the configured detection
    threshold.
prelim : `lsst.pipe.base.Struct`
    Results from preliminary detection pass.

Reimplemented from lsst.meas.algorithms.detection.SourceDetectionTask.

Definition at line 140 of file dynamicDetection.py.

◆ tweakBackground()

def lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.tweakBackground (   self,
  exposure,
  bgLevel,
  bgList = None 
)
Modify the background by a constant value

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure for which to tweak background.
bgLevel : `float`
    Background level to remove
bgList : `lsst.afw.math.BackgroundList`, optional
    List of backgrounds to append to.

Returns
-------
bg : `lsst.afw.math.BackgroundMI`
    Constant background model.

Definition at line 254 of file dynamicDetection.py.

Member Data Documentation

◆ ConfigClass

lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.ConfigClass = DynamicDetectionConfig
static

Definition at line 52 of file dynamicDetection.py.

◆ skyMeasurement

lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.skyMeasurement

Definition at line 68 of file dynamicDetection.py.

◆ skySchema

lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.skySchema

Definition at line 67 of file dynamicDetection.py.


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