| Larch: Data Analysis Tools for X-ray Spectroscopy

# 9. XAFS Analysis

One of the primary motivations for Larch was processing XAFS data. Larch was originally conceived to be version 2 of Ifeffit [XAFS_1], replacing and expanding all the XAFS analysis capabilities of that package. XAFS Analysis can generally be broken into a few separate steps: This replacement is essentially complete insofar as all the main functionality of Ifeffit is available in Larch. There may still be a few minor features of Ifeffit that are not yet available, and some functionality to port from Athena [XAFS_2] back to the core library. In addition, there are some minor differences in implementation details, so that slightly different numerical results may be obtained. Importantly, several features are available with Larch that were not available with Ifeffit 1.2 and some small errors in Ifeffit 1.2 have been fixed.

> 1. Reading in raw data.
> 2. Making corrections to the data, and converting to \(\mu(E)\)
> 3. Pre-edge background removal and normalization.
> 4. Interpreting normalized \(mu(E)\) as XANES spectra
> 5. Post-edge background removal, conversion to \(\chi(k)\)
> 6. XAFS Fourier Transform to \(\chi(R)\)
> 7. Reading and processing FEFF Paths from external files.
> 8. Fitting XAFS \(\chi(k)\) to a sum of FEFF paths.

The XAFS-specific functions in Larch follow these general steps. They are all kept in the `_xafs` Group, which can be easily accessed, as this is in the default search path.

- 9.1. XAFS Functions: Overview and Naming Conventions
  - 9.1.1. Naming conventions for XAFS arrays
  - 9.1.2. Plotting Macros for XAFS
  - 9.1.3. Utility Functions for XAFS
- 9.2. XAFS: Pre-edge Subtraction, Normalization, and data treatment
  - 9.2.1. The `pre_edge()` function
  - 9.2.2. Pre-Edge Subtraction Example
  - 9.2.3. The MBACK algorithm
  - 9.2.4. Over-absorption Corrections
  - 9.2.5. Spectral deconvolution
- 9.3. XAFS: Post-edge Background Subtraction
  - 9.3.1. The `autobk()` function
  - 9.3.2. The AUTOBK Algorithm
  - 9.3.3. Examples
- 9.4. XAFS: Fourier Transforms for XAFS
  - 9.4.1. Overview of XAFS Fourier transforms
  - 9.4.2. Forward XAFS Fourier transforms (\(k{\rightarrow}R\))
  - 9.4.3. Reverse XAFS Fourier transforms (\(R{\rightarrow}q\))
  - 9.4.4. `ftwindow()`: Generating Fourier transform windows
  - 9.4.5. Catalog of Fourier transform window
  - 9.4.6. Examples: Forward XAFS Fourier transforms
  - 9.4.7. Examples: Reverse XAFS Fourier transforms, Fourier Filtering
- 9.5. XAFS: Wavelet Transforms for XAFS
  - 9.5.1. `cauchy_wavelet()`
  - 9.5.2. Wavelet Example
- 9.6. XAFS: Reading and using Feff Paths
  - 9.6.1. Running Feff
  - 9.6.2. `feffpath()` and FeffPath Groups
  - 9.6.3. `path2chi()` and `ff2chi()`: Generating \(\chi(k)\) for a FeffPath
  - 9.6.4. The _feffdat Group: Full Details of the Feff.Dat File
  - 9.6.5. The EXAFS Equation using Feff and FeffPath Groups
  - 9.6.6. Models for Calculating \(\sigma^2\)
  - 9.6.7. Example: Reading a FEFF file
  - 9.6.8. Example: Adding FEFF files
  - 9.6.9. Example: Using Path Parameters when adding FEFF files
- 9.7. XAFS: Fitting XAFS to Feff Paths
  - 9.7.1. The Feffit Strategy for Modeling EXAFS Data
  - 9.7.2. Fit statistics and goodness-of-fit meassures for `feffit()`
  - 9.7.3. The Feffit functions in Larch
  - 9.7.4. `feffit_transform()` and the Feffit Transform Group
  - 9.7.5. `feffit_dataset()`
  - 9.7.6. `feffit()`
  - 9.7.7. `feffit_report()`
  - 9.7.8. Example 1: Simple fit with 1 Path
  - 9.7.9. Example 2: Fit 1 dataset with 3 Paths
  - 9.7.10. Example 3: Fit 3 datasets with 1 Path each
  - 9.7.11. Example 4: Measuring Coordination number
  - 9.7.12. Example 5: Comparing Fits in different Fit Spaces
  - 9.7.13. Example 6: Testing EXAFS sensitivity to \(Z\)
- 9.8. XAFS: Computing anomalous scattering factors from XAFS data
  - 9.8.1. Overview of the diffKK implementation
  - 9.8.2. diffKK on L edge data

References

[XAFS_1] | M Newville. Ifeffit: interactive xafs analysis and feff fitting. Journal of Synchrotron Radiation, 8(Part 2):322–324, MAR 2001. doi:10.1107/S0909049500016964.

[XAFS_2] | B Ravel and M Newville. ATHENA, ARTEMIS, HEPHAESTUS: data analysis for X-ray absorption spectroscopy using IFEFFIT. Journal of Synchrotron Radiation, 12(Part 4):537–541, 2005. doi:10.1107/S0909049505012719.