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

get_direct_beam_position#

Diffraction2D.get_direct_beam_position(method, lazy_output=None, signal_slice=None, half_square_width=None, **kwargs)[source]#

Estimate the direct beam position in each experimentally acquired electron diffraction pattern. Returns the shifts required to center the diffraction pattern.

Parameters:
  • method (str,) – Must be one of “cross_correlate”, “blur”, “interpolate” or “center_of_mass”.

    “cross_correlate”: Center finding using cross-correlation of circles of

    radius_start to radius_finish.

    “blur”: Center finding by blurring each frame with a Gaussian kernel with

    standard deviation sigma and finding the maximum.

    “interpolate”: Finding the center by summing along X/Y and finding the peak

    for each axis independently. Data is blurred first using a Gaussian kernel with standard deviation sigma.

    “center_of_mass”: The center is found using a calculation of the center of mass.

    Optionally a mask can be applied to focus on just the center of some dataset. A threshold value can also be given to suppress contrast from weaker diffraction features.

  • lazy_output (optional) – If True, s_shifts will be a lazy signal. If False, a non-lazy signal. By default, if the signal is (non-)lazy, the result will also be (non-)lazy.

  • signal_slice (None or tuple) – A tuple defining the (low_x,high_x, low_y, high_y) to slice the data before finding the direct beam. Equivalent to s.isig[low_x:high_x, low_y:high_y].get_direct_beam_position()+[low_x,low_y])

  • half_square_width (int) – Half the side length of square that captures the direct beam in all scans. Means that the centering algorithm is stable against diffracted spots brighter than the direct beam. Crops the diffraction pattern to half_square_width pixels around th center of the diffraction pattern. Only one of half_square_width or signal_slice can be defined.

  • **kwargs – Additional arguments accepted by pyxem.utils.diffraction.find_beam_center_blur(), pyxem.utils.diffraction.find_beam_center_interpolate(), pyxem.utils.diffraction.find_beam_offset_cross_correlation(), and pyxem.signals.diffraction2d.Diffraction2D.center_of_mass(),

Returns:

s_shifts – Array containing the shifts for each SED pattern, with the first signal index being the x-shift and the second the y-shift.

Return type:

pyxem.signals.BeamShift