prtools.fftconv#

fftconv(array, kernel, normalize_kernel=True, fft_array=True, fft_kernel=True)[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 kernel = kernel / np.sum(kernel).

  • fft_array (bool, optional) – If True (default), the array is assumed to be provided in the spatial domain. If False, the array is assumed to be provided in the frequency domain.

  • fft_kernel (bool, optional) – If True (default), the kernel is assumed to be provided in the spatial domain. If False, the kernel is assumed to be provided in the frequency domain.

Return type:

ndarray