radial_profile#

Radial average algorithms.

This module contains classes and functions that perform common data processing operations on radial profile information computed from detector data frames.

class RadialProfileAnalysis(*, geometry_information, parameters)#

Radial profile analysis.

This class stores all the information required to compute radial profiles from detector data frames, and to analyze them. The analysis performed by this class includes optional subtraction of a background profile, detection of a sample droplet (by comparing the intensity of two specific regions of the radial profile), and estimation of the size of the sample droplet.

After the class has been initialized, it can be invoked to compute the radial profile of a data frame, and to analyze it.

Parameters:
  • radial_parameters

    A set of OM configuration parameters collected together in a parameter group. The parameter group must contain the following entries:

    • background_subtraction: Whether a background profile should be subtracted from the radial profile being analyzed. if the value of this parameter is true, a set of vectors describing the background profile are fitted to the profile being analyzed, within a specified region of the radial profile. The background profile is then subtracted, and all subsequent analysis steps are performed on the background-subtracted radial profile. Defaults to False.

    • background_profile_filename: The relative or absolute path to an HDF5 containing vectors that describe a background profile.

      • The vectors must be saved in the file in the format of a 2D array, with each row storing a single 1D vector.

      If the value of the background_subtraction parameter is True, this parameter must be provided and cannot be None.

    • background_profile_hdf5_path: The internal HDF5 path to the data block storing information about the background profile.

      If the value of the background_subtraction parameter is True, this parameter must be provided and cannot be None.

    • background_subtraction_min_fit_bin: The start radial bin for the region where the background profile is fitted to radial profile being analyzed.

      If the value of the background_subtraction parameter is True, this parameter must be provided and cannot be None.

    • background_subtraction_max_fit_bin: The end radial bin for the region where the background profile is fitted to radial profile being analyzed.

      If the value of the background_subtraction parameter is True, this parameter must be provided and cannot be None.

    • sample_detection: Whether sample droplet detection should be part of the analysis carried out by this class. Defaults to False.

    • total_intensity_jet_threshold: An intensity threshold used to determine if a liquid jet is present in the area irradiated by the beam. If the total intensity recorded in the detector data frame is below this threshold, no jet, and therefore no sample is assumed to be present in the detector frame.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • roi1_qmin: Start, in q coordinates, of the first region of interest in the radial profile for the detection of a sample droplet.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • roi1_qmax: End, in q coordinates, of the first region of interest in the radial profile for the detection of a sample droplet.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • roi2_qmin: Start, in q coordinates, of the second region of interest in the radial profile for the detection of a sample droplet.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • roi2_qmax: End, in q coordinates, of the second region of interest in the radial profile for the detection of a sample droplet.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • ”minimum_roi1_to_roi2_intensity_ratio_for_sample: minimum ratio the intensities recorded in the first and second regions of interest must have for a sample droplet to be detected in the detector frame.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • ”maximum_roi1_to_roi2_intensity_ratio_for_sample: maximum ratio the intensities recorded in the first and second regions of interest must have for a sample droplet to be detected in the detector frame.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

    • estimate_particle_size: Whether the analysis should include an estimation of the sample droplet size, if a droplet was detected in the detector frame. Defaults to False.

    • size_estimation_method: The strategy that should be used to estimate the size of a sample droplet. This parameter can currently have one of the following values:

      • guinier: The droplet size is estimated using the Guinier method.

      • peak: The droplet size is estimated using the Guinier peak method.

      • sphere: The droplet size is estimated using the Sphere method from the Reborn software package.

      If the value of the sample_detection parameter is True, this parameter must be provided and cannot be None.

  • geometry_information (GeometryInformation)

  • parameters (MonitorParameters)

analyze_radial_profile(*, data, beam_energy, detector_distance, downstream_intensity)#

Calculate and analyze a radial profile from a detector data frame.

This function calculates and analyzes the radial profile of the provided detector data frame.

Parameters:
  • data (ndarray[Any, dtype[float64 | int64]]) – the detector data frame for which the radial profile must be computed and analyzed.

  • beam_energy (float)

  • detector_distance (float)

  • downstream_intensity (float)

Returns:

A radial profile whose value is the average radial intensity calculated from the data frame.

Return type:

tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], bool, float, float, float, float]

class RadialProfileAnalysisPlots(*, parameters)#

#TODO: Documentation.

Parameters:

parameters (MonitorParameters)

update_plots(*, radial_profile, detector_data_sum, q, downstream_intensity, roi1_intensity, roi2_intensity, sample_detected, rg)#

#TODO: Documentation.

Parameters:
  • radial_profile (ndarray[Any, dtype[float64]])

  • detector_data_sum (float)

  • q (ndarray[Any, dtype[float64]])

  • downstream_intensity (float)

  • roi1_intensity (float)

  • roi2_intensity (float)

  • sample_detected (bool)

  • rg (float)

Return type:

tuple[deque[ndarray[Any, dtype[float64]]], deque[ndarray[Any, dtype[float64]]], deque[float], deque[float], deque[float], deque[float], deque[float], deque[float], ndarray[Any, dtype[float64]]]

clear_plots()#

# TODO: Add documentation.

Return type:

None