# lsst.ip.diffim¶

The lsst.ip.diffim module provides algorithms for astronomical image differencing.

## 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 that computes the ratio of difference image sources to science sources in an image, visit, etc.
Task that computes the number of cataloged science sources.

No topics.

## Python API reference¶

### lsst.ip.diffim Package¶

#### Functions¶

 AssessSpatialKernelVisitorF BuildSingleKernelVisitorF BuildSpatialKernelVisitorF ImageStatisticsF KernelCandidateDetectionF KernelCandidateF KernelSumVisitorF applyDcr(image, dcr[, useInverse, …]) Shift an image along the X and Y directions. backgroundSubtract(config, maskedImages) Subtract the background from masked images. calculateDcr(visitInfo, wcs, filterInfo, …) 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) sourceToFootprintList(candidateInList, …) Convert a list of sources for the PSF-matching Kernel to Footprints. writeKernelCellSet(kernelCellSet, …) TODO: DM-17458

#### Classes¶

 ClassificationDipoleConfig 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[, filterInfo, psf, …]) A model of the true sky after correcting chromatic effects. DecorrelateALKernelConfig Configuration parameters for the DecorrelateALKernelTask DecorrelateALKernelMapReduceConfig 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 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 DetectionConfig Configuration for detecting sources on images for building a PSF-matching kernel DiaCatalogSourceSelectorConfig DiaCatalogSourceSelectorTask(**kwargs) A task that selects sources for Kernel candidates. DiaSourceAnalyst(config) DiaSourceAnalystConfig 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 Configuration for DipoleFitPlugin DipoleFitTask(schema[, algMetadata]) A task that fits a dipole to a difference image, with an optional separate detection image. DipoleFitTaskConfig Measurement of detected diaSources as dipoles DipoleFluxControl DipoleMeasurementConfig Measurement of detected diaSources as dipoles DipoleMeasurementTask(schema[, algMetadata]) Measurement of Sources, specifically ones from difference images, for characterization as dipoles FindSetBitsU GetCalexpAsTemplateConfig GetCalexpAsTemplateTask([config, name, …]) Subtask to retrieve calexp of the same ccd number as the science image SensorRef for use as an image difference template. GetCoaddAsTemplateConfig GetCoaddAsTemplateTask([config, name, …]) Subtask to retrieve coadd for use as an image difference template. ImageMapReduceConfig 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 Configuration parameters for ImageMapper ImagePsfMatchConfig Configuration for image-to-image Psf matching. ImagePsfMatchTask(*args, **kwargs) Psf-match two MaskedImages or Exposures using the sources in the images. ImageReducer([config, name, parentTask, log]) Base class for any ‘reduce’ task that is to be used as ImageMapReduceConfig.reducer. ImageReducerConfig Configuration parameters for the ImageReducer ImageStatisticsD ImageStatisticsI KernelCandidateQa(nKernelSpatial) Quality Assessment class for Kernel Candidates KernelPcaD KernelPcaVisitorF KernelSolution MaskedKernelSolutionF ModelPsfMatchConfig Configuration for model-to-model Psf matching ModelPsfMatchTask(*args, **kwargs) Matching of two model Psfs, and application of the Psf-matching kernel to an input Exposure NaiveDipoleCentroid NaiveDipoleFlux NbasisEvaluator(psfMatchConfig, …) A functor to evaluate the Bayesian Information Criterion for the number of basis sets going into the kernel fitting PsfDipoleFlux PsfDipoleFluxControl PsfMatchConfig Base configuration for Psf-matching PsfMatchConfigAL The parameters specific to the “Alard-Lupton” (sum-of-Gaussian) Psf-matching basis PsfMatchConfigDF 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 RegularizedKernelSolutionF SnapPsfMatchConfig SnapPsfMatchConfigAL Sum-of-Gaussian (Alard-Lupton) Psf-matching config optimized for snap subtraction SnapPsfMatchConfigDF Delta-function Psf-matching config optimized for snap subtraction SnapPsfMatchTask(*args, **kwargs) Image-based Psf-matching of two subsequent snaps from the same visit SourceFlagChecker(sources[, badFlags]) Functor class to check whether a diaSource has flags set that should cause it to be labeled bad. SpatialKernelSolution StaticKernelSolutionF ZogyConfig Configuration parameters for the ZogyTask ZogyImagePsfMatchConfig Config for the ZogyImagePsfMatchTask ZogyImagePsfMatchTask(*args, **kwargs) Task to perform Zogy PSF matching and image subtraction. ZogyMapReduceConfig Config to be passed to ImageMapReduceTask ZogyMapper(*args, **kwargs) Task to be used as an ImageMapper for performing ZOGY image subtraction on a grid of subimages. ZogyTask([templateExposure, …]) Task to perform ZOGY proper image subtraction.

### lsst.ip.diffim.metrics Module¶

#### Classes¶

 NumberSciSourcesMetricTask(**kwargs) Task that computes the number of cataloged science sources. NumberSciSourcesMetricConfig FractionDiaSourcesToSciSourcesMetricTask(…) Task that computes the ratio of difference image sources to science sources in an image, visit, etc. FractionDiaSourcesToSciSourcesMetricConfig