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

find_dead_pixels#

Diffraction2D.find_dead_pixels(dead_pixel_value=0, mask=None)[source]#

Find dead pixels in the diffraction images.

Parameters:
  • dead_pixel_value (scalar) – Default 0

  • mask_array (Boolean Numpy array)

  • lazy_result (bool) – If True, return a lazy signal. If False, compute the result and return a non-lazy signal. Default False.

  • show_progressbar (bool)

Returns:

s_dead_pixels – With dead pixels as True, rest as False.

Return type:

HyperSpy 2D signal

Examples

>>> s = pxm.data.dummy_data.get_dead_pixel_signal()
>>> s_dead_pixels = s.find_dead_pixels(show_progressbar=False)

Using a mask array

>>> import numpy as np
>>> mask_array = np.zeros((128, 128), dtype=bool)
>>> mask_array[:, 100:] = True
>>> s = pxm.data.dummy_data.get_dead_pixel_signal()
>>> s_dead_pixels = s.find_dead_pixels(
...     mask_array=mask_array, show_progressbar=False)

Getting a lazy signal as output

>>> s_dead_pixels = s.find_dead_pixels(
...     lazy_result=True, show_progressbar=False)