\(\newcommand{\AA}{\unicode{x212B}}\)

Larch

Larch is an open-source Python library and set of applications for processing and analyzing X-ray absorption and fluorescence spectroscopy data and X-ray fluorescence and diffraction image data from synchrotron beamlines. Larch provides a comprehensive set fo analysis tools for X-ray absorption fine-structure spectroscopy (XAFS), including both X-ray absorption near-edge spectroscopy (XANES) and extended X-ray absorption fine-structure spectroscopy (EXAFS). Larch also provides visualization and analysis tools for X-ray fluorescence (XRF) spectra and XRF and X-ray diffraction (XRD) images as collected at scanning X-ray microprobe beamlines.

Larch is written in Python and relies on the excellent scientific python libraries including numpy, scipy, h5py, matplotlib. In turn, Larch provides a comprehensive Python library for processing and analyzing X-ray spectroscopy and imaging data. Several Python libraries - xraydb, larixite, lmfit, asteval, wxmplot, and pyshortcuts - were originally built for or Larch, or as a part of Larch and then spun-off into separate libraries that can be used by the broader X-ray and scientific programming communities.

Larch includes a few GUI applications that provide user-friendly and interactive data visualization for many common X-ray analysis tasks. The most notable of these are Larix, GSE Map Viewer, and Larch XRF.

Larch includes a Python-like macro language - the “Larch language” - for interactive and batch processing. This macro language is an isolated, restricted “mini-Python” (from asteval), intended to be easy to use and complete enough to automate data processing and analysis available as an interactive command-line interface. This command-line interface is available either from the larch or Larch GUI. While not recommended for serious programming, it is an important part of the Larch package and the bridge between the GUI applications and writing batch-processing analysis scripts.

Most of the GUIs (notably, Larix) work by generating and executing this “Larch code”, with all of the real work done through this macro language. This allows for self-documented and reproducible analysis sessions, and facilitates transitioning from GUI-only analyses to scripting, batch processing, and programmatic analysis of larger data sets. That is, with a few simple changes and added boilerplate code, the Larch macro code saved from a GUI session becomes a Python program. This macro language also allows Larch to be run as a background service so that other processes can use Larch as the analysis engine - this was the original motivation and is still an important consideration. The popular Demeter XAFS application suite can use Larch in this way, though the Larix now contains almost all of the features of Demeter and is much more actively being developed and maintained.

Larch is distribute under the open-source MIT license. Larch is under active and open development centered at the GeoScoilEnviroCARS sector of Center for Advanced Radiation Sources at the University of Chicago. Support has come from the US National Science Foundation Earth Sciences Division, currently through SEES: Synchrotron Earth and Environmental Science (EAR-222327), and previously from NSF Earth Sciences Division (EAR-1128799), and Department of Energy GeoSciences (DE-FG02-94ER14466). Funding specifically for Larch was granted by the National Science Foundation - Advanced CyberInfrastructure (ACI-1450468).

Table of Larch Applications

These applications installed with Larch, in addition to a basic Python library. Here, the Application Type will be GUI = Graphical User Interface, CLI = Command Line Interface, or Broswer to indictate that it runs in a browser. beta indicates a work in progress, and dep indicates that it is deprecated and not recommended for primary use. The Feff6L and Feff8L codes are the open-source versions of Feff6 and Feff8, written by the Feff Project, and included with Larch by permission and with license to redistribute.

Application Name

Type

Description

Larix

GUI

XAFS Processing and Analysis: XANES, EXAFS, run Feff, Feff-fitting, more.

XRFMap Viewer

GUI

XRF Map Viewer for GSECARS-style X-ray microprobe data.

Larch_XRF

GUI

Display and Analyze XRF Spectra.

Larch_XRD1D

GUI beta

Display and work with 1-D XRD patterns

sitka spruce

GUI beta

Data Browser for HDF5 and Zarr data

qtrixs

GUI beta

Display RIXS planes, take profiles

Jupyter Lab

Browser

Run Jupyter Lab in a browser using the Python installed with X-ray Larch.

feff8l

CLI

Feff 8 EXAFS calculations (no XANES)

feff6l

CLI dep

Feff 6 EXAFS calculations

larch

CLI dep

simple shell command-line interface

Larch GUI

GUI dep

enhanced command-line interface with data browser

Table of Contents