MakeKernelTask#

class lsst.ip.diffim.MakeKernelTask(*args, **kwargs)#

Bases: PsfMatchTask

Construct a kernel for PSF matching two exposures.

Methods Summary

getSelectSources(exposure[, sigma, ...])

Get sources to use for Psf-matching.

makeCandidateList(convolved, reference, ...)

Make a list of acceptable KernelCandidates.

makeKernelBasisList([targetFwhmPix, ...])

Wrapper to set log messages for lsst.ip.diffim.makeKernelBasisList.

run(template, science, kernelSources[, ...])

Solve for the kernel and background model that best match two Exposures evaluated at the given source locations.

selectKernelSources(template, science[, ...])

Select sources from a list of candidates, and extract footprints.

Methods Documentation

getSelectSources(exposure, sigma=None, doSmooth=True, idFactory=None)#

Get sources to use for Psf-matching.

This method runs detection and measurement on an exposure. The returned set of sources will be used as candidates for Psf-matching.

Parameters#

exposurelsst.afw.image.Exposure

Exposure on which to run detection/measurement

sigmafloat, optional

PSF sigma, in pixels, used for smoothing the image for detection. If None, the PSF width will be used.

doSmoothbool

Whether or not to smooth the Exposure with Psf before detection

idFactorylsst.afw.table.IdFactory

Factory for the generation of Source ids

Returns#

selectSources :

source catalog containing candidates for the Psf-matching

makeCandidateList(convolved, reference, kernelSize, candidateList, preconvolved=False, sigma=None)#

Make a list of acceptable KernelCandidates.

Generate a list of candidate sources for Psf-matching, remove sources with bad pixel masks set or that extend off the image.

Parameters#

convolvedlsst.afw.image.Exposure

Exposure that will be convolved. This is typically the template image, and may have a large bbox than the reference exposure.

referencelsst.afw.image.Exposure

Exposure that will be matched-to. This is typically the science image.

kernelSizefloat

Dimensions of the Psf-matching Kernel, used to set detection footprints.

candidateListlsst.afw.table.SourceCatalog

List of Sources to examine for kernel candidacy.

preconvolvedbool, optional

Was the science exposure already convolved with its PSF?

Returns#

candidateslsst.afw.table.SourceCatalog

Candidates with footprints extended to a kernelSize box.

Raises#

RuntimeError

If candidateList is empty after sub-selection.

makeKernelBasisList(targetFwhmPix=None, referenceFwhmPix=None, basisDegGauss=None, basisSigmaGauss=None, metadata=None)#

Wrapper to set log messages for lsst.ip.diffim.makeKernelBasisList.

Parameters#

targetFwhmPixfloat, optional

Passed on to lsst.ip.diffim.generateAlardLuptonBasisList. Not used for delta function basis sets.

referenceFwhmPixfloat, optional

Passed on to lsst.ip.diffim.generateAlardLuptonBasisList. Not used for delta function basis sets.

basisDegGausslist of int, optional

Passed on to lsst.ip.diffim.generateAlardLuptonBasisList. Not used for delta function basis sets.

basisSigmaGausslist of int, optional

Passed on to lsst.ip.diffim.generateAlardLuptonBasisList. Not used for delta function basis sets.

metadatalsst.daf.base.PropertySet, optional

Passed on to lsst.ip.diffim.generateAlardLuptonBasisList. Not used for delta function basis sets.

Returns#

basisList: list of lsst.afw.math.kernel.FixedKernel

List of basis kernels.

run(template, science, kernelSources, preconvolved=False, templateFwhmPix=None, scienceFwhmPix=None)#

Solve for the kernel and background model that best match two Exposures evaluated at the given source locations.

Parameters#

templatelsst.afw.image.Exposure

Exposure that will be convolved.

sciencelsst.afw.image.Exposure

The exposure that will be matched.

kernelSourceslsst.afw.table.SourceCatalog

Kernel candidate sources with appropriately sized footprints. Typically the output of MakeKernelTask.selectKernelSources.

preconvolvedbool, optional

Was the science image convolved with its own PSF?

Returns#

results : lsst.pipe.base.Struct

psfMatchingKernellsst.afw.math.LinearCombinationKernel

Spatially varying Psf-matching kernel.

backgroundModellsst.afw.math.Function2D

Spatially varying background-matching function.

selectKernelSources(template, science, candidateList=None, preconvolved=False, templateFwhmPix=None, scienceFwhmPix=None)#

Select sources from a list of candidates, and extract footprints.

Parameters#

templatelsst.afw.image.Exposure

Exposure that will be convolved.

sciencelsst.afw.image.Exposure

The exposure that will be matched.

candidateListlsst.afw.table.SourceCatalog

Sources to check as possible kernel candidates.

preconvolvedbool, optional

Was the science image convolved with its own PSF?

Returns#

kernelSourceslsst.afw.table.SourceCatalog

Kernel candidates with appropriate sized footprints.