lsst.ip.diffim

The lsst.ip.diffim module provides algorithms and utilities for astronomical image differencing and transient detection.

Overview of lsst.ip.diffim

Using lsst.ip.diffim

Production pipelines

This package is used in production pipelines like lsst.ap.pipe and lsst.drp.pipe, designed for processing large collections of survey data.

For an example of how the two primary PipelineTasks in this package (AlardLuptonSubtractTask and DetectAndMeasureTask) are used in a production pipeline, see ap_pipe/pipelines/ApPipe.yaml.

Single frame processing

Single image frame usage can be carried out by importing the diffim as a library of tasks, as the following example shows:

from lsst.ip.diffim import subtractImages

...
subtract_task = subtractImages.AlardLuptonSubtractTask()

subtraction = subtract_task.run(
   warped_template, science, science_source_catalog)

For source detection a similar pattern works:

from lsst.ip.diffim import DetectAndMeasureTask

...
detect_task = DetectAndMeasureTask()

detect_and_measure = detect_and_measure_task.run(
   science, subtraction.matchedTemplate, subtraction.difference)

Contributing

lsst.ip.diffim is developed at https://github.com/lsst/ip_diffim. You can find Jira issues for this module under the ip_diffim component.

Task reference

Pipeline tasks

AlardLuptonPreconvolveSubtractTask

Subtract a template from a science image, convolving the science image before computing the kernel, and also convolving the template before subtraction.

AlardLuptonSubtractTask

Compute the image difference of a science and template image using the Alard & Lupton (1998) algorithm.

DetectAndMeasureScoreTask

Detect DIA sources using a score image, and measure the detections on the difference image.

DetectAndMeasureTask

Detect and measure sources on a difference image.

FractionDiaSourcesToSciSourcesMetricTask

Task that computes the ratio of difference image sources to science sources in an image, visit, etc.

GetTemplateTask

Base class for all pipeline tasks.

NumberSciSourcesMetricTask

Task that computes the number of cataloged non-primary science sources.

Tasks

DecorrelateALKernelSpatialTask

Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference

DecorrelateALKernelTask

Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference

DipoleMeasurementTask

Measurement of Sources, specifically ones from difference images, for characterization as dipoles

MakeKernelTask

Construct a kernel for PSF matching two exposures.

ModelPsfMatchTask

Match two model Psfs, and application of the Psf-matching kernel to an input Exposure.

Configurations

No topics.

Python API reference

lsst.ip.diffim Package

Functions

applyDcr(image, dcr[, useInverse, ...])

Shift an image along the X and Y directions.

calculateDcr(visitInfo, wcs, ...[, ...])

Calculate the shift in pixels of an exposure due to DCR.

calculateImageParallacticAngle(visitInfo, wcs)

Calculate the total sky rotation angle of an exposure.

convolveAndSubtract(*args, **kwargs)

Overloaded function.

generateAlardLuptonBasisList(config[, ...])

Generate an Alard-Lupton kernel basis list based upon the Config and the input FWHM of the science and template images.

makeAlardLuptonBasisList(halfWidth, nGauss, ...)

makeAssessSpatialKernelVisitor(...)

makeBuildSingleKernelVisitor(*args, **kwargs)

Overloaded function.

makeBuildSpatialKernelVisitor(basisList, ...)

makeCentralDifferenceMatrix(width, height, ...)

makeDeltaFunctionBasisList(width, height)

makeForwardDifferenceMatrix(width, height, ...)

makeKernelBasisList(config[, targetFwhmPix, ...])

Generate the delta function or Alard-Lupton kernel bases depending on the Config.

makeKernelCandidate(*args, **kwargs)

Overloaded function.

makeKernelPcaVisitor(imagePca)

makeKernelSumVisitor(ps)

makeRegularizationMatrix(ps)

renormalizeKernelList(kernelListIn)

Classes

AlardLuptonPreconvolveSubtractConfig(*args, **kw)

AlardLuptonPreconvolveSubtractTask(**kwargs)

Subtract a template from a science image, convolving the science image before computing the kernel, and also convolving the template before subtraction.

AlardLuptonSubtractConfig(*args, **kw)

AlardLuptonSubtractTask(**kwargs)

Compute the image difference of a science and template image using the Alard & Lupton (1998) algorithm.

AssessSpatialKernelVisitorF

BuildSingleKernelVisitorF

BuildSpatialKernelVisitorF

ClassificationDipoleConfig(*args, **kw)

Configuration for classification of detected diaSources as dipole or not

ClassificationDipolePlugin(config, name, ...)

A plugin to classify whether a diaSource is a dipole.

DcrModel(modelImages, effectiveWavelength, ...)

A model of the true sky after correcting chromatic effects.

DecorrelateALKernelConfig(*args, **kw)

Configuration parameters for the DecorrelateALKernelTask

DecorrelateALKernelMapReduceConfig(*args, **kw)

Configuration parameters for the ImageMapReduceTask to direct it to use DecorrelateALKernelMapper as its mapper for A&L decorrelation.

DecorrelateALKernelMapper(*args, **kwargs)

Task to be used as an ImageMapper for performing A&L decorrelation on subimages on a grid across a A&L difference image.

DecorrelateALKernelSpatialConfig(*args, **kw)

Configuration parameters for the DecorrelateALKernelSpatialTask.

DecorrelateALKernelSpatialTask(*args, **kwargs)

Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference

DecorrelateALKernelTask(*args, **kwargs)

Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference

DetectAndMeasureConfig(*args, **kw)

Config for DetectAndMeasureTask

DetectAndMeasureScoreConfig(*args, **kw)

DetectAndMeasureScoreTask(**kwargs)

Detect DIA sources using a score image, and measure the detections on the difference image.

DetectAndMeasureTask(**kwargs)

Detect and measure sources on a difference image.

DipoleAnalysis()

Functor class that provides (S/N, position, orientation) of measured dipoles

DipoleCentroidControl

DipoleDeblender()

Functor to deblend a source as a dipole, and return a new source with deblended footprints.

DipoleFitAlgorithm(diffim[, posImage, negImage])

Fit a dipole model using an image difference.

DipoleFitPlugin(config, name, schema, metadata)

A single frame measurement plugin that fits dipoles to all merged (two-peak) diaSources.

DipoleFitPluginConfig(*args, **kw)

Configuration for DipoleFitPlugin

DipoleFitTask(schema[, algMetadata])

A task that fits a dipole to a difference image, with an optional separate detection image.

DipoleFitTaskConfig(*args[, ...])

DipoleFluxControl

DipoleMeasurementConfig(*args[, ...])

Measurement of detected diaSources as dipoles

DipoleMeasurementTask(schema[, algMetadata])

Measurement of Sources, specifically ones from difference images, for characterization as dipoles

GetDcrTemplateConfig(*args, **kw)

GetDcrTemplateTask(*args, **kwargs)

GetTemplateConfig(*args, **kw)

GetTemplateTask(*args, **kwargs)

ImageMapReduceConfig(*args, **kw)

Configuration parameters for the ImageMapReduceTask

ImageMapReduceTask(*args, **kwargs)

Split an Exposure into subExposures (optionally on a grid) and perform the same operation on each.

ImageMapper([config, name, parentTask, log])

Abstract base class for any task that is to be used as ImageMapReduceConfig.mapper.

ImageMapperConfig(*args, **kw)

Configuration parameters for ImageMapper

ImageReducer([config, name, parentTask, log])

Base class for any 'reduce' task that is to be used as ImageMapReduceConfig.reducer.

ImageReducerConfig(*args, **kw)

Configuration parameters for the ImageReducer

ImageStatisticsD

ImageStatisticsF

ImageStatisticsI

KernelCandidateF

KernelPcaD

KernelPcaVisitorF

KernelSolution

KernelSumVisitorF

MakeKernelConfig(*args, **kw)

MakeKernelTask(*args, **kwargs)

Construct a kernel for PSF matching two exposures.

MaskedKernelSolutionF

ModelPsfMatchConfig(*args, **kw)

Configuration for model-to-model Psf matching

ModelPsfMatchTask(*args, **kwargs)

Match two model Psfs, and application of the Psf-matching kernel to an input Exposure.

PsfDipoleFlux

PsfDipoleFluxControl

PsfMatchConfig(*args, **kw)

Base configuration for Psf-matching

PsfMatchConfigAL(*args, **kw)

The parameters specific to the "Alard-Lupton" (sum-of-Gaussian) Psf-matching basis

PsfMatchConfigDF(*args, **kw)

The parameters specific to the delta-function (one basis per-pixel) Psf-matching basis

PsfMatchTask(*args, **kwargs)

Base class for Psf Matching; should not be called directly

RegularizedKernelSolution

SourceFlagChecker(sources[, badFlags])

Functor class to check whether a diaSource has flags set that should cause it to be labeled bad.

SpatialKernelSolution

SpatiallySampledMetricsConfig(*args, **kw)

Config for SpatiallySampledMetricsTask

SpatiallySampledMetricsTask(**kwargs)

Detect and measure sources on a difference image.

StaticKernelSolutionF

Class Inheritance Diagram

Inheritance diagram of lsst.ip.diffim.subtractImages.AlardLuptonPreconvolveSubtractConfig, lsst.ip.diffim.subtractImages.AlardLuptonPreconvolveSubtractTask, lsst.ip.diffim.subtractImages.AlardLuptonSubtractConfig, lsst.ip.diffim.subtractImages.AlardLuptonSubtractTask, lsst.ip.diffim.AssessSpatialKernelVisitorF, lsst.ip.diffim.BuildSingleKernelVisitorF, lsst.ip.diffim.BuildSpatialKernelVisitorF, lsst.ip.diffim.dipoleMeasurement.ClassificationDipoleConfig, lsst.ip.diffim.dipoleMeasurement.ClassificationDipolePlugin, lsst.ip.diffim.dcrModel.DcrModel, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelConfig, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelMapReduceConfig, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelMapper, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelSpatialConfig, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelSpatialTask, lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelTask, lsst.ip.diffim.detectAndMeasure.DetectAndMeasureConfig, lsst.ip.diffim.detectAndMeasure.DetectAndMeasureScoreConfig, lsst.ip.diffim.detectAndMeasure.DetectAndMeasureScoreTask, lsst.ip.diffim.detectAndMeasure.DetectAndMeasureTask, lsst.ip.diffim.dipoleMeasurement.DipoleAnalysis, lsst.ip.diffim.DipoleCentroidControl, lsst.ip.diffim.dipoleMeasurement.DipoleDeblender, lsst.ip.diffim.dipoleFitTask.DipoleFitAlgorithm, lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin, lsst.ip.diffim.dipoleFitTask.DipoleFitPluginConfig, lsst.ip.diffim.dipoleFitTask.DipoleFitTask, lsst.ip.diffim.dipoleFitTask.DipoleFitTaskConfig, lsst.ip.diffim.DipoleFluxControl, lsst.ip.diffim.dipoleMeasurement.DipoleMeasurementConfig, lsst.ip.diffim.dipoleMeasurement.DipoleMeasurementTask, lsst.ip.diffim.getTemplate.GetDcrTemplateConfig, lsst.ip.diffim.getTemplate.GetDcrTemplateTask, lsst.ip.diffim.getTemplate.GetTemplateConfig, lsst.ip.diffim.getTemplate.GetTemplateTask, lsst.ip.diffim.imageMapReduce.ImageMapReduceConfig, lsst.ip.diffim.imageMapReduce.ImageMapReduceTask, lsst.ip.diffim.imageMapReduce.ImageMapper, lsst.ip.diffim.imageMapReduce.ImageMapperConfig, lsst.ip.diffim.imageMapReduce.ImageReducer, lsst.ip.diffim.imageMapReduce.ImageReducerConfig, lsst.ip.diffim.ImageStatisticsD, lsst.ip.diffim.ImageStatisticsF, lsst.ip.diffim.ImageStatisticsI, lsst.ip.diffim.KernelCandidateF, lsst.ip.diffim.KernelPcaD, lsst.ip.diffim.KernelPcaVisitorF, lsst.ip.diffim.KernelSolution, lsst.ip.diffim.KernelSumVisitorF, lsst.ip.diffim.makeKernel.MakeKernelConfig, lsst.ip.diffim.makeKernel.MakeKernelTask, lsst.ip.diffim.MaskedKernelSolutionF, lsst.ip.diffim.modelPsfMatch.ModelPsfMatchConfig, lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask, lsst.ip.diffim.PsfDipoleFlux, lsst.ip.diffim.PsfDipoleFluxControl, lsst.ip.diffim.psfMatch.PsfMatchConfig, lsst.ip.diffim.psfMatch.PsfMatchConfigAL, lsst.ip.diffim.psfMatch.PsfMatchConfigDF, lsst.ip.diffim.psfMatch.PsfMatchTask, lsst.ip.diffim.RegularizedKernelSolution, lsst.ip.diffim.dipoleMeasurement.SourceFlagChecker, lsst.ip.diffim.SpatialKernelSolution, lsst.ip.diffim.computeSpatiallySampledMetrics.SpatiallySampledMetricsConfig, lsst.ip.diffim.computeSpatiallySampledMetrics.SpatiallySampledMetricsTask, lsst.ip.diffim.StaticKernelSolutionF

lsst.ip.diffim.metrics Module

Classes

NumberSciSourcesMetricTask(**kwargs)

Task that computes the number of cataloged non-primary science sources.

NumberSciSourcesMetricConfig(*args, **kw)

FractionDiaSourcesToSciSourcesMetricTask(...)

Task that computes the ratio of difference image sources to science sources in an image, visit, etc.

FractionDiaSourcesToSciSourcesMetricConfig(...)