15.1. XRF Data: MCA and ROI objects¶
XRF spectra are typically measured with MCAs (Multi Channel Analyzers) which holds an array of intensities. Because of the long history of using MCAs to store XRF spectra, the two concepts are often mixed, and one often talks about MCA traces as being the same as XRF spectra. To be sure, an XRF spectrum \(I(E)\) can be represented well with an MCA trace (intensities per bin) as long as one can convert bin number to energy. Fortunately, most measurement systems in use have a linear relation (calibration) between bin number and energy, and the use of an MCA trace as an XRF spectrum is straightforward. We will probably use the terms interchangeably here as well.
Just to be clear: an XRF spectrum collected by an MCA will have a one dimensional array of counts with a single, well-defined energy for each bin. There will typically be between 1000 and 10,000 bins in each spectrum.
An ROI (Region of Interest) is a continuous portion of the XRF spectrum, generally representing a range of energies corresponding to a particular peak or X-ray emission line or family of lines. One often sums the counts in such an ROI to give a total number of counts for that emission line. An MCA spectrum may have many (typically 10s) of ROIs defined for particular emission lines.
In Larch, MCAs and ROIs are exposed as Groups, each with several
attributes, and some built-in functions. For example, An MCA has arrays
counts, as well as values for
live_time, a deadtime correction factor
dt_factor, and several
ROIs. Each ROI has a
right channel index, and a
15.1.1. Creating MCA objects¶
A simple way to create an MCA object is to read one from a disk file. For
data collected at GSECARS, this can be done with the
read a GSECARS MCA spectra file, returning a Group
filename – name of GSECARS MCA file
The returned Group has the following components:
name of file
list of MCA objects for each MCA saved in the file
list of ROIs
list of Environmental Variables
array of energy values
array of counts, deadtime corrected and summed over MCAs
array of counts, summed over MCAs, not corrected.
dictionary of calibration values
deadtime correction factor
real time for data acquisition
live time for data acquisition
number of energy points in spectra
function to get counts for a named ROI
function to save MCA to file
xrf_plot(energy, counts, mca=None)¶
create an interactive window for displaying an X-ray Fluorescence spectra
energy – array of energy values
counts – array of counts
mca – MCA group (as read from
read_gsemca()), containing ROI definitions, calibration values, and related data.
An example plot is shown below