prtools.fftconv#

fftconv(array, kernel, normalize_kernel=True, fft_array=True, fft_kernel=False, fftshift_kernel=False)[source]#

Convolve an array with a kernel using the FFT.

The colvolution is computed as

\[u*v = \mathcal{F}^{-1}\left\{\mathcal{F}\{u\}\cdot\mathcal{F}\{v\}\right\}\]
Parameters:
  • array (array_like) – Array to be convolved with kernel.

  • kernel (array_like) – Convolution kernel. Should have the same shape as array.

  • normalize_kernel (bool, optional) – If True (default), kernel is normalized so that sum(kernel) == 1.

  • fft_array (bool, optional) – If True (default), the array is assumed to be provided in the spatial domain and its FFT will be computed by this function. If False, the array is assumed to be provided in the frequency domain.

  • fft_kernel (bool, optional) – If True, the kernel is assumed to be provided in the spatial domain and its FFT will be computed by this function. If False (default), the kernel is assumed to be provided in the frequency domain.

  • fftshift_kernel (bool, optional) – If True, the supplied kernel will be shifted so that its zero-frequency (DC) term is placed at the upper left (0,0) corner of the array. Default is False.

Return type:

ndarray