Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Tools for analyzing X-ray absorbance spectroscopy data

Project description

Build status Test coverage status Documentation status

Xanespy is a library for analyzing X-ray absorbance spectroscopy data for materials science, chemistry and similar fields. The major focus is on X-ray microscopy frames collected at multiple energies and over multiple timesteps. However, a design goal is for most (if not all) of the calculation routines to be applicable to bulk XAS data as well.

Motivation & Features

  • Importing and analysis of transmission X-ray microscopy framesets
  • Analysis of X-ray spectroscopy data (K-edge XANES and L-edge)
  • Efficient analysis of large operando datasets


Xanespy can be installed from the python package index (PyPI) using pip

$ pip install xanespy


Each beamline generally has its own importer in the xanespy.importers module, which will process the data and create an HDF5 file ready for the rest of xanespy to use

import xanespy

# Example for importing from SSRL 6-2c

# Load a pre-defined XAS edge or create your own subclass xanespy.Edge
edge = xanespy.k_edges['Ni_NCA']
# Now load the newly created HDF5 file and the X-ray absorbance edge
fs = xanespy.XanesFrameset(filename='imported_data.h5', edge=edge)

# Perform automatic frame alignment
# Fit the absorbance spectra and extract the edge position (SLOW!)

# Inspect the result with the built-in Qt5 GUI


We currently have importers for data from the following beamlines. If you would like support a beamline that is not listed and are willing to share some test data publicly, please open an issue.

  • 32-ID-C - Advanced Photon Source
  • 8-BM-B - Advanced Photon Source
  • 6-2c - Stanford Synchrotron Radiation Lightsource
  • - Advanced Light Source (ptychography)


Xanespy has support for ptychography data from ALS beamline Use xanespy.import_nanosurveyor_frameset to import the .cxi files and xanespy.PtychoFrameset to load the data.


This project is released under the GNU General Public License version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


This work was supported as part of the NorthEast Center for Chemical Energy Storage (NECCES), an Energy Frontier Research Center funded by the U.S. Department of Energy, Office of Science, Basic Energy Sciences under Award # DE-SC0012583.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for xanespy, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size xanespy-0.3.3-py3-none-any.whl (122.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size xanespy-0.3.3.tar.gz (107.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page