ImageBasisConvolutionKernel#

class lsst.images.convolution_kernels.ImageBasisConvolutionKernel(basis: ndarray, spatial: Iterable[Field], center_y: int | None = None, center_x: int | None = None)#

Bases: ConvolutionKernel

A convolution kernel formed by a linear combination of images multiplied by BaseField instances.

Parameters#

basis

A 3-d array holding the kernel images each basis function, with shape (n, height, width).

spatial

Iterable of fields.BaseField of length basis.shape[0], holding the spatial variation of each basis kernel.

center_y

Center of the basis kernels in the x dimension. Defaults to height//2.

center_x

Center of the basis kernels in the x dimension. Defaults to width//2.

Attributes Summary

basis

The kernel basis functions, as an array with shape (n, h, w) (numpy.ndarray).

bounds

The region where this convolution kernel is valid (Bounds).

kernel_bbox

Bounding box of all images returned by compute_kernel_image (Box).

spatial

The spatial variation of each basis function (Sequence [BaseField]).

Methods Summary

compute_kernel_image(*, x, y)

Evaluate the kernel at a point.

from_legacy(legacy_kernel)

Convert from a legacy lsst.afw.math.LinearCombinationKernel.

serialize(archive)

Serialize the kernel to an output archive.

to_legacy()

Convert to a legacy lsst.afw.math.LinearCombinationKernel.

Attributes Documentation

basis#

The kernel basis functions, as an array with shape (n, h, w) (numpy.ndarray).

bounds#
kernel_bbox#
spatial#

The spatial variation of each basis function (Sequence [BaseField]).

Methods Documentation

compute_kernel_image(*, x: int, y: int) Image#

Evaluate the kernel at a point.

Parameters#

x

Column position coordinate to evaluate at.

y

Row position coordinate to evaluate at.

Returns#

Image

An image of the kernel, centered on the center of the center pixel, which is defined to be (0, 0) by the image’s origin.

static from_legacy(legacy_kernel: LegacyLinearCombinationKernel) ImageBasisConvolutionKernel#

Convert from a legacy lsst.afw.math.LinearCombinationKernel.

Parameters#

legacy_kernel

The kernel to convert. Must use Chebyshev polynomials for its spatial variation and lsst.afw.math.FixedKernel objects with a consistent shape and center for its basis functions.

serialize(archive: OutputArchive[Any]) ImageBasisConvolutionKernelSerializationModel#

Serialize the kernel to an output archive.

Parameters#

archive

Archive to write to.

to_legacy() LegacyLinearCombinationKernel#

Convert to a legacy lsst.afw.math.LinearCombinationKernel.

This only works if all spatial variation is handled by lsst.images.ChebyshevField.