DetectAndMeasureTask#

class lsst.ip.diffim.DetectAndMeasureTask(**kwargs)#

Bases: PipelineTask

Detect and measure sources on a difference image.

Methods Summary

addSkySources(diaSources, mask, seed[, subtask])

Add sources in empty regions of the difference image for measuring the background.

calculateMetrics(science, difference, ...)

Add difference image QA metrics to the Task metadata.

filterSatellites(diaSources, science)

Remove diaSources overlapping predicted satellite positions.

getSattleDiaSourceAllowlist(diaSources, science)

Query the sattle service and determine which diaSources are allowed.

measureDiaSources(diaSources, science, ...)

Use (matched) template and science image to constrain dipole fitting.

measureForcedSources(diaSources, image, wcs)

Perform forced measurement of the diaSources on a direct image.

processResults(science, matchedTemplate, ...)

Measure and process the results of source detection.

run(science, matchedTemplate, difference[, ...])

Detect and measure sources on a difference image.

runQuantum(butlerQC, inputRefs, outputRefs)

Do butler IO and transform to provide in memory objects for tasks run method.

Methods Documentation

addSkySources(diaSources, mask, seed, subtask=None)#

Add sources in empty regions of the difference image for measuring the background.

Parameters#

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

masklsst.afw.image.Mask

Mask plane for determining regions where Sky sources can be added.

seedint

Seed value to initialize the random number generator.

calculateMetrics(science, difference, diaSources, kernelSources)#

Add difference image QA metrics to the Task metadata.

This may be used to produce corresponding metrics (see lsst.analysis.tools.tasks.diffimTaskDetectorVisitMetricAnalysis).

Parameters#

sciencelsst.afw.image.ExposureF

Science exposure that was subtracted.

differencelsst.afw.image.Exposure

The target difference image to calculate metrics for.

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

kernelSourceslsst.afw.table.SourceCatalog

Final selection of sources that was used for psf matching.

filterSatellites(diaSources, science)#

Remove diaSources overlapping predicted satellite positions.

Parameters#

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

sciencelsst.afw.image.ExposureF

Science exposure that was subtracted.

Returns#

filterdDiaSourceslsst.afw.table.SourceCatalog

Filtered catalog of diaSources

getSattleDiaSourceAllowlist(diaSources, science)#

Query the sattle service and determine which diaSources are allowed.

Parameters#

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

sciencelsst.afw.image.ExposureF

Science exposure that was subtracted.

Returns#

allow_listlist of int

diaSourceIds of diaSources that can be made public.

Raises#

requests.HTTPError

Raised if sattle call does not return success.

measureDiaSources(diaSources, science, difference, matchedTemplate)#

Use (matched) template and science image to constrain dipole fitting.

Parameters#

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

sciencelsst.afw.image.ExposureF

Science exposure that the template was subtracted from.

differencelsst.afw.image.ExposureF

Result of subtracting template from the science image.

matchedTemplatelsst.afw.image.ExposureF

Warped and PSF-matched template that was used produce the difference image.

measureForcedSources(diaSources, image, wcs, template=False)#

Perform forced measurement of the diaSources on a direct image.

Parameters#

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

image: lsst.afw.image.ExposureF

Exposure that the forced measurement is being performed on

wcslsst.afw.geom.SkyWcs

Coordinate system definition (wcs) for the exposure.

templatebool

Is the forced measurement being performed on the template?

processResults(science, matchedTemplate, difference, sources, idFactory, kernelSources=None, positives=None, negatives=None, measurementResults=None)#

Measure and process the results of source detection.

Parameters#

sciencelsst.afw.image.ExposureF

Science exposure that the template was subtracted from.

matchedTemplatelsst.afw.image.ExposureF

Warped and PSF-matched template that was used produce the difference image.

differencelsst.afw.image.ExposureF

Result of subtracting template from the science image.

sourceslsst.afw.table.SourceCatalog

Detected sources on the difference exposure.

idFactorylsst.afw.table.IdFactory

Generator object used to assign ids to detected sources in the difference image.

kernelSourceslsst.afw.table.SourceCatalog, optional

Final selection of sources that was used for psf matching.

positiveslsst.afw.table.SourceCatalog, optional

Positive polarity footprints.

negativeslsst.afw.table.SourceCatalog, optional

Negative polarity footprints.

measurementResultslsst.pipe.base.Struct, optional

Result struct that is modified to allow saving of partial outputs for some failure conditions. If the task completes successfully, this is also returned.

Returns#

measurementResults : lsst.pipe.base.Struct

subtractedMeasuredExposurelsst.afw.image.ExposureF

Subtracted exposure with detection mask applied.

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

run(science, matchedTemplate, difference, kernelSources=None, idFactory=None, measurementResults=None)#

Detect and measure sources on a difference image.

The difference image will be convolved with a gaussian approximation of the PSF to form a maximum likelihood image for detection. Close positive and negative detections will optionally be merged into dipole diaSources. Sky sources, or forced detections in background regions, will optionally be added, and the configured measurement algorithm will be run on all detections.

Parameters#

sciencelsst.afw.image.ExposureF

Science exposure that the template was subtracted from.

matchedTemplatelsst.afw.image.ExposureF

Warped and PSF-matched template that was used produce the difference image.

differencelsst.afw.image.ExposureF

Result of subtracting template from the science image.

kernelSourceslsst.afw.table.SourceCatalog, optional

Final selection of sources that was used for psf matching.

idFactorylsst.afw.table.IdFactory, optional

Generator object used to assign ids to detected sources in the difference image. Ids from this generator are not set until after deblending and merging positive/negative peaks.

measurementResultslsst.pipe.base.Struct, optional

Result struct that is modified to allow saving of partial outputs for some failure conditions. If the task completes successfully, this is also returned.

Returns#

measurementResults : lsst.pipe.base.Struct

subtractedMeasuredExposurelsst.afw.image.ExposureF

Subtracted exposure with detection mask applied.

diaSourceslsst.afw.table.SourceCatalog

The catalog of detected sources.

differenceBackgroundlsst.afw.math.BackgroundList

Background that was subtracted from the difference image.

runQuantum(butlerQC: QuantumContext, inputRefs: InputQuantizedConnection, outputRefs: OutputQuantizedConnection)#

Do butler IO and transform to provide in memory objects for tasks run method.

Parameters#

butlerQCQuantumContext

A butler which is specialized to operate in the context of a lsst.daf.butler.Quantum.

inputRefsInputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined input/prerequisite connections.

outputRefsOutputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined output connections.