DetectAndMeasureTask#
- class lsst.ip.diffim.DetectAndMeasureTask(**kwargs)#
Bases:
PipelineTaskDetect 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
runmethod.Methods Documentation
- addSkySources(diaSources, mask, seed, subtask=None)#
Add sources in empty regions of the difference image for measuring the background.
Parameters#
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- mask
lsst.afw.image.Mask Mask plane for determining regions where Sky sources can be added.
- seed
int Seed value to initialize the random number generator.
- diaSources
- 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#
- science
lsst.afw.image.ExposureF Science exposure that was subtracted.
- difference
lsst.afw.image.Exposure The target difference image to calculate metrics for.
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- kernelSources
lsst.afw.table.SourceCatalog Final selection of sources that was used for psf matching.
- science
- filterSatellites(diaSources, science)#
Remove diaSources overlapping predicted satellite positions.
Parameters#
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- science
lsst.afw.image.ExposureF Science exposure that was subtracted.
Returns#
- filterdDiaSources
lsst.afw.table.SourceCatalog Filtered catalog of diaSources
- diaSources
- getSattleDiaSourceAllowlist(diaSources, science)#
Query the sattle service and determine which diaSources are allowed.
Parameters#
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- science
lsst.afw.image.ExposureF Science exposure that was subtracted.
Returns#
- allow_list
listofint diaSourceIds of diaSources that can be made public.
Raises#
- requests.HTTPError
Raised if sattle call does not return success.
- diaSources
- measureDiaSources(diaSources, science, difference, matchedTemplate)#
Use (matched) template and science image to constrain dipole fitting.
Parameters#
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- science
lsst.afw.image.ExposureF Science exposure that the template was subtracted from.
- difference
lsst.afw.image.ExposureF Result of subtracting template from the science image.
- matchedTemplate
lsst.afw.image.ExposureF Warped and PSF-matched template that was used produce the difference image.
- diaSources
- measureForcedSources(diaSources, image, wcs, template=False)#
Perform forced measurement of the diaSources on a direct image.
Parameters#
- diaSources
lsst.afw.table.SourceCatalog The catalog of detected sources.
- image:
lsst.afw.image.ExposureF Exposure that the forced measurement is being performed on
- wcs
lsst.afw.geom.SkyWcs Coordinate system definition (wcs) for the exposure.
- template
bool Is the forced measurement being performed on the template?
- diaSources
- processResults(science, matchedTemplate, difference, sources, idFactory, kernelSources=None, positives=None, negatives=None, measurementResults=None)#
Measure and process the results of source detection.
Parameters#
- science
lsst.afw.image.ExposureF Science exposure that the template was subtracted from.
- matchedTemplate
lsst.afw.image.ExposureF Warped and PSF-matched template that was used produce the difference image.
- difference
lsst.afw.image.ExposureF Result of subtracting template from the science image.
- sources
lsst.afw.table.SourceCatalog Detected sources on the difference exposure.
- idFactory
lsst.afw.table.IdFactory Generator object used to assign ids to detected sources in the difference image.
- kernelSources
lsst.afw.table.SourceCatalog, optional Final selection of sources that was used for psf matching.
- positives
lsst.afw.table.SourceCatalog, optional Positive polarity footprints.
- negatives
lsst.afw.table.SourceCatalog, optional Negative polarity footprints.
- measurementResults
lsst.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.StructsubtractedMeasuredExposurelsst.afw.image.ExposureFSubtracted exposure with detection mask applied.
diaSourceslsst.afw.table.SourceCatalogThe catalog of detected sources.
- science
- 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#
- science
lsst.afw.image.ExposureF Science exposure that the template was subtracted from.
- matchedTemplate
lsst.afw.image.ExposureF Warped and PSF-matched template that was used produce the difference image.
- difference
lsst.afw.image.ExposureF Result of subtracting template from the science image.
- kernelSources
lsst.afw.table.SourceCatalog, optional Final selection of sources that was used for psf matching.
- idFactory
lsst.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.
- measurementResults
lsst.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.StructsubtractedMeasuredExposurelsst.afw.image.ExposureFSubtracted exposure with detection mask applied.
diaSourceslsst.afw.table.SourceCatalogThe catalog of detected sources.
differenceBackgroundlsst.afw.math.BackgroundListBackground that was subtracted from the difference image.
- science
- runQuantum(butlerQC: QuantumContext, inputRefs: InputQuantizedConnection, outputRefs: OutputQuantizedConnection)#
Do butler IO and transform to provide in memory objects for tasks
runmethod.Parameters#
- butlerQC
QuantumContext A butler which is specialized to operate in the context of a
lsst.daf.butler.Quantum.- inputRefs
InputQuantizedConnection Datastructure whose attribute names are the names that identify connections defined in corresponding
PipelineTaskConnectionsclass. The values of these attributes are thelsst.daf.butler.DatasetRefobjects associated with the defined input/prerequisite connections.- outputRefs
OutputQuantizedConnection Datastructure whose attribute names are the names that identify connections defined in corresponding
PipelineTaskConnectionsclass. The values of these attributes are thelsst.daf.butler.DatasetRefobjects associated with the defined output connections.
- butlerQC