Following the collection of Xray fluorescence (XRF) spectra on MX beamlines, element analysis is performed automatically on the spectrum using PyMCA software. The PyMCA software uses the characteristic emission line energies of elements to fit the peaks and identify elements in the sample. The results of this element analysis are displayed in ISPyB, with labels showing the emission lines fitted to each peak in the spectrum.

The peaks that PyMCA will look for depends on the photon energy that the scan is run at. Only elements with an absorption edge lower than the photon energy can be detected. Additionally, for peaks to be fitted, the emission lines must be lower in energy than the Compton scattering region as this part of the spectrum (near the photon energy) is excluded. The automated PyMCA fitter will also only look for eligible elements from a select list of elements that are relevant to typical MX samples. This list is as follows:
| Element | Absorption Edge |
Absorption Edge Energy (keV) |
| I | L3 |
4.557 |
| Xe | L3 |
4.786 |
|
Ti |
K | 4.966 |
| V | K |
5.465 |
| Cr | K |
5.989 |
| Mn | K |
6.539 |
| Fe | K | 7.112 |
| Gd | L3 | 7.243 |
| Co | K | 7.709 |
| Ni | K | 8.333 |
| Cu | K | 8.979 |
| Zn | K | 9.659 |
| W | L3 | 10.207 |
| Os | L3 | 10.871 |
| Ir | L3 | 11.215 |
| Pt | L3 | 11.564 |
| As | K | 11.867 |
| Au | L3 | 11.919 |
| Hg | L3 | 12.284 |
| Se | K | 12.658 |
| Pb | L3 | 13.035 |
| Br | K | 13.474 |
| Sr | K | 16.105 |
| Mo | K | 20.000 |
On I23, which is able to access lower photon energies than the other MX beamlines, some additional elements are searched for:
| Element | Absorption Edge | Absorption Edge Energy (keV) |
|---|---|---|
| Na | K | 1.071 |
| Mg | K | 1.303 |
| Mo | L | 2.520 |
| P | K | 2.145 |
| S | K | 2.472 |
| Cl | K | 2.822 |
| Ag | L3 | 3.351 |
| Cd | L3 | 3.538 |
| K | K | 3.608 |
| Ca | K | 4.039 |
The fit output by the automated PyMCA fitter can be inspected by running PyMCA on a diamond workstation or NoMachine session. A quick guide showing you how to do this is given below. For a more detailed guide on how to use the PyMCA software, resources are available elsewhere.
To run PyMCA, open a terminal session and run:
module load pymca
pymca
This will open the PyMCA GUI. Once open, the XRF spectrum can be opened via File > Open > Data Source and finding the XRF spectrum (.mca file) in your visit directory. These will typically be located in the top directory of the visit and will be named with the timestamp of when the spectrum was collected.

Once open, the spectrum energy calibration can be applied by selecting the "Original (from Source)" option from the calibration drop-down menu.

To load the fit provided by the automated PyMCA fitter service, first click on the "FIT" icon above the spectrum and select "Advanced." This will open a new window, showing the spectrum.

Clicking on the Configure button, will open another window, and in here, clicking the Load button will allow you to open a fit configuration file.

The fit configuration file generated by the automated PyMCA fitter is located in the processed/pymca sub-directory of your visit directory and will contain .cfg files with timestamps that match the spectrum files. Open the one corresponding to the spectrum you are viewing.

The parameters used for the fit will then be displayed in the fit parameters window. Clicking ok will apply the parameters but you will need to click "Fit Again!" in order for the fitted peaks to be shown on the spectrum. Note, if you decide to alter the fitting parameters, be aware that the fitting will crash if you set to fit peaks or features that are out of range of the fitting region of interest. From here, you can inspect the fitted peaks on the graph, or see the fitted peak areas in the "Table" tab.

Diamond Light Source is the UK's national synchrotron science facility, located at the Harwell Science and Innovation Campus in Oxfordshire.
Diamond Light Source Ltd
Diamond House
Harwell Science & Innovation Campus
Didcot
Oxfordshire
OX11 0DE
Copyright © Diamond Light Source. Diamond Light Source® and the Diamond logo are registered trademarks of Diamond Light Source Ltd
Registered in England and Wales at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom. Company number: 4375679. VAT number: 287 461 957. Economic Operators Registration and Identification (EORI) number: GB287461957003.