lowpass_fft_filter#

kikuchipy.filters.lowpass_fft_filter(shape: Tuple[int, int], cutoff: Union[int, float], cutoff_width: Union[None, int, float] = None) ndarray[source]#

Return a frequency domain low-pass filter transfer function in 2D.

Used in [Wilkinson et al., 2006].

Parameters:
shape

Shape of function.

cutoff

Cut-off frequency.

cutoff_width

Width of cut-off region. If None (default), it is set to half of the cutoff frequency.

Returns:
window

2D transfer function.

Notes

The low-pass filter transfer function is defined as

\[\begin{split}w(r) = e^{-\left((r - c)/(\sqrt{2}w_c/2)\right)^2}, w(r) = \begin{cases} 0, & r > c + 2w_c \\ 1, & r < c, \end{cases}\end{split}\]

where \(r\) is the radial distance to the window centre, \(c\) is the cut-off frequency, and \(w_c\) is the width of the cut-off region.

Examples

>>> import numpy as np
>>> import kikuchipy as kp
>>> w1 = kp.filters.Window(
...     "lowpass", cutoff=30, cutoff_width=15, shape=(96, 96)
... )
>>> w2 = kp.filters.lowpass_fft_filter(
...     shape=(96, 96), cutoff=30, cutoff_width=15
... )
>>> np.allclose(w1, w2)
True