EBSD.fft_filter(transfer_function: ndarray | Window, function_domain: str, shift: bool = False, show_progressbar: bool | None = None, inplace: bool = True, lazy_output: bool | None = None) None | EBSD | LazyEBSD[source]#

Filter patterns in the frequency domain.

Patterns are transformed via the Fast Fourier Transform (FFT) to the frequency domain, where their spectrum is multiplied by the transfer_function, and the filtered spectrum is subsequently transformed to the spatial domain via the inverse FFT (IFFT). Filtered patterns are rescaled to input data type range.

Note that if function_domain is "spatial", only real valued FFT and IFFT is used.


Filter to apply to patterns. This can either be a transfer function in the frequency domain of pattern shape or a kernel in the spatial domain. What is passed is determined from function_domain.


Options are "frequency" and "spatial", indicating, respectively, whether the filter function passed to filter_function is a transfer function in the frequency domain or a kernel in the spatial domain.


Whether to shift the zero-frequency component to the center. Default is False. This is only used when function_domain="frequency".


Whether to show a progressbar. If not given, the value of hyperspy.api.preferences.General.show_progressbar is used.


Whether to operate on the current signal or return a new one. Default is True.


Whether the returned signal is lazy. If not given this follows from the current signal. Can only be True if inplace=False.


Filtered signal, returned if inplace=False. Whether it is lazy is determined from lazy_output.


Applying a Gaussian low pass filter with a cutoff frequency of 20:

>>> import kikuchipy as kp
>>> s = kp.data.nickel_ebsd_small()
>>> pattern_shape = s.axes_manager.signal_shape[::-1]
>>> w = kp.filters.Window(
...     "lowpass", cutoff=20, shape=pattern_shape
... )
>>> s.fft_filter(
...     transfer_function=w,
...     function_domain="frequency",
...     shift=True,
... )