filter#
- Diffraction2D.filter(func, inplace=False, **kwargs)[source]#
Filters the entire dataset given some function applied to the data.
The function must take a numpy or dask array as input and return a numpy or dask array as output which has the same shape, and axes as the input.
- Parameters:
func (function) – Function to apply to the data. Must take a numpy or dask array as input and return a numpy or dask array as output which has the same shape as the input.
inplace (bool, optional) – If True, the data is replaced by the filtered data. If False, a new signal is returned. Default False.
**kwargs – Passed to the function.
Examples
>>> import pyxem as pxm >>> from scipy.ndimage import gaussian_filter >>> s = pxm.data.dummy_data.get_cbed_signal() >>> s_filtered = s.filter(gaussian_filter, sigma=1)