Convolve an ndarray with an nd-kernel. Returns a convolved image with shape = array.shape. Assumes kernel is centered.
convolve_fft differs from scipy.signal.fftconvolve in a few ways:
Parameters: | array : numpy.ndarray
kernel : numpy.ndarray
boundary : {‘fill’, ‘wrap’}, optional
interpolate_nan : bool, optional
ignore_edge_zeros : bool, optional
min_wt : float, optional
normalize_kernel : function or boolean, optional
|
---|---|
Returns: | default : ndarray
|
Other Parameters: | |
fft_pad : bool, optional
psf_pad : bool, optional
crop : bool, optional
return_fft : bool, optional
fftn, ifftn : functions, optional
complex_dtype : np.complex, optional
quiet : bool, optional
allow_huge : bool, optional
|
|
Raises: | ValueError:
|
See also
Examples
>>> convolve_fft([1, 0, 3], [1, 1, 1])
array([ 1., 4., 3.])
>>> convolve_fft([1, np.nan, 3], [1, 1, 1])
array([ 1., 4., 3.])
>>> convolve_fft([1, 0, 3], [0, 1, 0])
array([ 1., 0., 3.])
>>> convolve_fft([1, 2, 3], [1])
array([ 1., 2., 3.])
>>> convolve_fft([1, np.nan, 3], [0, 1, 0], interpolate_nan=True)
...
array([ 1., 0., 3.])
>>> convolve_fft([1, np.nan, 3], [0, 1, 0], interpolate_nan=True,
... min_wt=1e-8)
array([ 1., nan, 3.])
>>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True)
array([ 1., 4., 3.])
>>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True,
... normalize_kernel=True, ignore_edge_zeros=True)
array([ 1., 2., 3.])
>>> import scipy.fftpack # optional - requires scipy
>>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True,
... normalize_kernel=True, ignore_edge_zeros=True,
... fftn=scipy.fftpack.fft, ifftn=scipy.fftpack.ifft)
array([ 1., 2., 3.])