Create a smoothing kernel for use with convolve or convolve_fft.
Parameters : | kernelshape : n-tuple
kernelwidth : float
kerneltype : {‘gaussian’, ‘boxcar’, ‘tophat’, ‘brickwall’, ‘airy’, ‘trapezoid’}
trapslope : float
normalize_kernel : function
force_odd : boolean
|
---|---|
Returns : | kernel : ndarray
|
Examples
>>> make_kernel([3, 3], 1, 'boxcar')
array([[ 0. 0. 0.]
[ 0. 1. 0.]
[ 0. 0. 0.]])
>>> make_kernel([9], 1) # Gaussian by default
array([ 1.33830625e-04 4.43186162e-03 5.39911274e-02 2.41971446e-01
3.98943469e-01 2.41971446e-01 5.39911274e-02 4.43186162e-03
1.33830625e-04])
>>> make_kernel([3, 3], 3, 'boxcar')
array([[ 0.11111111, 0.11111111, 0.11111111],
[ 0.11111111, 0.11111111, 0.11111111],
[ 0.11111111, 0.11111111, 0.11111111]])
>>> make_kernel([3, 3], 1.4, 'tophat')
array([[ 0. , 0.2, 0. ],
[ 0.2, 0.2, 0.2],
[ 0. , 0.2, 0. ]])