LSST Applications
21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
|
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) |
def | run (self, table, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None) |
def | display (self, exposure, results, convolvedImage=None) |
def | applyTempLocalBackground (self, exposure, middle, results) |
def | clearMask (self, mask) |
def | calculateKernelSize (self, sigma) |
def | getPsf (self, exposure, sigma=None) |
def | convolveImage (self, maskedImage, psf, doSmooth=True) |
def | applyThreshold (self, middle, bbox, factor=1.0) |
def | finalizeFootprints (self, mask, results, sigma, factor=1.0) |
def | reEstimateBackground (self, maskedImage, backgrounds) |
def | clearUnwantedResults (self, mask, results) |
def | makeThreshold (self, image, thresholdParity, factor=1.0) |
def | updatePeaks (self, fpSet, image, threshold) |
def | tempWideBackgroundContext (self, exposure) |
Static Public Member Functions | |
def | setEdgeBits (maskedImage, goodBBox, edgeBitmask) |
Public Attributes | |
skySchema | |
skyMeasurement | |
negativeFlagKey | |
Static Public Attributes | |
ConfigClass = DynamicDetectionConfig | |
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.
def lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.__init__ | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
Definition at line 55 of file dynamicDetection.py.
|
inherited |
Apply a temporary local background subtraction This temporary local background serves to suppress noise fluctuations in the wings of bright objects. Peaks in the footprints will be updated. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure for which to fit local background. middle : `lsst.afw.image.MaskedImage` Convolved image on which detection will be performed (typically smaller than ``exposure`` because the half-kernel has been removed around the edges). results : `lsst.pipe.base.Struct` Results of the 'detectFootprints' method, containing positive and negative footprints (which contain the peak positions that we will plot). This is a `Struct` with ``positive`` and ``negative`` elements that are of type `lsst.afw.detection.FootprintSet`.
Definition at line 318 of file detection.py.
|
inherited |
Apply thresholds to the convolved image Identifies ``Footprint``s, both positive and negative. The threshold can be modified by the provided multiplication ``factor``. Parameters ---------- middle : `lsst.afw.image.MaskedImage` Convolved image to threshold. bbox : `lsst.geom.Box2I` Bounding box of unconvolved image. factor : `float` Multiplier for the configured threshold. Return Struct contents ---------------------- positive : `lsst.afw.detection.FootprintSet` or `None` Positive detection footprints, if configured. negative : `lsst.afw.detection.FootprintSet` or `None` Negative detection footprints, if configured. factor : `float` Multiplier for the configured threshold.
Definition at line 475 of file detection.py.
|
inherited |
Calculate size of smoothing kernel Uses the ``nSigmaForKernel`` configuration parameter. Note that that is the full width of the kernel bounding box (so a value of 7 means 3.5 sigma on either side of center). The value will be rounded up to the nearest odd integer. Parameters ---------- sigma : `float` Gaussian sigma of smoothing kernel. Returns ------- size : `int` Size of the smoothing kernel.
Definition at line 367 of file detection.py.
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.
|
inherited |
Clear the DETECTED and DETECTED_NEGATIVE mask planes Removes any previous detection mask in preparation for a new detection pass. Parameters ---------- mask : `lsst.afw.image.Mask` Mask to be cleared.
Definition at line 354 of file detection.py.
|
inherited |
Clear unwanted results from the Struct of results If we specifically want only positive or only negative detections, drop the ones we don't want, and its associated mask plane. Parameters ---------- mask : `lsst.afw.image.Mask` Mask image. results : `lsst.pipe.base.Struct` Detection results, with ``positive`` and ``negative`` elements; modified.
Definition at line 615 of file detection.py.
|
inherited |
Convolve the image with the PSF We convolve the image with a Gaussian approximation to the PSF, because this is separable and therefore fast. It's technically a correlation rather than a convolution, but since we use a symmetric Gaussian there's no difference. The convolution can be disabled with ``doSmooth=False``. If we do convolve, we mask the edges as ``EDGE`` and return the convolved image with the edges removed. This is because we can't convolve the edges because the kernel would extend off the image. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to convolve. psf : `lsst.afw.detection.Psf` PSF to convolve with (actually with a Gaussian approximation to it). doSmooth : `bool` Actually do the convolution? Set to False when running on e.g. a pre-convolved image, or a mask plane. Return Struct contents ---------------------- middle : `lsst.afw.image.MaskedImage` Convolved image, without the edges. sigma : `float` Gaussian sigma used for the convolution.
Definition at line 414 of file detection.py.
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.
|
inherited |
Display detections if so configured Displays the ``exposure`` in frame 0, overlays the detection peaks. Requires that ``lsstDebug`` has been set up correctly, so that ``lsstDebug.Info("lsst.meas.algorithms.detection")`` evaluates `True`. If the ``convolvedImage`` is non-`None` and ``lsstDebug.Info("lsst.meas.algorithms.detection") > 1``, the ``convolvedImage`` will be displayed in frame 1. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure to display, on which will be plotted the detections. results : `lsst.pipe.base.Struct` Results of the 'detectFootprints' method, containing positive and negative footprints (which contain the peak positions that we will plot). This is a `Struct` with ``positive`` and ``negative`` elements that are of type `lsst.afw.detection.FootprintSet`. convolvedImage : `lsst.afw.image.Image`, optional Convolved image used for thresholding.
Definition at line 264 of file detection.py.
|
inherited |
Finalize the detected footprints Grows the footprints, sets the ``DETECTED`` and ``DETECTED_NEGATIVE`` mask planes, and logs the results. ``numPos`` (number of positive footprints), ``numPosPeaks`` (number of positive peaks), ``numNeg`` (number of negative footprints), ``numNegPeaks`` (number of negative peaks) entries are added to the detection results. Parameters ---------- mask : `lsst.afw.image.Mask` Mask image on which to flag detected pixels. results : `lsst.pipe.base.Struct` Struct of detection results, including ``positive`` and ``negative`` entries; modified. sigma : `float` Gaussian sigma of PSF. factor : `float` Multiplier for the configured threshold.
Definition at line 524 of file detection.py.
|
inherited |
Retrieve the PSF for an exposure If ``sigma`` is provided, we make a ``GaussianPsf`` with that, otherwise use the one from the ``exposure``. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure from which to retrieve the PSF. sigma : `float`, optional Gaussian sigma to use if provided. Returns ------- psf : `lsst.afw.detection.Psf` PSF to use for detection.
Definition at line 387 of file detection.py.
|
inherited |
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. factor : `float` Factor by which to multiply the configured detection threshold. This is useful for tweaking the detection threshold slightly. Returns ------- threshold : `lsst.afw.detection.Threshold` Detection threshold.
Definition at line 707 of file detection.py.
|
inherited |
Estimate the background after detection Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image on which to estimate the background. backgrounds : `lsst.afw.math.BackgroundList` List of backgrounds; modified. Returns ------- bg : `lsst.afw.math.backgroundMI` Empirical background model.
Definition at line 586 of file detection.py.
|
inherited |
Run source detection and create a SourceCatalog of detections. Parameters ---------- table : `lsst.afw.table.SourceTable` Table object that will be used to create the SourceCatalog. exposure : `lsst.afw.image.Exposure` Exposure to process; DETECTED mask plane will be set in-place. doSmooth : `bool` If True, smooth the image before detection using a Gaussian of width ``sigma``, or the measured PSF width. Set to False when running on e.g. a pre-convolved image, or a mask plane. sigma : `float` 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` Clear DETECTED{,_NEGATIVE} planes before running detection. expId : `int` Exposure identifier; unused by this implementation, but used for RNG seed by subclasses. Returns ------- result : `lsst.pipe.base.Struct` ``sources`` The detected sources (`lsst.afw.table.SourceCatalog`) ``fpSets`` The result resturned by `detectFootprints` (`lsst.pipe.base.Struct`). Raises ------ 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. Notes ----- If you want to avoid dealing with Sources and Tables, you can use detectFootprints() to just get the `lsst.afw.detection.FootprintSet`s.
Definition at line 204 of file detection.py.
|
staticinherited |
Set the edgeBitmask bits for all of maskedImage outside goodBBox Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image on which to set edge bits in the mask. goodBBox : `lsst.geom.Box2I` Bounding box of good pixels, in ``LOCAL`` coordinates. edgeBitmask : `lsst.afw.image.MaskPixel` Bit mask to OR with the existing mask bits in the region outside ``goodBBox``.
Definition at line 785 of file detection.py.
|
inherited |
Context manager for removing wide (large-scale) background Removing a wide (large-scale) background helps to suppress the detection of large footprints that may overwhelm the deblender. It does, however, set a limit on the maximum scale of objects. The background that we remove will be restored upon exit from the context manager. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure on which to remove large-scale background. Returns ------- context : context manager Context manager that will ensure the temporary wide background is restored.
Definition at line 815 of file detection.py.
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.
|
inherited |
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 742 of file detection.py.
|
static |
Definition at line 52 of file dynamicDetection.py.
|
inherited |
Definition at line 187 of file detection.py.
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.skyMeasurement |
Definition at line 68 of file dynamicDetection.py.
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask.skySchema |
Definition at line 67 of file dynamicDetection.py.