Quantification with PyMCA
This guide is for quantification of elements, however as peak fitting is a prerequisite the
steps for fitting are also described here.
This is not a full and complete guide so it’s worth
having a look at
start with you load the edf files of a map and that allows you to display the total mca
(XRF spectrum) :
tool to load a sum spectrum
(this is a total spectrum from all
pixels so you can use it to test fitting but not for quantificatio
: Go to Experiment_1/nexus folder…..File types:
…Select the .nxs
map file. You then
the file (click on +)…Expand
…2ble click on
…that moves it to the lower field and you tic
channel number to Energy
(for this you need the tutorial)
“Fit” …” Advanced”
: This is where you define the configuration for peak fitting,
experimental setup, sample description etc.
to go back to energy a
. Here you define the fit parameters, the experimental set
and the sample characteristics.
You want to
the background, you may want to include detector artefacts
peaks and you may or not w
ant to fit the
peak (more difficult to fit
the XRF peaks so really you only need to include it if
you have an XRF peak close to
it therefore the background is distorted)
or b) if you are using the scatter peak for
Try different peak tail approximations.
only if the default doesn’t work for you.
something like 5000 as 20K is over th
e top and it will slow down
to fit Escape peaks you have to change the detector material. The
calibration gain and offset have been already picked up from previous steps but when you
do a fit the
move slightly to match the expected XRF peaks. This is usually
you don’t want it tick “Fixed”.
You may also want to adjust the Detector Noise to
something bigger than the default eg 0.2
Tick “Energy 0” and enter the value of exciting beam energy in keV.
you are going to fit the scatter
peak and/or if you are going to do quantification
Select the elements you want to fit and others that may affect the background even if you
are not interested in it (eg big Ar peak next to small
. You need to click on the
on the line (K, L et
c…there are small differences between selecting K or Kα
and Kβ, best practice is to be consistent).
You may want to try different peak shapes and see what fits best.
If all you want is peak fitting that’s as far you need to go. You then “Ok
” and “Fit Again”.
Inspect and go back and change if necessary. The configuration file can be Saved and
for another map.
go to the
window and from
You then find the edf folder, the
fit folder which you have created and the configuration
In most cases you don’t need to tick any of the non
will use the
to test that you
reasonable results before quantifying the whole map
need to load a single
rather than the sum mca you have been working with up to now.
For Old Files (edf):
From the main Pymca window you need to find the “open
” symbol, there are two,
at the very top and a second one further down
left, that’s the one you want. Find the edf
folder and o
an edf file. As this is a stack of all mcas in a row you then need to select
one spectrum from those and you do that from the drop
down menu at “I
mage”. You then
click on “Row 0” and Row field and then you “add”. In the spectrum display you now have
a single mca (although as it will be much lower counts than the total mca to be able to see
it you make have to click “log” a couple of times or delete
the sum spectrum ).
For New Files (.nxs) :
I have not found a neat way to select a pixel in a very accurate manner but you can use the
GUI icons on top right of the window displaying the map (above ICR):
Click on Rectangular selection
then on Brush Selec
then on Select brush : 1 image pixel width and then click on a pixel. That will add the mca
to the main window mca view. As it will be much lower counts than the total mca to be
able to see it you make have to click “log” a couple of times or delete
the sum spectrum.
To click on another pixel you have to make sure you erase the previous selection otherwise
the mcas will be added up. So:
Click on Reset
then on Erase selection
then go through the previous sequence to select another pixel.
To do quant
ification with Pymca you first deal with a spectrum from the reference material
(provided it is uniform you can take any spectrum, if it’s not uniform then it possibly isn’t a
good reference material). You describe this material in terms of main compositio
and thickness. You also need to describe parts of
the experimental setup
calculate the flux on the sample for good agreement between nominal and measured
concentrations. You then use a spectrum from the unknown sample, describe
it if different
from the reference material, describe any changes to the setup and then use the photon
flux you calcu
ted earlier to get an estimate of the levels of the elements of interest.
parameters you determined in the previous st
eps of the configuration file
should still produce a good fit on the single spectrum. Now continue with the
quantification related tabs.
For quantification it is important to declare all materials between the sample and the
“Filters” are in reality anything between
detector eg sample holder
windows etc. You need to select them and give the thickness and
density if not already
in the database
(single elements and some
used for x
exist in the database but you need to check).
refer to attenuation (usually Al) you put in the beam before the sample.
These should only go in the beamfilters positions while
all the other
filters you define
apart from the sample itself and the detector
can go in any position
not have to
be specifically related to the default name given
as the manner in which they
are used in the calculations is identical
The software recognises chemical symbol
s and will automatically input their density. For
composite materials you need to define them in the Mater
ial Editor and then select them.
“Matrix” is where you define the sample
(or reference material )
. If the material doesn’t
already exist in the drop
own menu you need to cre
in the “Material Editor”:
In the “Material” field give it a name
Enter number of compounds and each
chemical symbol with its mass
fraction. You can also enter chemical formulas (if you load the already
e you will see how formulas need to be entered)
Enter default density and thickness although you can also edit these
from the Attenuators fields.
To be able to select your new material in the
you need to first
the configuration file and then
you should be able to see it in the drop
down menus in the
The elements you need to make sure you define in the matrix are the main
as they determine how the XRF signal from the elements
of interest gets
attenuated by the sample matrix
. Often these main elements are invisible in terms of XRF
signal eg C, O, H
but sometimes they are
present in the X
ray spectrum eg Fe in
the elements of interest
present in large quantities
don’t need to be given
in the sample description
however if they exist in non
levels they may influence the calculated levels of the others. It may be best to check this eg
by comparing the calculated levels when the
matrix includes the element of interest that is
in substantial amounts and when it doesn’t (
levels > 0.5 %)
you will always have :
Air is already defined and selectable but you can also type He.
“Filter4 “ : Window
for both detectors
but it’s 0.00125 cm
thick for the Vortex and 0.0125cm for the Xspress.
“Detector” : Ge : 0.75cm thick for Xspress and Si: 0.035 cm thick for the Vortex.
and outgoing angles
the defaults 45
° are what is
used on the
beamline by default.
As shown, the
matrix definition is only necessary for
specific applications of
Use the default
. The “Matrix composition”
you have an “internal standard” ie an element other than
the unknown for which you have reliable concentration data
, Sample Detector
(SDD) and detector
: 170 mm
for the Vortex and 400 mm
for the Xspress.
NB: If you do change SDD between measurements
the right numbers
results as expected (signal ~1/R
) but you could have errors introduced from the fact that
different detector elements could be
more or less by signal due t
relative geometry to the sample.
to get the correct quantities of the known
material. You can then use this flux to predict the quantities in the
unknown samples provided you are careful to update the other
as SDD, time, and
that may be different between sample and reference material
different types of
(MF) by default and
if you select it. The MF approach is much
more flexible it basically means any w/w
(ppm, % etc) but it can also be used for
mass expressions eg
which is how thin film standards are usually characterised. However with such use
you have to be careful on how you trans
late the results for materials
that are not thin
section on AXO
You haven’t got the same flexibility with
MF in the
can only be mass fractions (totalling 1)
and not ppm or %.
I have not tested the
Do a “Fit again” and see what concentrations PyMCA has calculated.
Adjust the “Flux” to get the right numbers. You can then use this flux for
the unknown samples
the configuration file.
Click on “HTML Report” to produce a nu
mber of files that contain
concentration, peak fitting parameters and configuration.
If you want to get the concentrations of each pixel of a map you need to
do a “Batch fit” but include the “Concentrations”
the selected choices.