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

find_hot_pixels#

Diffraction2D.find_hot_pixels(threshold_multiplier=500, mask=None, inplace=False, **kwargs)[source]#

Find hot pixels in the diffraction images.

Note: this method will be default return a lazy signal, since the size of the returned signal is the same shape as the original signal. So for large datasets actually calculating computing the results can use a lot of memory.

In addition, this signal is currently not very optimized with regards to memory use, so be careful when using this method for large datasets.

Parameters:
  • threshold_multiplier (scalar) – Default 500

  • 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 True.

  • show_progressbar (bool)

Examples

>>> s = pxm.data.dummy_data.get_hot_pixel_signal()
>>> s_hot_pixels = s.find_hot_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_hot_pixel_signal()
>>> s_hot_pixels = s.find_hot_pixels(
...     mask_array=mask_array, show_progressbar=False)

Getting a non-lazy signal as output

>>> s_hot_pixels = s.find_hot_pixels()