ImagePsfMatchTask creates a PSF-matching kernel for two models.


This Task differs from ImagePsfMatchTask in that it matches two Psf _models_ by realizing them in an Exposure-sized SpatialCellSet and then inserting each Psf-image pair into KernelCandidates. Because none of the pairs of sources that are to be matched should be invalid, all sigma clipping is turned off in ModelPsfMatchConfig. And because there is no tracked _variance_ in the Psf images, the debugging and logging QA info should be interpreted with caution.

One item of note is that the sizes of Psf models are fixed (e.g. its defined as a 21x21 matrix). When the Psf-matching kernel is being solved for, the Psf “image” is convolved with each kernel basis function, leading to a loss of information around the borders. This pixel loss will be problematic for the numerical stability of the kernel solution if the size of the convolution kernel(set by ModelPsfMatchConfig.kernelSize) is much bigger than: psfSize//2. Thus the sizes of Psf-model matching kernels are typically smaller than their image-matching counterparts. If the size of the kernel is too small, the convolved stars will look “boxy”; if the kernel is too large, the kernel solution will be “noisy”. This is a trade-off that needs careful attention for a given dataset.

The primary use case for this Task is in matching an Exposure to a constant-across-the-sky Psf model for the purposes of image coaddition. It is important to note that in the code, the “template” Psf is the Psf that the science image gets matched to. In this sense the order of template and science image are reversed, compared to ImagePsfMatchTask, which operates on the template image.

Python API summary

from lsst.ip.diffim.modelPsfMatch import ModelPsfMatchTask
classModelPsfMatchTask(*args, **kwargs)

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


Access configuration fields and retargetable subtasks.

methodrun(exposure, referencePsfModel, kernelSum=1.0)

Psf-match an exposure to a model Psf...

See also

See the ModelPsfMatchTask API reference for complete details.

Retargetable subtasks

No subtasks.

Configuration fields


Field type

float RangeField



Minimum Science Psf dimensions as a fraction of matching kernel dimensions. If the dimensions of the Psf to be matched are less than the matching kernel dimensions * autoPadPsfTo, pad Science Psf to this size. Ignored if doAutoPadPsf=False.


Field type

bool Field

If too small, automatically pad the science Psf? Pad to smallest dimensions appropriate for the matching kernel dimensions, as specified by autoPadPsfTo. If false, pad by the padPsfBy config.


Field type

Single-selection ConfigChoiceField



kernel type


Field type

int Field

Pixels (even) to pad Science Psf by before matching. Ignored if doAutoPadPsf=True


The pipetask command line interface supports a --debug flag to import from your PYTHONPATH; see lsstDebug for more about files. The available variables in ModelsPsfMatchTask include:


Enable debug display output.


Transparency of mask planes in the output display.


Show spatial cells before the fit.