XAFSmass: a program for calculating the optimal mass of XAFS samples

We present a new implementation of the XAFSmass program that calculates the optimal mass of XAFS samples. It has several improvements as compared to the old Windows based program XAFSmass: 1) it is truly platform independent, as provided by Python language, 2) it has an improved parser of chemical formulas that enables parentheses and nested inclusion-to-matrix weight percentages. The program calculates the absorption edge height given the total optical thickness, operates with differently determined sample amounts (mass, pressure, density or sample area) depending on the aggregate state of the sample and solves the inverse problem of finding the elemental composition given the experimental absorption edge jump and the chemical formula.


Introduction
XAFS samples for transmission measurements can be optimized in quantity based on purely statistical arguments [1]. The XAFS signal-to-noise ratio is maximized with respect to the attenuation by the 1 st ionization chamber (IC), attI 0 , and the optical thickness of the sample, µ T d. The attenuation by the 2 nd IC (I t detector), attI t , is taken as a selectable parameter. If a reference foil is placed between the 2 nd and the 3 rd IC, the fraction of x-rays absorbed by the 2 nd IC is usually set to 50%. If the reference foil is not needed, one can select the total absorption (100%). For these two cases the optimal absorption of the 1 st IC and μ T d are found from figure 1 showing the levels of signal-to-noise ratio.
The elemental composition of the sample is typically known to the experimentalist. The remaining problem is to find the sample quantity given its optimal optical thickness µ T d and the atomic absorption cross-sections.

Parts of XAFSmass
XAFSmass is a free open source software (MIT License). It consists of three Python modules -one for material properties (essentially, the atomic absorption cross-sections calculated via tabulated scattering factors f''), one for a chemical formula parser and the actual calculations and one for a graphical user interface (GUI) built with the platform independent application framework Qt. XAFSmass requires Python interpreter installed (any of its two branches).

Usage of XAFSmass
There are four operation modes depending on the sample nature. Samples can be: 'powder', 'foil, film, glass etc.' (those with known density), 'gas' or 'has unknown concentration'. Figure 2 shows the corresponding GUI views. At the top part of them one can see the underlying calculation formulas.

Powder samples
The optimal optical sample thickness µ T d depends on the absorption levels selected for the ionization chambers (see above). Typically, µ T d is taken between 2 and 3 (e.g. for a 17.4% absorption level for the 1 st chamber and a 50% level for the 2 nd chamber, the optimal thickness is 2.42). However, if you get the absorption step more that 1.5 (reported by the drop-down list "absorptance step"), it is recommended to reduce the sample mass to avoid the potential thickness effect [5] due to possible inhomogeneity in the wafer. One can see in figure 1 that the S/N ratio has a wide maximum: µ T d can be taken two times greater or two times less with a loss in S/N of only ~30%.

Samples with known density
In this mode one can calculate the thickness of the sample with known density (usually, a foil). Commercial foils are highly homogeneous in thickness, so that one may ignore large step jumps with paying attention to µ T d only. By putting µ T d equal to 1, one gets the absorption length.

Gas pressure in ionization chambers
If a reference foil is placed between the 2 nd and the 3 rd IC, the fraction of x-rays absorbed by the 2 nd IC is usually set to 50%. If the reference foil is not needed, one can select the total absorption (exact 100%, however, is never possible). For these two cases the optimal absorption of the 1 st IC is found from Figure 1.

Calculation of an unknown elemental concentration
Method 1: The matrix composition is known. An absorption spectrum taken without the sample (empty spectrum) but with the same state of the ionization chambers is required. It must be then subtracted from the spectrum of the sample, e.g. in VIPER program, and thus a true (i.e. not vertically shifted) absorption coefficient is obtained. Determine the value of µ T d above the edge, the edge jump (Δμd) and its uncertainty (δμd). Specify the chemical formula with x. The unknown molar concentration N x is then found from the formula visible in the lower-right part of Figure 2. Notice that the experimental ratio Δμ/µ T is determined much better than the step height alone since the errors in the numerator and the denominator are equal and of the same sign: . This method, therefore, is more precise than the next one that relies only on the absorption step height.

Method 2:
The sample mass and area are known. Determine the edge jump (Δμd). For the pure element find such a value for μ T d that the absorption step in the pull-down list is equal to the experi- mental Δμd. This gives the mass of the element of interest that needs to be divided by the total sample mass to get the weight percentage.

Experimental example.
Fine powder of CaCO 3 (4.3 mg) was mixed with powder polyethylene and pressed into a 13-mm-diameter pellet. The XAFS spectra are shown in figure 3. After subtracting the empty spectrum (here, of pure polyethylene pellet), the true XAFS spectrum gives: µ T d = 1.54, Δμd = 1.24, δμd = 0.3. This results in wt%(Ca) = 40.5 ± 1.5 by the 1 st method and wt%(Ca) = 40 ± 10 by the 2 nd one. The true value is 40.04 wt%.

Conclusion
The presented program XAFSmass facilitates routine calculations of sample masses by combining a versatile chemical formula parser and several tabulations of the scattering factors. The calculated absorption edge height and its experimental value are an important hint to the experimentalist on the sample uniformity (presence of pin holes). Inversely, the edge height can be used to determine an elemental concentration assuming no holes in the sample.
The program is available at pypi.python.org. The version used in this paper is 1.2.0. XAFSmass is independent of Python version: it works with both branches, 2.x and 3.x, without modification.