CustomKernel#

class astropy.convolution.CustomKernel(array)[source]#

Bases: Kernel

Create filter kernel from list or array.

Parameters:
arraylist or array

Filter kernel array. Size must be odd.

Raises:
TypeError

If array is not a list or array.

KernelSizeError

If array size is even.

Examples

Define one dimensional array:

>>> from astropy.convolution.kernels import CustomKernel
>>> import numpy as np
>>> array = np.array([1, 2, 3, 2, 1])
>>> kernel = CustomKernel(array)
>>> kernel.dimension
1

Define two dimensional array:

>>> array = np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]])
>>> kernel = CustomKernel(array)
>>> kernel.dimension
2

Attributes Summary

array

Filter kernel array.

Attributes Documentation

array#

Filter kernel array.