Background Models
ShirleyBG
- class lmfitxps.models.ShirleyBG(*args, **kwargs)[source]
Model of the Shirley background for X-ray photoelectron spectroscopy (XPS) spectra. This implementation calculates the Shirley background by integrating the step characteristic of the spectrum. For further details, please refer to Shirley [6] or Jansson et al. [7].
The Shirley background is calculated using the following integral:
(4)\[B_S(E)=k\cdot \int_{E}^{E_{\text{right}}}\left[I(E')-I_{\text{right}}\right] \, dE'\]The Shirley background is typically calculated iteratively using the following formula:
(5)\[B_{S, n}(E) = k_n \cdot \int_{E}^{E_{\text{right}}} [I(E') - I_{\text{right}} - B_{S, n-1}(E')] \, dE'\]The iterative process continues until the difference \(B_{S, n}(E) - B_{S, n-1}(E)\) becomes smaller than a specified tolerance value \(tol\). This approach is implemented in the function referenced as shirley_calculate().
However, calculating the Shirley background before fitting and calculating it with high precision in each fitting step are not practically meaningful. Instead, the Shirley background is computed according to the equation (4) within each iteration of the model optimization. This ensures that the Shirley background is adaptively determined during the fitting process, preserving the iterative concept of its calculation.
Table 4 Model-specific available parameters Parameters
Type
Description
x
array1D-array containing the x-values (energies) of the spectrum.
y
array1D-array containing the y-values (intensities) of the spectrum.
k
floatShirley parameter \(k\), determines step-height of the Shirley background.
const
floatConstant value added to the step-like Shirley background, often set to \(I_{\text{right}}\).
Hint
The ShirleyBG class inherits from lmfit.model.Model and acts as a predefined model for calculating the Shirley background.Therefore, the lmfit.model.Model class parameters are inherited as well.
LMFIT: Common models documentation
- Parameters:
independent_vars (
listofstr, optional) – Arguments to the model function that are independent variables default is [‘x’]).prefix (str, optional) – String to prepend to parameter names, needed to add two Models that have parameter names in common.
nan_policy ({'raise', 'propagate', 'omit'}, optional) – How to handle NaN and missing values in data. See Notes below.
**kwargs (optional) – Keyword arguments to pass to
Model.
Notes
1. nan_policy sets what to do when a NaN or missing value is seen in the data. Should be one of:
‘raise’ : raise a ValueError (default)
‘propagate’ : do nothing
‘omit’ : drop missing data
Note
The class functions are inherited from the lmfit Model class. For details, please refer to their documentation at lmfit Model Class Methods.
TougaardBG
- class lmfitxps.models.TougaardBG(*args, **kwargs)[source]
The TougaardBG model is based on the four-parameter loss function (4-PIESCS) as suggested by R.Hesse [1].
In addition to R.Hesse’s approach, this model introduces the extend parameter, which enhances the agreement between the data and the Tougaard background by extending the data on the high-kinetic energy side (low binding energy side) using the mean value of the rightmost ten intensity values (with regard to kinetic energy scale, binding energy scale vice versa).The extend parameter represents the length of the data extension on the high-kinetic-energy side in eV and defaults to 0.This approach was found to lead to great convergence empirically with the extend value being in the range of 25eV to 75eV; however, the length of the data extension remains arbitrary and depends on the dataset.For further details, please read more in The ‘extend’ parameter in TougaardBG.
The Tougaard background is calculated using:
\[B_T(E) = \int_{E}^{\infty} \frac{B \cdot T}{{(C + C_d \cdot T^2)^2} + D \cdot T^2} \cdot y(E') \, dE'\]where:
\(B_T(E)\) represents the Tougaard background at energy \(E\),
\(y(E')\) is the measured intensity at \(E'\),
\(T\) is the energy difference \(E' - E\).
\(B\) parameter of the 4-PIESCS loss function as introduced by R.Hesse [1]. Acts as the scaling factor for the Tougaard background model.
\(C\) , \(C_d\) and \(D\) are parameter of the 4-PIESCS loss function as introduced by R.Hesse [1].
To generate the 2-PIESCS loss function, set \(C_d\) to 1 and \(D\) to 0. Set \(C_d=1\) and \(D !=\) \(0\) to get the 3-PIESCS loss function.
For further details on the 2-PIESCS loss function, please refer to S.Tougaard [2], and for the 3-PIESCS loss function, see S. Tougaard [3].
Table 5 Model-specific available parameters Parameters
Type
Description
x
array1D-array containing the x-values (energies) of the spectrum.
y
array1D-array containing the y-values (intensities) of the spectrum.
B
floatB parameter of the 4-PIESCS loss function [1].
C
floatC parameter of the 4-PIESCS loss function [1].
C_d
floatC’ parameter of the 4-PIESCS loss function [1].
D
floatD parameter of the 4-PIESCS loss function [1].
extend
floatDetermines, how far the spectrum is extended on the right (in eV).
Hint
The TougaardBG class inherits from lmfit.model.Model and extends it with specific behavior and functionality related to the Tougaard 4-parameter loss function. Therefore, the lmfit.model.Model class parameters are inherited as well.
LMFIT: Common models documentation
- Parameters:
independent_vars (
listofstr, optional) – Arguments to the model function that are independent variables default is [‘x’]).prefix (str, optional) – String to prepend to parameter names, needed to add two Models that have parameter names in common.
nan_policy ({'raise', 'propagate', 'omit'}, optional) – How to handle NaN and missing values in data. See Notes below.
**kwargs (optional) – Keyword arguments to pass to
Model.
Notes
1. nan_policy sets what to do when a NaN or missing value is seen in the data. Should be one of:
‘raise’ : raise a ValueError (default)
‘propagate’ : do nothing
‘omit’ : drop missing data
Note
The class functions are inherited from the lmfit Model class. For details, please refer to their documentation at lmfit Model Class Methods.
The ‘extend’ parameter in TougaardBG
The challenge in calculating an approximation to the Tougaard background involves the following:
The factor B is adjusted to give zero intensity in a region between 30 and 50 eV below the characteristic peak structure [4].
That’s due to:
[…] that the peaks extend to ∼30 eV on the low energy side of the characteristic peaks. The intensity in this energy range arises from the intrinsic (or shake-up) electrons. [4] [5]
However, in practice, measuring high-resolution spectra across such a broad energy range is typically unfeasible.
Due to the nature of the Tougaard background, one encounters the integral:
Here, \(B_C\) is a constant term. However, when dealing with substantial asymmetry in the observed peaks, we found empirically that this approach using an added constant does not lead to an accurate approximation of the background.
To generate such a background, the TougaardBG -model could be used with extend set to \(0\) and an additional ConstantModel from lmfit.
import lmfit
import lmfitxps
tougaard_bg=lmfitxps.models.TougaardBG(prefix='tougaard_', independent_vars=['y', 'x'])
const_bg=lmfit.models.ConstantModel(prefix='const_')
bg_model=tougaard_bg+const_bg
params = lmfit.Parameters()
params.add('tougaard_extend', value=0)
# Set all other parameters
ConvGaussianDoniachDublett.extend parameter.As shown in the figure below, the combination of TougaardBG and ConstantModel already leads to a good agreement between fit and experimental data.
Due to the small asymmetry of the Au4f-signal only small improvement of the fit was achieved by using \(extend\) != \(0\). This is shown in the four figures below.
The reduced chi-squared, which judges the agreement between model and experimental data, is only slightly decreased using \(28 \leq \text{extend} \leq 30\). In addition, the figure below confirms, that using the TougaardBG with \(extend!=0\) is valid for modeling the background too.
The following figure illustrates the difference between \(B_T(\text{extend}) - (B_T(\text{extend}=0) + B_C)\) and also displays the variation in residuals between models where \(\text{extend} \neq 0\) and the model with \(\text{extend} = 0\).
Clear patterns emerge among the backgrounds when :math:text{extend} neq 0, exhibiting a nearly linear behavior as they move away from the peak. In contrast, the model with :math:text{extend} = 0 displays a distinct parabolic shape, as illustrated in the figure below.
If the parabolic characteristic of the Tougaard background is too pronounced, the approximated Tougaard background with :math:text{extend} = 0 often intersects the data short below the fitted peak signal. This behavior does not fulfill the intended function of approaching the measured background around 30-50 eV on the low-energy side beneath the peak, which accounts for previously mentioned shake-up electrons.
Nevertheless, when compared to an average background value of approximately :math:I = 2700 counts, discrepancies among various models remain within a confined range of about 2%.
SlopeBG
- class lmfitxps.models.SlopeBG(*args, **kwargs)[source]
Model of the Slope background for X-ray photoelectron spectroscopy (XPS) spectra. The Slope Background is implemented as suggested by A. Herrera-Gomez et al in [8]. Hereby, while the Shirley background is designed to account for the difference in background height between the two sides of a peak, the Slope background is designed to account for the change in slope. This is done in a manner that resembles the Shirley method:
(6)\[\frac{B_{\text{Slope}}(E)}{dE} = -k_{\text{Slope}} \cdot \int_{E}^{E_{\text{right}}} [I(E') - I_{\text{right}} ] \, dE'\]where:
\(\frac{B_{\text{Slope}}(E)}{dE}\) represents the slope of the background at energy \(E\),
\(I(E')\) is the measured intensity at \(E'\),
\(I_{\text{right}}\) is the measured intensity of the rightmost datapoint,
\(k_{\text{Slope}}\) parameter to scale the integral to resemble the measured data. This parameter is related to the Tougaard background. For details see [8].
To get the background itself, equation (6) is integrated:
(7)\[ B_{\text{Slope}}(E)= \int_{E}^{E_{\text{right}}} [\frac{B_{\text{Slope}}(E')}{dE'}] \, dE'\]Table 6 Model-specific available parameters Parameters
Type
Description
x
array1D-array containing the x-values (energies) of the spectrum.
y
array1D-array containing the y-values (intensities) of the spectrum.
k
floatSlope parameter \(k_{\text{Slope}}\).
Warning
Please note that the Slope background should not be solely relied upon to mimic a measured XPS background. It is advisable to use it combined with other background models, such as the Shirley background. For further details, please refer to A. Herrera-Gomez et al [8].
Hint
The SlopeBG class inherits from lmfit.model.Model and extends it with specific behavior and functionality related to the Slope background. Therefore, the lmfit.model.Model class parameters are inherited as well.
LMFIT: Common models documentation
- Parameters:
independent_vars (
listofstr, optional) – Arguments to the model function that are independent variables default is [‘x’]).prefix (str, optional) – String to prepend to parameter names, needed to add two Models that have parameter names in common.
nan_policy ({'raise', 'propagate', 'omit'}, optional) – How to handle NaN and missing values in data. See Notes below.
**kwargs (optional) – Keyword arguments to pass to
Model.
Notes
1. nan_policy sets what to do when a NaN or missing value is seen in the data. Should be one of:
‘raise’ : raise a ValueError (default)
‘propagate’ : do nothing
‘omit’ : drop missing data
Note
The class functions are inherited from the lmfit Model class. For details, please refer to their documentation at lmfit Model Class Methods.



