Check out the Hyperspy Workshop May 13-17, 2024 Online

remove_bad_pixels#

pyxem.utils.diffraction.remove_bad_pixels(z, bad_pixels)[source]#

Replace values in bad pixels with mean of neighbors.

Parameters:
  • z (numpy.ndarray) – A single frame

  • bad_pixels (numpy.ndarray) – Must either have the same shape as dask_array, or the same shape as the two last dimensions of dask_array.

Returns:

data_output

Return type:

Dask array

Examples

>>> import pyxem.utils.dask_tools as dt
>>> s = pxm.data.dummy_data.dummy_data.get_dead_pixel_signal(lazy=True)
>>> dead_pixels = dt._find_dead_pixels(s.data)
>>> data_output = dt._remove_bad_pixels(s.data, dead_pixels)