xrheed.preparation

Submodule preparation provides functions for preprocessing RHEED images, including filters, normalization, and background subtraction.

find_horizontal_center(image, n_stripes=10, prominence=0.1, refinement_tolerance=1.0)[source]

Estimate horizontal (sx) symmetry center of a diffraction image.

Parameters:
  • image (xr.DataArray) – 2D image with ‘sx’ and ‘sy’ coordinates.

  • n_stripes (int, optional) – Number of horizontal stripes along ‘sy’ to analyze (default 10).

  • prominence (float, optional) – Minimum prominence for peak detection (relative to normalized profile).

  • refinement_tolerance (float, optional) – Maximum allowed deviation from global center (in sx units, default 0.2 mm).

Returns:

Estimated sx coordinate of symmetry center.

Return type:

float

find_incident_angle(image, y_range=(-30, 30), prominence=0.1)[source]

Find incident angle in degrees using reflection/transmission spots near sx=0.

find_vertical_center(image, center_x=0.0, n_stripes=10, prominence=0.1)[source]

Estimate the vertical (sy) center of a RHEED image using the shadow edge. The image is divided into vertical stripes along ‘sx’; for each stripe, a profile along ‘sy’ is extracted and a linear+sigmoid model is fitted to locate the shadow edge. The final center is the median of valid fits.

Parameters:
  • image (xr.DataArray) – 2D RHEED image with ‘sx’ and ‘sy’ coordinates.

  • center_x (float, optional) – Horizontal center (sx) to subtract from coordinates before analysis (default 0.0). Useful to align profiles to a previously estimated horizontal center.

  • n_stripes (int, optional) – Number of vertical stripes along ‘sx’ to analyze (default 10).

  • prominence (float, optional) – Minimum prominence for peak detection (relative to normalized profile).

Returns:

Estimated sy coordinate of the vertical center.

Return type:

float

high_pass_filter(rheed_data, threshold=0.1, sigma=1.0)[source]

Vectorized high-pass filter to a RHEED image or stack using Gaussian filtering.

Parameters:
  • rheed_data (xr.DataArray) – RHEED image (2D) or image stack (3D) to be filtered. The stack must have the first dimension as the stacking dimension.

  • threshold (float, optional) – Threshold for the high-pass filter (default is 0.1). Scales the blurred image before subtraction.

  • sigma (float, optional) – Standard deviation for the Gaussian kernel in screen units (default is 1.0).

Returns:

High-pass filtered RHEED image or stack.

Return type:

xr.DataArray

Modules

alignment

filters