pyextal.larbed.calibration ========================== .. py:module:: pyextal.larbed.calibration .. autoapi-nested-parse:: Detector MTF calibration from a probe / vacuum scan. .. note:: Legacy. Because :meth:`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 ------- .. autoapisummary:: pyextal.larbed.calibration.LARBEDCalibration Module Contents --------------- .. py:class:: 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 :meth:`load_data`, :meth:`find_peaks`, :meth:`calculate_average_step_length`, :meth:`crop_peaks`, :meth:`interpolate`, and :meth:`calculate_mtf`. :ivar data: The 4D reference stack. :vartype data: np.ndarray :ivar peaks: Fitted (x, y) beam position at each scan step. :vartype peaks: np.ndarray :ivar average_step_length: Mean beam displacement per scan step, in detector pixels. :vartype average_step_length: float :ivar probe_image: The interpolated probe shape. :vartype probe_image: np.ndarray :ivar mtf_2d: The modulation transfer function, in the Fourier domain. :vartype mtf_2d: np.ndarray .. py:attribute:: file_name .. py:attribute:: data :value: [] .. py:attribute:: crop_data :value: [] .. py:attribute:: probe_image :value: None .. py:attribute:: mtf_2d :value: None .. py:attribute:: peaks :value: None .. py:attribute:: roi_size :value: None .. py:method:: load_data(type=0) Reads the reference scan and displays its middle pattern. :param type: Detector layout, passed to :func:`pyextal.larbed.empad.ReadRaw`. Defaults to 0. :type type: int, optional .. py:method:: meanimage() Averages the reference stack. :returns: The mean 2D pattern. :rtype: np.ndarray .. py:method:: find_peaks(start=1, end=255) Fits the beam position in every pattern of a square scan sub-region. :param start: First scan index of the sub-region. Defaults to 1. :type start: int, optional :param end: One past the last scan index. Defaults to 255. :type end: int, optional .. py:method:: crop_peaks(crop_size=20) Crops and sub-pixel aligns a patch around each fitted beam position. :param crop_size: Side length of each patch in pixels. Defaults to 20. :type crop_size: int, optional .. py:method:: 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. .. py:method:: interpolate() Rescales the averaged probe patch by the measured step length. .. py:method:: calculate_mtf(pad_size=256) Transforms the probe image into a normalised Fourier-domain MTF. The result is suitable for :func:`pyextal.LucyRichardson.lucy_Richardson` with ``mode='fourier'``. :param pad_size: Size the probe image is zero-padded to before the transform. Defaults to 256. :type pad_size: int, optional