xes#
Algorithms for the processing of X-ray Emission Spectroscopy data.
This module contains algorithms that perform data processing operations for X-ray Emission Spectroscopy
- class EnergySpectrumRetrieval(*, parameters)#
Beam energy spectrum retrieval.
This algorithm stores all the parameters needed to extract energy spectra from camera data frames.
After the algorithm has been initialized, it can be invoked to calculate an energy spectrum from a data frame.
Warning
This algorithm is designed to be applied to single-panel camera frames, rather than data frames from multi-panel area detectors.
- Parameters:
parameters (XesParameters) –
A set of OM configuration parameters collected together in a parameter group. The parameter group must contain the following entries:
intensity_threshold_in_ADU: An intensity threshold, in ADU units, for pixels in the camera frame to be considered in the spectrum calculation. Pixel below this threshold are ignored.
rotation_in_degrees: The rotation, in degrees, that should be applied to the to align the spectrum information with the vertical axis of the camera data frame.
min_row_in_pix_for_integration: The starting row index for the section of the camera data frame containing the spectrum information (pixels outside this area are ignored).
min_row_in_pix_for_integration: The ending row index for the section of the camera data frame containing the spectrum information (pixels outside this area are ignored).
- calculate_spectrum(*, data)#
Calculates beam energy spectrum information from a camera data frame.
This function extracts energy spectrum information from a provided camera data frame. It returns the raw spectrum information, plus a smoother, filtered version of it.
The function initially rotates the camera image to align the spectrum information with the vertical axis of the camera data frame. It then computes the beam energy spectrum by integrating the region where the energy is recorded along the horizontal axis of the data frame.
Optionally, the algorithm can apply an ADU threshold can to the camera data. If a threshold is provided when the algorithm is initialized, this function excludes from the spectrum calculation all the pixels below the threshold.
- Parameters:
data (ndarray[Any, dtype[float64 | int64]]) – The camera data frame from which the spectrum information must be extracted.
- Returns:
A dictionary storing the spectrum information extracted from the camera frame.
The value corresponding to the key named spectrum is a 1D array storing the raw spectrum information.
The value corresponding to the key named spectrum_smooth is a 1D array storing a filtered, smoothed version of the spectrum.
- Return type:
dict[str, ndarray[Any, dtype[float64]]]