Background removal

XAS analysis requires removing background contributions and normalizing the signal. This is performed in different steps, represented by different commands. In EstraPy, the background removal is represented by the subtraction of the background before the edge, called the preedge, the removal of the background after the edge, called the postedge, and removing contributions to the signal due to free, non-interacting electrons. These three steps are performed using the preedge, postedge and background commands.

PreEdge

The preedge command estimates the preedge contribution from the signal in the a column, stores it in the pre column, and updates the signal with the corrected values. The preedge is modelled as a polynomial of degree n, usually linear, in the given range, and extrapolates the estimate across the entire data range. The range can be specified in either eV or k.

preedge <range> [--options]
Argument Explanation
<range> The range considered to perform the regression. See Number and unit specification for the range syntax explanation.
--constant / -C Models the preedge as a polynomial of order 0 (a constant contribution)
--linear / -l Models the preedge as a polynomial of order 1 (a linear contribution)
--quadratic / -q Models the preedge as a polynomial of order 2
--cubic / -c Models the preedge as a polynomial of order 3
--polynomial / -p <degree> Models the preedge as a polynomial of order degree

PostEdge

The postedge command estimates the postedge contribution from the signal in the a column and stores it in the post column. It then creates the mu and x columns, which represent the XANES (\(\mu\)) and EXAFS (\(\chi\))signal intensities respectively. The postedge is modelled as a polynomial of degree n in the given range, and this estimation is extrapolated across the entire data range. The range can be specified in either eV or k. The command also defines the variable J0 for each file, defined to be the value of the postedge estimated at \(E = E_{0}\).

postedge <range> [--options]
Argument Explanation
<range> The range considered to perform the regression. See Number and unit specification for the range syntax explanation.
--constant / -C Models the postedge as a polynomial of order 0 (a constant contribution).
--linear / -l Models the postedge as a polynomial of order 1 (a linear contribution).
--quadratic / -q Models the postedge as a polynomial of order 2.
--cubic / -c Models the postedge as a polynomial of order 3.
--polynomial / -p <degree> Models the postedge as a polynomial of order degree.
--divide / -d Corrects the data by dividing the a column by the postedge.
--subtract / -s Corrects the data by subtracting the postedge from the a column.
--energy / -e Performs the polynomial regression on \(\alpha_(E)\), in energy space. If neither this flag nor --wavevector is specified, the regression space is inferred from the range.
--wavevector / -k Performs the polynomial regression on \(\alpha_(k)\), in wavevector space. If neither this flag nor --energy is specified, the regression space is inferred from the range.

Background

The background command removes spurious contribution to the EXAFS signal. It extracts the background contribution from the signal in the x column, and stores it in the bkg column. This background is then subtracted from the signal, yielding the corrected data back on the x column. The command supports multiple methods for background estimation.

background <mode> [--options]

Constant

Removes a constant contribution, by default equal to 1, from the data. This is useful if no background correction is needed, but the result of normalization has mean value of 1.

background constant [--options]
Argument Explanation
--value / -v <value> Subtracts the given value from the signal. Default is 1.0.

BSpline

Models the background using B-splines, automatically determining the optimal smoothing. Uses scipy.interpolate.UnivariateSpline. The range can be specified in eV or k.

background bspline <range> [--options]
Argument Explanation
<range> The range considered to perform the fit. See Number and unit specification for the range syntax explanation.
--kweight / -k <value> Performs the operation on data weighed by the specified factor: \(k^{n}\cdot\chi(k)\). By default, does not weigh the data (equal to a kweight of 0).

Fourier

Models the background as low-frequency Fourier contributions. This method performs a continuous Fourier transform on the signal in k-space, filters out the high frequencies uses a Hann window (up to Rmax), and then performs the inverse transform to estimate the background.

background fourier <Rmax> [--options]
Argument Explanation
<Rmax> The upper bound of the range of the inverse fourier transform. See Number and unit specification for the syntax explanation.
--kweight / -k <value> Performs the operation on data weighed by the specified factor: \(k^{n}\cdot\chi(k)\). By default, does not weigh the data (equal to a kweight of 0).
--iterations / -i The number of times to iterate the method. By default, applies the background removal three times.

Smoothing

Models the background as a smoothed version of the raw data. The method uses the lowess algorithm to smooth the data.

background smoothing <range> [--options]
Argument Explanation
<range> The range considered to perform the smoothing. See Number and unit specification for the range syntax explanation.
--kweight / -k <value> Performs the operation on data weighed by the specified factor: \(k^{n}\cdot\chi(k)\). By default, does not weigh the data (equal to a kweight of 0).
--iterations / -i The number of times to iterate the method. By default, applies the background removal once.
--fraction / -f The fraction of the total datapoints to use for the smoothing. Must be between 0 and 1. By default uses 30% of the datapoints (0.3)

Examples

PreEdge example

preedge .. -80eV -l

This snippet subtracts a linear preedge from the a column, estimated over the region from \(-\infty\) to -80eV relative to \(E_{0}\) (determined in a previous edgeenergy step).

PostEdge example

postedge 3k .. -cde

This snippet divides the data by a cubic polinomial, fitted over \(\alpha(E)\) in the region from 3k to \(\infty\), to model the postedge contribution of the a column, resulting in the mu column, representing the XANES spectrum, and the x column, representing the EXAFS spectrum.

Background example

background fourier 1.1A -k2

This snippet estimates the background from the lower frequencies of the fourier transform, up to 1.1A, with a k-weight of 2. The process is performed three times (the default value). The background contribution is then subtracted from the signal.