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

template_match#

Diffraction2D.template_match(template, inplace=False, **kwargs)[source]#

Template match the signal dimensions with a binary image.

Used to find diffraction disks in convergent beam electron diffraction data.

Might also work with non-binary images, but this haven’t been extensively tested.

Parameters:
  • template (numpy.ndarray) – The 2D template to match with the signal.

  • inplace (bool, optional) – If True, the data is replaced by the filtered data. If False, a new signal is returned. Default False.

  • **kwargs – Any additional keyword arguments to be passed to pyxem.utils.diffraction.normalize_template_match()

Return type:

pyxem.signals.Diffraction2D

Examples

>>> import pyxem as pxm
>>> s = pxm.data.dummy_data.get_cbed_signal()
>>> binary_image = np.random.randint(0, 2, (6, 6))
>>> s_template = s.template_match_with_binary_image(
...     binary_image, show_progressbar=False)
>>> s.plot()