# Compute thickness¶

This tutorial shows how to use the main functionality of STRATAGem, to compute the mass thickness of a layer from experimentally measured k-ratios. For this example, we used the calculated k-ratios from the previous tutorial (Custom standard) as “experimental k-ratios”. We should therefore compute a Al2O3 layer with a thickness of 30 nm.

As usual, let’s start by importing the important classes and constants.

import math
from stratagemtools.sample import Sample, composition_from_formula
from stratagemtools.experiment import Experiment, LINE_KA
from stratagemtools.stratagem import Stratagem, PRZMODE_XPP, FLUORESCENCE_LINE_CONT


The next step is to define our Sample. Note here that we do not specify any thickness for the Al2O3 layer. No argument is given, which is equivalent to setting the thickness to None.

unknown = Sample({14: 1.0})


From the previous tutorial (Custom standard), the following Al and O $$\text{K}\alpha$$ k-ratios were respectively calculated 0.034 and 0.058 using the Al2O3 standard. We now use these values to define the experiments. We do not need to know the k-ratio for the Si $$\text{K}\alpha$$, but we need to specify this element as not analyzed.

energy_eV = 15e3
exp_si = Experiment(14, LINE_KA, energy_eV, analyzed=False)
exp_al = Experiment(13, LINE_KA, energy_eV, kratio=0.034, standard=std_al2o3)
exp_o = Experiment(8, LINE_KA, energy_eV, kratio=0.058, standard=std_al2o3)


We then execute the method compute from the Stratagem interface to compute the unknown thickness. The method returns a new Sample object with the calculated thickness. Note that the new Sample object could also be retrieved from the method get_sample or the property sample after executing the compute method.

with Stratagem() as strata:
strata.set_prz_mode(PRZMODE_XPP)
strata.set_fluorescence(FLUORESCENCE_LINE_CONT)

strata.set_sample(unknown)

thickness_m = newsample.get_layer(0).thickness_m