XANES Example
This example demonstrates a complete workflow for processing XANES data using EstraPy. It covers:
- Directory setup and data loading
- Basic data cleaning and normalization
- Pre-edge and post-edge fitting
- Noise estimation
- Final plotting and export
1. Directory Setup and Data Loading
The tutorial assumes a rigid directory structure for organizing raw and processed data. EstraPy never modifies raw files, and is designed to be fast enough to be frequently re-run as you adjust parameters.
Therefore, we recommend a clean separation between raw data and processing outputs.
.
├── analysis # Analysis folder (contains EstraPy projects and outputs)
│ ├── xanes.estra # EstraPy project file
│ │
│ └── xanes # Output folder generated by EstraPy
│ └── xanes.log
│
└── data # Raw data directory (contains original data files)
├── scan_01.xy # Raw data files (never modified by EstraPy)
:
└── scan_09.xy
In this structure:
- The
datafolder contains all raw data files (e.g.scan_01.xy,scan_02.xy, …,scan_09.xy). These files are never modified by EstraPy. - The
analysisfolder contains the EstraPy project file (xanes.estra). Once the .estra file is run, it generates a subfolderxaneswhere all processed data, logs, images and outputs are stored. This separation allows you to freely re-run the .estra file, adjusting parameters as needed, without worrying about overwriting raw data.
1.1. Data structure
Let’s first examine the structure of the raw data files. Each file is a text file with a number of header lines (starting with #) followed by columns of data. In this case, this is the head of one of the files:
# Sample: Fe2O3
# Edge: Fe K-edge
To load the data, we start by creating a new EstraPy project and adding the raw files:
# version 2.0.1
# Let's give a title to the project
%title "XANES Analysis Example"
# Read the input files. The path supports relative paths
# (relative to the .estra file) and glob patterns.
filein "data/scan_*.xy"