pyextal.larbed.calibration

Detector MTF calibration from a probe / vacuum scan.

Note

Legacy. Because pyextal.larbed.LARBEDAnalysis.IntegrateLarbed() integrates over an aperture, deconvolving against the MTF mainly adds noise and is normally skipped. The step-length measurement here is still useful on its own for calibrating the tilt scan.

Classes

LARBEDCalibration

Measures the detector point-spread function and the tilt-scan step length.

Module Contents

class pyextal.larbed.calibration.LARBEDCalibration(file_name)

Measures the detector point-spread function and the tilt-scan step length.

The input is a reference scan taken with no sample and descan off, so only the direct beam is present and it walks across the detector. The usual sequence is load_data(), find_peaks(), calculate_average_step_length(), crop_peaks(), interpolate(), and calculate_mtf().

Variables:
  • data (np.ndarray) – The 4D reference stack.

  • peaks (np.ndarray) – Fitted (x, y) beam position at each scan step.

  • average_step_length (float) – Mean beam displacement per scan step, in detector pixels.

  • probe_image (np.ndarray) – The interpolated probe shape.

  • mtf_2d (np.ndarray) – The modulation transfer function, in the Fourier domain.

file_name
data = []
crop_data = []
probe_image = None
mtf_2d = None
peaks = None
roi_size = None
load_data(type=0)

Reads the reference scan and displays its middle pattern.

Parameters:

type (int, optional) – Detector layout, passed to pyextal.larbed.empad.ReadRaw(). Defaults to 0.

meanimage()

Averages the reference stack.

Returns:

The mean 2D pattern.

Return type:

np.ndarray

find_peaks(start=1, end=255)

Fits the beam position in every pattern of a square scan sub-region.

Parameters:
  • start (int, optional) – First scan index of the sub-region. Defaults to 1.

  • end (int, optional) – One past the last scan index. Defaults to 255.

crop_peaks(crop_size=20)

Crops and sub-pixel aligns a patch around each fitted beam position.

Parameters:

crop_size (int, optional) – Side length of each patch in pixels. Defaults to 20.

calculate_average_step_length()

Measures the mean beam displacement per scan step, in detector pixels.

This is the quantity that converts the tilt scan into reciprocal space; combined with the detector calibration and the length of the x-axis reflection it gives the gl passed to the refinement stage.

interpolate()

Rescales the averaged probe patch by the measured step length.

calculate_mtf(pad_size=256)

Transforms the probe image into a normalised Fourier-domain MTF.

The result is suitable for pyextal.LucyRichardson.lucy_Richardson() with mode='fourier'.

Parameters:

pad_size (int, optional) – Size the probe image is zero-padded to before the transform. Defaults to 256.