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

correct_bad_pixels#

Diffraction2D.correct_bad_pixels(bad_pixel_array, **kwargs)[source]#

Correct bad (dead/hot) pixels by replacing their values with the mean value of neighbors.

Parameters:
  • bad_pixel_array (array-like) – List of pixels to correct

  • show_progressbar (bool, optional) – Default True

  • lazy_output (bool, optional) – When working lazily, determines if the result is computed. Default is True (ie. no .compute)

  • inplace (bool, optional) – When working in memory, determines if operation is performed inplace, default is True. When working lazily the result will NOT be inplace.

  • *args – passed to hyperspy.api.signals.BaseSignal.map() if working in memory

  • **kwargs – passed to hyperspy.api.signals.BaseSignal.map() if working in memory

Returns:

signal_corrected

Return type:

pyxem.signals.Diffraction2D or pyxem.signals.LazyDiffraction2D

Examples

>>> s = pxm.data.dummy_data.get_hot_pixel_signal()
>>> s_hot_pixels = s.find_hot_pixels()
>>> s_corr = s.correct_bad_pixels(s_hot_pixels)