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’}
interpolate_nan : bool
ignore_edge_zeros : bool
min_wt : float
normalize_kernel : function or boolean
|
---|---|
Returns: | default : ndarray
|
Other Parameters: | |
fft_pad : bool
psf_pad : bool
crop : bool
return_fft : bool
nthreads : int
fftn, ifftn : functions
complex_dtype : np.complex
|
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.])