LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.algorithms.detection.SourceDetectionTask Class Reference

Detect positive and negative sources on an exposure and return a new table.SourceCatalog. More...

Inheritance diagram for lsst.meas.algorithms.detection.SourceDetectionTask:
lsst.meas.algorithms.dynamicDetection.DynamicDetectionTask

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, 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 detectFootprints (self, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None)
 
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

 negativeFlagKey
 

Static Public Attributes

 ConfigClass = SourceDetectionConfig
 
def makeSourceCatalog = run
 An alias for run. More...
 

Detailed Description

Detect positive and negative sources on an exposure and return a new table.SourceCatalog.

Contents

Description

Detect positive and negative sources on an exposure and return a new table.SourceCatalog.

Task initialisation

Create the detection task. Most arguments are simply passed onto pipe.base.Task.

Parameters
schemaAn lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
**kwdsKeyword 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.

Note
This task can add fields to the schema, so any code calling this task must ensure that these columns are indeed present in the input match list; see Example

Invoking the Task

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.

Configuration parameters

See SourceDetectionConfig

Debug variables

The command line task interface supports a flag -d to import debug.py from your PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py files.

The available variables in SourceDetectionTask are:

display
  • If True, display the exposure on afwDisplay.Display's frame 0. +ve detections in blue, -ve detections in cyan
  • If display > 1, display the convolved exposure on frame 1

A complete example of using SourceDetectionTask

This code is in measAlgTasks.py in the examples directory, and can be run as e.g.

examples/measAlgTasks.py --doDisplay
The example also runs the SingleFrameMeasurementTask; see meas_algorithms_measurement_Example for more explanation.

Import the task (there are some other standard imports; read the file if you're confused)

from lsst.meas.algorithms.detection import SourceDetectionTask

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

schema = afwTable.SourceTable.makeMinimalSchema()
after which we can call the constructor:
config = SourceDetectionTask.ConfigClass()
config.thresholdPolarity = "both"
config.background.isNanSafe = True
config.thresholdValue = 3
detectionTask = SourceDetectionTask(config=config, schema=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:

tab = afwTable.SourceTable.make(schema)

And process the image

result = detectionTask.run(tab, exposure)
(You may not be happy that the threshold was set in the config before creating the Task rather than being set separately for each exposure. You can reset it just before calling the run method if you must, but we should really implement a better solution).

We can then unpack and use the results:

sources = result.sources
print("Found %d sources (%d +ve, %d -ve)" % (len(sources), result.fpSets.numPos, result.fpSets.numNeg))


To investigate the Debug variables, put something like

import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name == "lsst.meas.algorithms.detection":
di.display = 1
return di
lsstDebug.Info = DebugInfo

into your debug.py file and run measAlgTasks.py with the –debug flag.

Definition at line 168 of file detection.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.algorithms.detection.SourceDetectionTask.__init__ (   self,
  schema = None,
  kwds 
)

Create the detection task.

Most arguments are simply passed onto pipe.base.Task.

Parameters
schemaAn lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
**kwdsKeyword 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.

Note
This task can add fields to the schema, so any code calling this task must ensure that these columns are indeed present in the input match list; see Example

Definition at line 265 of file detection.py.

265  def __init__(self, schema=None, **kwds):
266  """!Create the detection task. Most arguments are simply passed onto pipe.base.Task.
267 
268  @param schema An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
269  @param **kwds Keyword arguments passed to lsst.pipe.base.task.Task.__init__.
270 
271  If schema is not None and configured for 'both' detections,
272  a 'flags.negative' field will be added to label detections made with a
273  negative threshold.
274 
275  @note This task can add fields to the schema, so any code calling this task must ensure that
276  these columns are indeed present in the input match list; see @ref Example
277  """
278  pipeBase.Task.__init__(self, **kwds)
279  if schema is not None and self.config.thresholdPolarity == "both":
280  self.negativeFlagKey = schema.addField(
281  "flags_negative", type="Flag",
282  doc="set if source was detected as significantly negative"
283  )
284  else:
285  if self.config.thresholdPolarity == "both":
286  self.log.warn("Detection polarity set to 'both', but no flag will be "
287  "set to distinguish between positive and negative detections")
288  self.negativeFlagKey = None
289  if self.config.reEstimateBackground:
290  self.makeSubtask("background")
291  if self.config.doTempLocalBackground:
292  self.makeSubtask("tempLocalBackground")
293  if self.config.doTempWideBackground:
294  self.makeSubtask("tempWideBackground")
295 

Member Function Documentation

◆ applyTempLocalBackground()

def lsst.meas.algorithms.detection.SourceDetectionTask.applyTempLocalBackground (   self,
  exposure,
  middle,
  results 
)
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 414 of file detection.py.

414  def applyTempLocalBackground(self, exposure, middle, results):
415  """Apply a temporary local background subtraction
416 
417  This temporary local background serves to suppress noise fluctuations
418  in the wings of bright objects.
419 
420  Peaks in the footprints will be updated.
421 
422  Parameters
423  ----------
424  exposure : `lsst.afw.image.Exposure`
425  Exposure for which to fit local background.
426  middle : `lsst.afw.image.MaskedImage`
427  Convolved image on which detection will be performed
428  (typically smaller than ``exposure`` because the
429  half-kernel has been removed around the edges).
430  results : `lsst.pipe.base.Struct`
431  Results of the 'detectFootprints' method, containing positive and
432  negative footprints (which contain the peak positions that we will
433  plot). This is a `Struct` with ``positive`` and ``negative``
434  elements that are of type `lsst.afw.detection.FootprintSet`.
435  """
436  # Subtract the local background from the smoothed image. Since we
437  # never use the smoothed again we don't need to worry about adding
438  # it back in.
439  bg = self.tempLocalBackground.fitBackground(exposure.getMaskedImage())
440  bgImage = bg.getImageF()
441  middle -= bgImage.Factory(bgImage, middle.getBBox())
442  thresholdPos = self.makeThreshold(middle, "positive")
443  thresholdNeg = self.makeThreshold(middle, "negative")
444  if self.config.thresholdPolarity != "negative":
445  self.updatePeaks(results.positive, middle, thresholdPos)
446  if self.config.thresholdPolarity != "positive":
447  self.updatePeaks(results.negative, middle, thresholdNeg)
448 

◆ applyThreshold()

def lsst.meas.algorithms.detection.SourceDetectionTask.applyThreshold (   self,
  middle,
  bbox,
  factor = 1.0 
)
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 570 of file detection.py.

570  def applyThreshold(self, middle, bbox, factor=1.0):
571  """Apply thresholds to the convolved image
572 
573  Identifies ``Footprint``s, both positive and negative.
574 
575  The threshold can be modified by the provided multiplication
576  ``factor``.
577 
578  Parameters
579  ----------
580  middle : `lsst.afw.image.MaskedImage`
581  Convolved image to threshold.
582  bbox : `lsst.geom.Box2I`
583  Bounding box of unconvolved image.
584  factor : `float`
585  Multiplier for the configured threshold.
586 
587  Return Struct contents
588  ----------------------
589  positive : `lsst.afw.detection.FootprintSet` or `None`
590  Positive detection footprints, if configured.
591  negative : `lsst.afw.detection.FootprintSet` or `None`
592  Negative detection footprints, if configured.
593  factor : `float`
594  Multiplier for the configured threshold.
595  """
596  results = pipeBase.Struct(positive=None, negative=None, factor=factor)
597  # Detect the Footprints (peaks may be replaced if doTempLocalBackground)
598  if self.config.reEstimateBackground or self.config.thresholdPolarity != "negative":
599  threshold = self.makeThreshold(middle, "positive", factor=factor)
600  results.positive = afwDet.FootprintSet(
601  middle,
602  threshold,
603  "DETECTED",
604  self.config.minPixels
605  )
606  results.positive.setRegion(bbox)
607  if self.config.reEstimateBackground or self.config.thresholdPolarity != "positive":
608  threshold = self.makeThreshold(middle, "negative", factor=factor)
609  results.negative = afwDet.FootprintSet(
610  middle,
611  threshold,
612  "DETECTED_NEGATIVE",
613  self.config.minPixels
614  )
615  results.negative.setRegion(bbox)
616 
617  return results
618 
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53

◆ calculateKernelSize()

def lsst.meas.algorithms.detection.SourceDetectionTask.calculateKernelSize (   self,
  sigma 
)
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 462 of file detection.py.

462  def calculateKernelSize(self, sigma):
463  """Calculate size of smoothing kernel
464 
465  Uses the ``nSigmaForKernel`` configuration parameter. Note
466  that that is the full width of the kernel bounding box
467  (so a value of 7 means 3.5 sigma on either side of center).
468  The value will be rounded up to the nearest odd integer.
469 
470  Parameters
471  ----------
472  sigma : `float`
473  Gaussian sigma of smoothing kernel.
474 
475  Returns
476  -------
477  size : `int`
478  Size of the smoothing kernel.
479  """
480  return (int(sigma * self.config.nSigmaForKernel + 0.5)//2)*2 + 1 # make sure it is odd
481 

◆ clearMask()

def lsst.meas.algorithms.detection.SourceDetectionTask.clearMask (   self,
  mask 
)
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 449 of file detection.py.

449  def clearMask(self, mask):
450  """Clear the DETECTED and DETECTED_NEGATIVE mask planes
451 
452  Removes any previous detection mask in preparation for a new
453  detection pass.
454 
455  Parameters
456  ----------
457  mask : `lsst.afw.image.Mask`
458  Mask to be cleared.
459  """
460  mask &= ~(mask.getPlaneBitMask("DETECTED") | mask.getPlaneBitMask("DETECTED_NEGATIVE"))
461 

◆ clearUnwantedResults()

def lsst.meas.algorithms.detection.SourceDetectionTask.clearUnwantedResults (   self,
  mask,
  results 
)
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 705 of file detection.py.

705  def clearUnwantedResults(self, mask, results):
706  """Clear unwanted results from the Struct of results
707 
708  If we specifically want only positive or only negative detections,
709  drop the ones we don't want, and its associated mask plane.
710 
711  Parameters
712  ----------
713  mask : `lsst.afw.image.Mask`
714  Mask image.
715  results : `lsst.pipe.base.Struct`
716  Detection results, with ``positive`` and ``negative`` elements;
717  modified.
718  """
719  if self.config.thresholdPolarity == "positive":
720  if self.config.reEstimateBackground:
721  mask &= ~mask.getPlaneBitMask("DETECTED_NEGATIVE")
722  results.negative = None
723  elif self.config.thresholdPolarity == "negative":
724  if self.config.reEstimateBackground:
725  mask &= ~mask.getPlaneBitMask("DETECTED")
726  results.positive = None
727 

◆ convolveImage()

def lsst.meas.algorithms.detection.SourceDetectionTask.convolveImage (   self,
  maskedImage,
  psf,
  doSmooth = True 
)
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 509 of file detection.py.

509  def convolveImage(self, maskedImage, psf, doSmooth=True):
510  """Convolve the image with the PSF
511 
512  We convolve the image with a Gaussian approximation to the PSF,
513  because this is separable and therefore fast. It's technically a
514  correlation rather than a convolution, but since we use a symmetric
515  Gaussian there's no difference.
516 
517  The convolution can be disabled with ``doSmooth=False``. If we do
518  convolve, we mask the edges as ``EDGE`` and return the convolved image
519  with the edges removed. This is because we can't convolve the edges
520  because the kernel would extend off the image.
521 
522  Parameters
523  ----------
524  maskedImage : `lsst.afw.image.MaskedImage`
525  Image to convolve.
526  psf : `lsst.afw.detection.Psf`
527  PSF to convolve with (actually with a Gaussian approximation
528  to it).
529  doSmooth : `bool`
530  Actually do the convolution? Set to False when running on
531  e.g. a pre-convolved image, or a mask plane.
532 
533  Return Struct contents
534  ----------------------
535  middle : `lsst.afw.image.MaskedImage`
536  Convolved image, without the edges.
537  sigma : `float`
538  Gaussian sigma used for the convolution.
539  """
540  self.metadata.set("doSmooth", doSmooth)
541  sigma = psf.computeShape().getDeterminantRadius()
542  self.metadata.set("sigma", sigma)
543 
544  if not doSmooth:
545  middle = maskedImage.Factory(maskedImage)
546  return pipeBase.Struct(middle=middle, sigma=sigma)
547 
548  # Smooth using a Gaussian (which is separable, hence fast) of width sigma
549  # Make a SingleGaussian (separable) kernel with the 'sigma'
550  kWidth = self.calculateKernelSize(sigma)
551  self.metadata.set("smoothingKernelWidth", kWidth)
552  gaussFunc = afwMath.GaussianFunction1D(sigma)
553  gaussKernel = afwMath.SeparableKernel(kWidth, kWidth, gaussFunc, gaussFunc)
554 
555  convolvedImage = maskedImage.Factory(maskedImage.getBBox())
556 
557  afwMath.convolve(convolvedImage, maskedImage, gaussKernel, afwMath.ConvolutionControl())
558  #
559  # Only search psf-smoothed part of frame
560  #
561  goodBBox = gaussKernel.shrinkBBox(convolvedImage.getBBox())
562  middle = convolvedImage.Factory(convolvedImage, goodBBox, afwImage.PARENT, False)
563  #
564  # Mark the parts of the image outside goodBBox as EDGE
565  #
566  self.setEdgeBits(maskedImage, goodBBox, maskedImage.getMask().getPlaneBitMask("EDGE"))
567 
568  return pipeBase.Struct(middle=middle, sigma=sigma)
569 
Parameters to control convolution.
Definition: ConvolveImage.h:50
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:907
daf::base::PropertySet * set
Definition: fits.cc:902
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, bool doNormalize, bool doCopyEdge=false)
Old, deprecated version of convolve.

◆ detectFootprints()

def lsst.meas.algorithms.detection.SourceDetectionTask.detectFootprints (   self,
  exposure,
  doSmooth = True,
  sigma = None,
  clearMask = True,
  expId = None 
)
Detect footprints on an exposure.

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``, or the measured PSF width of ``exposure``.
    Set to False when running on e.g. a pre-convolved image, or a mask
    plane.
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 : `dict`, optional
    Exposure identifier; unused by this implementation, but used for
    RNG seed by subclasses.

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.

Definition at line 729 of file detection.py.

729  def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None):
730  """Detect footprints on an exposure.
731 
732  Parameters
733  ----------
734  exposure : `lsst.afw.image.Exposure`
735  Exposure to process; DETECTED{,_NEGATIVE} mask plane will be
736  set in-place.
737  doSmooth : `bool`, optional
738  If True, smooth the image before detection using a Gaussian
739  of width ``sigma``, or the measured PSF width of ``exposure``.
740  Set to False when running on e.g. a pre-convolved image, or a mask
741  plane.
742  sigma : `float`, optional
743  Gaussian Sigma of PSF (pixels); used for smoothing and to grow
744  detections; if `None` then measure the sigma of the PSF of the
745  ``exposure``.
746  clearMask : `bool`, optional
747  Clear both DETECTED and DETECTED_NEGATIVE planes before running
748  detection.
749  expId : `dict`, optional
750  Exposure identifier; unused by this implementation, but used for
751  RNG seed by subclasses.
752 
753  Return Struct contents
754  ----------------------
755  positive : `lsst.afw.detection.FootprintSet`
756  Positive polarity footprints (may be `None`)
757  negative : `lsst.afw.detection.FootprintSet`
758  Negative polarity footprints (may be `None`)
759  numPos : `int`
760  Number of footprints in positive or 0 if detection polarity was
761  negative.
762  numNeg : `int`
763  Number of footprints in negative or 0 if detection polarity was
764  positive.
765  background : `lsst.afw.math.BackgroundList`
766  Re-estimated background. `None` if
767  ``reEstimateBackground==False``.
768  factor : `float`
769  Multiplication factor applied to the configured detection
770  threshold.
771  """
772  maskedImage = exposure.maskedImage
773 
774  if clearMask:
775  self.clearMask(maskedImage.getMask())
776 
777  psf = self.getPsf(exposure, sigma=sigma)
778  with self.tempWideBackgroundContext(exposure):
779  convolveResults = self.convolveImage(maskedImage, psf, doSmooth=doSmooth)
780  middle = convolveResults.middle
781  sigma = convolveResults.sigma
782 
783  results = self.applyThreshold(middle, maskedImage.getBBox())
784  results.background = afwMath.BackgroundList()
785  if self.config.doTempLocalBackground:
786  self.applyTempLocalBackground(exposure, middle, results)
787  self.finalizeFootprints(maskedImage.mask, results, sigma)
788 
789  if self.config.reEstimateBackground:
790  self.reEstimateBackground(maskedImage, results.background)
791 
792  self.clearUnwantedResults(maskedImage.getMask(), results)
793  self.display(exposure, results, middle)
794 
795  return results
796 

◆ display()

def lsst.meas.algorithms.detection.SourceDetectionTask.display (   self,
  exposure,
  results,
  convolvedImage = None 
)
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 360 of file detection.py.

360  def display(self, exposure, results, convolvedImage=None):
361  """Display detections if so configured
362 
363  Displays the ``exposure`` in frame 0, overlays the detection peaks.
364 
365  Requires that ``lsstDebug`` has been set up correctly, so that
366  ``lsstDebug.Info("lsst.meas.algorithms.detection")`` evaluates `True`.
367 
368  If the ``convolvedImage`` is non-`None` and
369  ``lsstDebug.Info("lsst.meas.algorithms.detection") > 1``, the
370  ``convolvedImage`` will be displayed in frame 1.
371 
372  Parameters
373  ----------
374  exposure : `lsst.afw.image.Exposure`
375  Exposure to display, on which will be plotted the detections.
376  results : `lsst.pipe.base.Struct`
377  Results of the 'detectFootprints' method, containing positive and
378  negative footprints (which contain the peak positions that we will
379  plot). This is a `Struct` with ``positive`` and ``negative``
380  elements that are of type `lsst.afw.detection.FootprintSet`.
381  convolvedImage : `lsst.afw.image.Image`, optional
382  Convolved image used for thresholding.
383  """
384  try:
385  import lsstDebug
386  display = lsstDebug.Info(__name__).display
387  except ImportError:
388  try:
389  display
390  except NameError:
391  display = False
392  if not display:
393  return
394 
395  afwDisplay.setDefaultMaskTransparency(75)
396 
397  disp0 = afwDisplay.Display(frame=0)
398  disp0.mtv(exposure, title="detection")
399 
400  def plotPeaks(fps, ctype):
401  if fps is None:
402  return
403  with disp0.Buffering():
404  for fp in fps.getFootprints():
405  for pp in fp.getPeaks():
406  disp0.dot("+", pp.getFx(), pp.getFy(), ctype=ctype)
407  plotPeaks(results.positive, "yellow")
408  plotPeaks(results.negative, "red")
409 
410  if convolvedImage and display > 1:
411  disp1 = afwDisplay.Display(frame=1)
412  disp1.mtv(convolvedImage, title="PSF smoothed")
413 

◆ finalizeFootprints()

def lsst.meas.algorithms.detection.SourceDetectionTask.finalizeFootprints (   self,
  mask,
  results,
  sigma,
  factor = 1.0 
)
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 619 of file detection.py.

619  def finalizeFootprints(self, mask, results, sigma, factor=1.0):
620  """Finalize the detected footprints
621 
622  Grows the footprints, sets the ``DETECTED`` and ``DETECTED_NEGATIVE``
623  mask planes, and logs the results.
624 
625  ``numPos`` (number of positive footprints), ``numPosPeaks`` (number
626  of positive peaks), ``numNeg`` (number of negative footprints),
627  ``numNegPeaks`` (number of negative peaks) entries are added to the
628  detection results.
629 
630  Parameters
631  ----------
632  mask : `lsst.afw.image.Mask`
633  Mask image on which to flag detected pixels.
634  results : `lsst.pipe.base.Struct`
635  Struct of detection results, including ``positive`` and
636  ``negative`` entries; modified.
637  sigma : `float`
638  Gaussian sigma of PSF.
639  factor : `float`
640  Multiplier for the configured threshold.
641  """
642  for polarity, maskName in (("positive", "DETECTED"), ("negative", "DETECTED_NEGATIVE")):
643  fpSet = getattr(results, polarity)
644  if fpSet is None:
645  continue
646  if self.config.nSigmaToGrow > 0:
647  nGrow = int((self.config.nSigmaToGrow * sigma) + 0.5)
648  self.metadata.set("nGrow", nGrow)
649  if self.config.combinedGrow:
650  fpSet = afwDet.FootprintSet(fpSet, nGrow, self.config.isotropicGrow)
651  else:
652  stencil = (afwGeom.Stencil.CIRCLE if self.config.isotropicGrow else
653  afwGeom.Stencil.MANHATTAN)
654  for fp in fpSet:
655  fp.dilate(nGrow, stencil)
656  fpSet.setMask(mask, maskName)
657  if not self.config.returnOriginalFootprints:
658  setattr(results, polarity, fpSet)
659 
660  results.numPos = 0
661  results.numPosPeaks = 0
662  results.numNeg = 0
663  results.numNegPeaks = 0
664  positive = ""
665  negative = ""
666 
667  if results.positive is not None:
668  results.numPos = len(results.positive.getFootprints())
669  results.numPosPeaks = sum(len(fp.getPeaks()) for fp in results.positive.getFootprints())
670  positive = " %d positive peaks in %d footprints" % (results.numPosPeaks, results.numPos)
671  if results.negative is not None:
672  results.numNeg = len(results.negative.getFootprints())
673  results.numNegPeaks = sum(len(fp.getPeaks()) for fp in results.negative.getFootprints())
674  negative = " %d negative peaks in %d footprints" % (results.numNegPeaks, results.numNeg)
675 
676  self.log.info("Detected%s%s%s to %g %s" %
677  (positive, " and" if positive and negative else "", negative,
678  self.config.thresholdValue*self.config.includeThresholdMultiplier*factor,
679  "DN" if self.config.thresholdType == "value" else "sigma"))
680 
daf::base::PropertySet * set
Definition: fits.cc:902
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53

◆ getPsf()

def lsst.meas.algorithms.detection.SourceDetectionTask.getPsf (   self,
  exposure,
  sigma = None 
)
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 482 of file detection.py.

482  def getPsf(self, exposure, sigma=None):
483  """Retrieve the PSF for an exposure
484 
485  If ``sigma`` is provided, we make a ``GaussianPsf`` with that,
486  otherwise use the one from the ``exposure``.
487 
488  Parameters
489  ----------
490  exposure : `lsst.afw.image.Exposure`
491  Exposure from which to retrieve the PSF.
492  sigma : `float`, optional
493  Gaussian sigma to use if provided.
494 
495  Returns
496  -------
497  psf : `lsst.afw.detection.Psf`
498  PSF to use for detection.
499  """
500  if sigma is None:
501  psf = exposure.getPsf()
502  if psf is None:
503  raise RuntimeError("Unable to determine PSF to use for detection: no sigma provided")
504  sigma = psf.computeShape().getDeterminantRadius()
505  size = self.calculateKernelSize(sigma)
506  psf = afwDet.GaussianPsf(size, size, sigma)
507  return psf
508 
A circularly symmetric Gaussian Psf class with no spatial variation, intended mostly for testing purp...
Definition: GaussianPsf.h:42

◆ makeThreshold()

def lsst.meas.algorithms.detection.SourceDetectionTask.makeThreshold (   self,
  image,
  thresholdParity,
  factor = 1.0 
)
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 797 of file detection.py.

797  def makeThreshold(self, image, thresholdParity, factor=1.0):
798  """Make an afw.detection.Threshold object corresponding to the task's
799  configuration and the statistics of the given image.
800 
801  Parameters
802  ----------
803  image : `afw.image.MaskedImage`
804  Image to measure noise statistics from if needed.
805  thresholdParity: `str`
806  One of "positive" or "negative", to set the kind of fluctuations
807  the Threshold will detect.
808  factor : `float`
809  Factor by which to multiply the configured detection threshold.
810  This is useful for tweaking the detection threshold slightly.
811 
812  Returns
813  -------
814  threshold : `lsst.afw.detection.Threshold`
815  Detection threshold.
816  """
817  parity = False if thresholdParity == "negative" else True
818  thresholdValue = self.config.thresholdValue
819  thresholdType = self.config.thresholdType
820  if self.config.thresholdType == 'stdev':
821  bad = image.getMask().getPlaneBitMask(self.config.statsMask)
822  sctrl = afwMath.StatisticsControl()
823  sctrl.setAndMask(bad)
824  stats = afwMath.makeStatistics(image, afwMath.STDEVCLIP, sctrl)
825  thresholdValue *= stats.getValue(afwMath.STDEVCLIP)
826  thresholdType = 'value'
827 
828  threshold = afwDet.createThreshold(thresholdValue*factor, thresholdType, parity)
829  threshold.setIncludeMultiplier(self.config.includeThresholdMultiplier)
830  return threshold
831 
Statistics makeStatistics(lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>
Definition: Statistics.h:520
Pass parameters to a Statistics object.
Definition: Statistics.h:93
Threshold createThreshold(const double value, const std::string type="value", const bool polarity=true)
Factory method for creating Threshold objects.
Definition: Threshold.cc:109

◆ reEstimateBackground()

def lsst.meas.algorithms.detection.SourceDetectionTask.reEstimateBackground (   self,
  maskedImage,
  backgrounds 
)
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 681 of file detection.py.

681  def reEstimateBackground(self, maskedImage, backgrounds):
682  """Estimate the background after detection
683 
684  Parameters
685  ----------
686  maskedImage : `lsst.afw.image.MaskedImage`
687  Image on which to estimate the background.
688  backgrounds : `lsst.afw.math.BackgroundList`
689  List of backgrounds; modified.
690 
691  Returns
692  -------
693  bg : `lsst.afw.math.backgroundMI`
694  Empirical background model.
695  """
696  bg = self.background.fitBackground(maskedImage)
697  if self.config.adjustBackground:
698  self.log.warn("Fiddling the background by %g", self.config.adjustBackground)
699  bg += self.config.adjustBackground
700  self.log.info("Resubtracting the background after object detection")
701  maskedImage -= bg.getImageF()
702  backgrounds.append(bg)
703  return bg
704 

◆ run()

def lsst.meas.algorithms.detection.SourceDetectionTask.run (   self,
  table,
  exposure,
  doSmooth = True,
  sigma = None,
  clearMask = True,
  expId = None 
)
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 297 of file detection.py.

297  def run(self, table, exposure, doSmooth=True, sigma=None, clearMask=True, expId=None):
298  """Run source detection and create a SourceCatalog of detections.
299 
300  Parameters
301  ----------
302  table : `lsst.afw.table.SourceTable`
303  Table object that will be used to create the SourceCatalog.
304  exposure : `lsst.afw.image.Exposure`
305  Exposure to process; DETECTED mask plane will be set in-place.
306  doSmooth : `bool`
307  If True, smooth the image before detection using a Gaussian of width
308  ``sigma``, or the measured PSF width. Set to False when running on
309  e.g. a pre-convolved image, or a mask plane.
310  sigma : `float`
311  Sigma of PSF (pixels); used for smoothing and to grow detections;
312  if None then measure the sigma of the PSF of the exposure
313  clearMask : `bool`
314  Clear DETECTED{,_NEGATIVE} planes before running detection.
315  expId : `int`
316  Exposure identifier; unused by this implementation, but used for
317  RNG seed by subclasses.
318 
319  Returns
320  -------
321  result : `lsst.pipe.base.Struct`
322  ``sources``
323  The detected sources (`lsst.afw.table.SourceCatalog`)
324  ``fpSets``
325  The result resturned by `detectFootprints`
326  (`lsst.pipe.base.Struct`).
327 
328  Raises
329  ------
330  ValueError
331  If flags.negative is needed, but isn't in table's schema.
332  lsst.pipe.base.TaskError
333  If sigma=None, doSmooth=True and the exposure has no PSF.
334 
335  Notes
336  -----
337  If you want to avoid dealing with Sources and Tables, you can use
338  detectFootprints() to just get the `lsst.afw.detection.FootprintSet`s.
339  """
340  if self.negativeFlagKey is not None and self.negativeFlagKey not in table.getSchema():
341  raise ValueError("Table has incorrect Schema")
342  results = self.detectFootprints(exposure=exposure, doSmooth=doSmooth, sigma=sigma,
343  clearMask=clearMask, expId=expId)
344  sources = afwTable.SourceCatalog(table)
345  sources.reserve(results.numPos + results.numNeg)
346  if results.negative:
347  results.negative.makeSources(sources)
348  if self.negativeFlagKey:
349  for record in sources:
350  record.set(self.negativeFlagKey, True)
351  if results.positive:
352  results.positive.makeSources(sources)
353  results.fpSets = results.copy() # Backward compatibility
354  results.sources = sources
355  return results
356 
def run(self, skyInfo, tempExpRefList, imageScalerList, weightList, altMaskList=None, mask=None, supplementaryData=None)

◆ setEdgeBits()

def lsst.meas.algorithms.detection.SourceDetectionTask.setEdgeBits (   maskedImage,
  goodBBox,
  edgeBitmask 
)
static
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 875 of file detection.py.

875  def setEdgeBits(maskedImage, goodBBox, edgeBitmask):
876  """Set the edgeBitmask bits for all of maskedImage outside goodBBox
877 
878  Parameters
879  ----------
880  maskedImage : `lsst.afw.image.MaskedImage`
881  Image on which to set edge bits in the mask.
882  goodBBox : `lsst.geom.Box2I`
883  Bounding box of good pixels, in ``LOCAL`` coordinates.
884  edgeBitmask : `lsst.afw.image.MaskPixel`
885  Bit mask to OR with the existing mask bits in the region
886  outside ``goodBBox``.
887  """
888  msk = maskedImage.getMask()
889 
890  mx0, my0 = maskedImage.getXY0()
891  for x0, y0, w, h in ([0, 0,
892  msk.getWidth(), goodBBox.getBeginY() - my0],
893  [0, goodBBox.getEndY() - my0, msk.getWidth(),
894  maskedImage.getHeight() - (goodBBox.getEndY() - my0)],
895  [0, 0,
896  goodBBox.getBeginX() - mx0, msk.getHeight()],
897  [goodBBox.getEndX() - mx0, 0,
898  maskedImage.getWidth() - (goodBBox.getEndX() - mx0), msk.getHeight()],
899  ):
900  edgeMask = msk.Factory(msk, lsst.geom.BoxI(lsst.geom.PointI(x0, y0),
901  lsst.geom.ExtentI(w, h)), afwImage.LOCAL)
902  edgeMask |= edgeBitmask
903 
An integer coordinate rectangle.
Definition: Box.h:55

◆ tempWideBackgroundContext()

def lsst.meas.algorithms.detection.SourceDetectionTask.tempWideBackgroundContext (   self,
  exposure 
)
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 905 of file detection.py.

905  def tempWideBackgroundContext(self, exposure):
906  """Context manager for removing wide (large-scale) background
907 
908  Removing a wide (large-scale) background helps to suppress the
909  detection of large footprints that may overwhelm the deblender.
910  It does, however, set a limit on the maximum scale of objects.
911 
912  The background that we remove will be restored upon exit from
913  the context manager.
914 
915  Parameters
916  ----------
917  exposure : `lsst.afw.image.Exposure`
918  Exposure on which to remove large-scale background.
919 
920  Returns
921  -------
922  context : context manager
923  Context manager that will ensure the temporary wide background
924  is restored.
925  """
926  doTempWideBackground = self.config.doTempWideBackground
927  if doTempWideBackground:
928  self.log.info("Applying temporary wide background subtraction")
929  original = exposure.maskedImage.image.array[:].copy()
930  self.tempWideBackground.run(exposure).background
931  # Remove NO_DATA regions (e.g., edge of the field-of-view); these can cause detections after
932  # subtraction because of extrapolation of the background model into areas with no constraints.
933  image = exposure.maskedImage.image
934  mask = exposure.maskedImage.mask
935  noData = mask.array & mask.getPlaneBitMask("NO_DATA") > 0
936  isGood = mask.array & mask.getPlaneBitMask(self.config.statsMask) == 0
937  image.array[noData] = np.median(image.array[~noData & isGood])
938  try:
939  yield
940  finally:
941  if doTempWideBackground:
942  exposure.maskedImage.image.array[:] = original
943 
944 
def run(self, skyInfo, tempExpRefList, imageScalerList, weightList, altMaskList=None, mask=None, supplementaryData=None)

◆ updatePeaks()

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 832 of file detection.py.

832  def updatePeaks(self, fpSet, image, threshold):
833  """Update the Peaks in a FootprintSet by detecting new Footprints and
834  Peaks in an image and using the new Peaks instead of the old ones.
835 
836  Parameters
837  ----------
838  fpSet : `afw.detection.FootprintSet`
839  Set of Footprints whose Peaks should be updated.
840  image : `afw.image.MaskedImage`
841  Image to detect new Footprints and Peak in.
842  threshold : `afw.detection.Threshold`
843  Threshold object for detection.
844 
845  Input Footprints with fewer Peaks than self.config.nPeaksMaxSimple
846  are not modified, and if no new Peaks are detected in an input
847  Footprint, the brightest original Peak in that Footprint is kept.
848  """
849  for footprint in fpSet.getFootprints():
850  oldPeaks = footprint.getPeaks()
851  if len(oldPeaks) <= self.config.nPeaksMaxSimple:
852  continue
853  # We detect a new FootprintSet within each non-simple Footprint's
854  # bbox to avoid a big O(N^2) comparison between the two sets of
855  # Footprints.
856  sub = image.Factory(image, footprint.getBBox())
857  fpSetForPeaks = afwDet.FootprintSet(
858  sub,
859  threshold,
860  "", # don't set a mask plane
861  self.config.minPixels
862  )
863  newPeaks = afwDet.PeakCatalog(oldPeaks.getTable())
864  for fpForPeaks in fpSetForPeaks.getFootprints():
865  for peak in fpForPeaks.getPeaks():
866  if footprint.contains(peak.getI()):
867  newPeaks.append(peak)
868  if len(newPeaks) > 0:
869  del oldPeaks[:]
870  oldPeaks.extend(newPeaks)
871  else:
872  del oldPeaks[1:]
873 
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53

Member Data Documentation

◆ ConfigClass

lsst.meas.algorithms.detection.SourceDetectionTask.ConfigClass = SourceDetectionConfig
static

Definition at line 262 of file detection.py.

◆ makeSourceCatalog

def lsst.meas.algorithms.detection.SourceDetectionTask.makeSourceCatalog = run
static

An alias for run.

Deprecated:
Remove this alias after checking for where it's used

Definition at line 358 of file detection.py.

◆ negativeFlagKey

lsst.meas.algorithms.detection.SourceDetectionTask.negativeFlagKey

Definition at line 280 of file detection.py.


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