Model functions

In the following subsections, all used model functions which are used for the lmfit models in Background Models as well as in Peak-like/Step-like models are documented.

Lineshapes

lmfitxps.lineshapes.singlett(x, amplitude, sigma, gamma, gaussian_sigma, center)[source]

Calculates the convolution of a Doniach-Sunjic with a Gaussian. Thereby, the Gaussian acts as the convolution kernel.

Parameters:
  • x (array-like) – Array containing the energy of the spectrum to fit. Works for both, kinetic+binding energy scaled data.

  • amplitude (float) – factor used to scale the calculated convolution to the measured spectrum. This factor is used as the amplitude of the Doniach profile.

  • sigma (float) – Sigma of the Doniach profile

  • gamma (float) – asymmetry factor gamma of the Doniach profile

  • gaussian_sigma (float) – sigma of the gaussian profile which is used as the convolution kernel

  • center (float) – position of the maximum of the measured spectrum

Returns:

convolution of a doniach profile and a gaussian profile

Return type:

array-type

lmfitxps.lineshapes.dublett(x, amplitude, sigma, gamma, gaussian_sigma, center, soc, height_ratio, fct_coster_kronig)[source]

Calculates the convolution of a Doniach-Sunjic Dublett with a Gaussian. Thereby, the Gaussian acts as the convolution kernel.

Parameters:
  • x (array-like) – Array containing the energy of the spectrum to fit. Works for both, kinetic+binding energy scaled data.

  • amplitude (float) – factor used to scale the calculated convolution to the measured spectrum. This factor is used as the amplitude of the Doniach profile.

  • sigma (float) – Sigma of the Doniach profile

  • gamma (float) – asymmetry factor gamma of the Doniach profile

  • gaussian_sigma (float) – sigma of the gaussian profile which is used as the convolution kernel

  • center (float) – position of the maximum of the measured spectrum

  • soc (float) – distance of the second-highest peak (higher-bound-orbital) of the spectrum in relation to the maximum of the spectrum (the lower-bound orbital). Given in absolute values, the model function automatically detects if binding or kinetic energy scale is used.

  • height_ratio (float) – height ratio of the second-highest peak (higher-bound-orbital) of the spectrum in relation to the maximum of the spectrum (the lower-bound orbital)

  • fct_coster_kronig (float) – ratio of the lorentzian-sigma of the second-highest peak (higher-bound-orbital) of the spectrum in relation to the maximum of the spectrum (the lower-bound orbital)

Returns:

convolution of a doniach dublett and a gaussian profile

Return type:

array-type

lmfitxps.lineshapes.fermi_edge(x, amplitude, center, kt, sigma)[source]

Calculates the convolution of a Thermal Distribution (Fermi-Dirac Distribution) with a Gaussian. Thereby, the Gaussian acts as the convolution kernel.

Parameters:
  • x (array-like) – Array containing the energy of the spectrum to fit. Works for both, kinetic+binding energy scaled data.

  • amplitude (float) – factor used to scale the calculated convolution to the measured spectrum. This factor is used as the amplitude of the Gaussian Kernel.

  • center (float) – position of the step of the fermi edge

  • kt (float) – boltzmann constant in eV multiplied with the temperature T in kelvin (i.e. for room temperature kt=kb*T=8.6173e-5 eV/K*300K=0.02585 eV)

  • sigma (float) – Sigma of the gaussian profile which is used as the convolution kernel

Returns:

convolution of a fermi dirac distribution and a gaussian profile

Return type:

array-type

Background model functions

lmfitxps.backgrounds.shirley(y, k, const)[source]

Calculates the Shirley background for X-ray photoelectron spectroscopy (XPS) spectra by integrating the step characteristic of the spectrum. For further details, please refer to Shirley [5] or Jansson et al. [6].

Hint

The Shirley background is typically calculated iteratively using the following formula:

\[B_{S, n}(E) = k_n \cdot \int_{E}^{E_{\text{right}}} [I(E') - I_{\text{right}} - B_{S, n-1}(E')] \, dE'\]

Using this iterative process, makes it necessary to calculate the Shirley background before the fitting procedure, which is not always meaningful. If you want to use this approach, please use the shirley_calculate() function.

Here the Shirley background is computed according to:

\[B_S(E)=k\cdot \int_{E}^{E_{\text{right}}}\left[I(E')-I_{\text{right}}\right] \, dE'\]

In the actual implementation of the function, \(I_{\text{right}}\) corresponds to const and is substracted from the intensity data y (\(I(E)\)) before calculating the integral by summing over the intensities. This approach allows to include the Shirley background into the fitting model (e.g. as implemented in the ShirleyBG lmfitxps model) and to be adaptively determined during the fitting process, while still preserving the iterative concept of the Shirley’s background calculation.

Parameters

Type

Description

y

array

1D-array containing the y-values (intensities) of the spectrum.

k

float

Shirley parameter \(k\), determines step-height of the Shirley background.

const

float

Constant value added to the step-like Shirley background, often set to \(I_{\text{right}}\).

Note

This function is used as the model function in the ShirleyBG lmfitxps model.

lmfitxps.backgrounds.slope(y, k)[source]

Calculates the Slope background for X-ray photoelectron spectroscopy (XPS) spectra. The Slope Background is implemented as suggested by A. Herrera-Gomez et al in [4]. 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:

\[\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 [4].

To get the background itself, equation (6) is integrated:

\[B_{\text{Slope}}(E)= \int_{E}^{E_{\text{right}}} [\frac{B_{\text{Slope}}(E')}{dE'}] \, dE'\]

Parameters

Type

Description

y

array

1D-array containing the y-values (intensities) of the spectrum.

k

float

Slope parameter \(k_{\text{Slope}}\).

Note

This function is used as the model function in the SlopeBG lmfitxps model

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 functions, such as the Shirley background. For further details, please refer to A. Herrera-Gomez et al [4].

lmfitxps.backgrounds.tougaard_closure()[source]

Hint

This function employs a closure to calculate the Tougaard sum only once and subsequently accesses it during subsequent executions of the optimization procedure. When calling tougaard(), you are effectively accessing the inner, nested function.

The concept is as follows:

def tougaard_closure():
    bgrnd=[] #store the Tougaard background to optimize performance by avoiding recalculations
    def tougaard_helper():
        # do actual calculation

tougaard = tougaard_closure()

The Tougaard backlground 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, for details, please refer to 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].

Parameters

Type

Description

x

array

1D-array containing the x-values (energies) of the spectrum.

y

array

1D-array containing the y-values (intensities) of the spectrum.

B

float

B parameter of the 4-PIESCS loss function [1].

C

float

C parameter of the 4-PIESCS loss function [1].

C_d

float

C’ parameter of the 4-PIESCS loss function [1].

D

float

D parameter of the 4-PIESCS loss function [1].

extend

float

Determines, how far the spectrum is extended on the right (in eV). Defaults to 0.

Note

This function is used as the model function in the TougaardBG lmfitxps model.

Convolution Functions

lmfitxps.lineshapes.fft_convolve(data, kernel, is_binding_energy=False)[source]

Calculates the convolution of a data array with a kernel by using the convolution theorem and thereby transforming the time-consuming convolution operation into a multiplication of FFTs. The convolution using this approach is done using the scipy.signal.convolve() function with the method=”fft” attribute. To suppress edge effects and generate a valid convolution on the full data range, the input dataset is extended at the edges.

Parameters:
  • data (array-like) – 1D-array containing the data to convolve

  • kernel (array-like) – 1D-array which defines the kernel used for convolution. If binding energy scale is used, the kernel is inverted/flipped.

  • is_binding_energy (boolean) – Boolean determining type of energy scale which determines the orientation of the kernel

Returns:

convolution of a data array with a kernel array

Return type:

array-type

See also

scipy.signal.convolve

lmfitxps.lineshapes.convolve(data, kernel, is_binding_energy=False)[source]

Calculates the convolution of a data array with a kernel by using numpy convolve function. To suppress edge effects and generate a valid convolution on the full data range, the input dataset is extended at the edges.

Parameters:
  • data (array-like) – 1D-array containing the data to convolve

  • kernel (array-like) – 1D-array which defines the kernel used for convolution. If binding energy scale is used, the kernel is inverted/flipped.

  • is_binding_energy (boolean) – Boolean determining type of energy scale which determines the orientation of the kernel

Returns:

convolution of a data array with a kernel array

Return type:

array-type

See also

numpy.convolve

Note

The fft_convolve function is significantly faster—by more than an order of magnitude—because it utilizes the properties of convolution in the Fourier transform. As a result, it is employed for all convoluted models within the package.

References