astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Convolution and Filtering (`astropy.convolution`) »
- CustomKernel

# CustomKernel

class astropy.convolution.CustomKernel(array)

  Bases: `Kernel`

  Create filter kernel from list or array.

  Parameters:
    array `python:list` 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.

  See also

  `Model2DKernel`, `Model1DKernel`

  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.