Model2DKernel

class astropy.convolution.Model2DKernel(model, **kwargs)[source]

Bases: astropy.convolution.Kernel2D

Create kernel from 2D model.

The model has to be centered on x = 0 and y = 0.

Parameters
modelFittable2DModel

Kernel response function model

x_sizeint, optional

Size in x direction of the kernel array. Default = ⌊8*width +1⌋. Must be odd.

y_sizeint, optional

Size in y direction of the kernel array. Default = ⌊8*width +1⌋.

modestr, optional
One of the following discretization modes:
  • ‘center’ (default)

    Discretize model by taking the value at the center of the bin.

  • ‘linear_interp’

    Discretize model by performing a bilinear interpolation between the values at the corners of the bin.

  • ‘oversample’

    Discretize model by taking the average on an oversampled grid.

  • ‘integrate’

    Discretize model by integrating the model over the bin.

factornumber, optional

Factor of oversampling. Default factor = 10.

Raises
TypeError

If model is not an instance of Fittable2DModel

See also

Model1DKernel

Create kernel from Fittable1DModel

CustomKernel

Create kernel from list or array

Examples

Define a Gaussian2D model:

>>> from astropy.modeling.models import Gaussian2D
>>> from astropy.convolution.kernels import Model2DKernel
>>> gauss = Gaussian2D(1, 0, 0, 2, 2)

And create a custom two dimensional kernel from it:

>>> gauss_kernel = Model2DKernel(gauss, x_size=9)

This kernel can now be used like a usual astropy kernel.