make_2dgaussian_kernel

photutils.segmentation.make_2dgaussian_kernel(fwhm, size, mode='oversample', oversampling=10)[source]

Make a normalized 2D circular Gaussian kernel.

The kernel must have odd sizes in both X and Y, be centered in the central pixel, and normalized to sum to 1.

Parameters:
fwhmfloat

The full-width at half-maximum (FWHM) of the 2D circular Gaussian kernel.

sizeint or (2,) int array_like

The size of the kernel along each axis. If size is a scalar then a square size of size will be used. If size has two elements, they must be in (ny, nx) (i.e., array shape) order. size must have odd values for both axes.

mode{‘oversample’, ‘center’, ‘linear_interp’, ‘integrate’}, optional
The mode to use for discretizing the 2D Gaussian model:
  • ‘oversample’ (default): Discretize model by taking the average on an oversampled grid.

  • ‘center’: 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.

  • ‘integrate’: Discretize model by integrating the model over the bin.

oversamplingint, optional

The oversampling factor used when mode='oversample'.

Returns:
kernelastropy.convolution.Kernel2D

The output smoothing kernel, normalized such that it sums to 1.