Skip to main content

Algodif

Data processing (ALGO)rithms for (DIF)fraction-based X-ray techniques

Methods and software for calibrating multi-element energy-dispersive X-ray (EDX) detectors, processing and visualizing energy-dispersive X-ray diffraction tomography (EDDT) data acquired at a hard X-ray synchrotron beamline.

A detailed description is provided in the paper under review: "Algorithms and software tools for energy-dispersive X-ray diffraction tomography," Nghia T. Vo, Zhong Zhong, and Michael Drakopoulos.

The core of this work is to address a problem: given a list of measured data points not knowing unit, how to map that into a list of reference points knowing unit. The challenge is that the number of measured data points is not the same as the number of reference points, so there are many local minima in the mapping transformation. For X-ray diffraction techniques, it addresses the problem of how to calibrate an instrument using the diffraction pattern or fluorescence spectrum of a known calibrant in a robust and automated fashion.

Although the work was initially aimed at calibrating the HEX beamline instrument (the GeRM detector), the methods and software can be applied to other instruments given standard diffraction patterns or spectra. The specific GeRM geometry is helpful for determining initial guesses of optimizing methods. However, the algorithms in the software are not restricted to the GeRM detector.

Features

  • Methods for peak detection and sub-pixel location.
  • Methods for matching measured peaks to reference peaks.
  • Methods for energy calibration of an EDX detector.
  • Methods for q-calibration of an EDX detector and the GeRM detector.
  • GUIs/CLIs for processing and visualizing EDDT data from the GeRM detector.

Installation

Algodif can be installed using pip or conda:

pip install algodif
conda install -c algotom -c conda-forge algodif

or from source:

git clone https://github.com/algodif/algodif.git
cd algodif
pip install .

Documentation: https://algodif.readthedocs.io

Introduction

The multi-strip germanium energy-dispersive X-ray detector, developed by the detector group and combined with a pinhole geometry at the HEX beamline, NSLS-II, enables both spatial cross-sectional imaging of samples and detailed mapping of their crystal structures. This powerful technique has been routinely used at the beamline since 2023.

img

As illustrated, each detector element captures diffraction signals from a specific region of the sample, known as the gauge volume. The multi-strip detector array simultaneously records diffraction signals from different gauge volumes along the X-ray beam, effectively providing 1D spatially resolved measurements without tomographic reconstruction. By scanning the sample along the Y-axis, a 2D cross-sectional map can be constructed. Importantly, each pixel in this map contains a 1D diffraction pattern corresponding to a specific location within the sample. This is why the technique is called energy-dispersive X-ray diffraction tomography (EDDT): it enables direct tomographic imaging without the computation required in conventional tomography.

img

Calibration

The detector requires frequent calibration for different experimental conditions due to variations in diffraction angles across gauge volumes and the complexity of the detector and readout electronics. Under polychromatic X-ray illumination, the detector can record both fluorescence and diffraction signals, depending on the sample and detector angle. So, two types of calibration are required: energy calibration and reciprocal-space (q) calibration.

Energy calibration

For detector energy calibration, the key idea is to maximize the fluorescence signal while minimizing the diffraction signal. We use a sample composed of thin foils of Sn, Pb, and Au to cover a wide energy range from low to high. A small amount of U is included to extend the calibration range beyond 110 keV. The results before and after energy calibration are shown below.

img img

Q calibration

q-calibration, or reciprocal space calibration, is a major routine in the regular use of this detector at the HEX beamline. The detector needs to be calibrated when the theta angle changes or after a few days of use. In contrast to energy calibration, q-calibration requires minimizing fluorescence and maximizing diffraction signals. We tested several calibrants, including CeO2, Al2O3, Si, and LaB6, and found that Cr2O3 is the best choice for minimizing fluorescence. The tilt of the diffraction lines across the detector strips reflects the variation in scattering angle across the detector.

img img

The robustness and reliability of this routine depend critically on the peak detection and peak matching methods, which we have developed and refined over time. Details of these methods are provided in the referenced paper and the source code.

User interface software

We provide separate GUIs for different workflows and visualization tasks. Although combining everything into a single GUI may seem appealing, we chose a modular approach to simplify maintenance and accommodate the diverse needs of beamline operations. These tools (Python scripts) can be organized and launched through the script-runner GUI.

img

multi_lines_viewer

4d_viewer

Author

Nghia T. Vo - National Synchrotron Light Source II, Brookhaven National Lab, USA.

Metadata

Release files for algodif 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for algodif 1.0.0
File Size Uploaded Provenance Actions
algodif-1.0.0.tar.gz 52.1 kB Without provenance Details for algodif-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for algodif 1.0.0
File Interpreter ABI Platform Actions
algodif-1.0.0-py3-none-any.whl Python 3 none any Details for algodif-1.0.0-py3-none-any.whl

Total release size: 92.6 kB

Release files / algodif-1.0.0.tar.gz

Download URL algodif-1.0.0.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a223a25a8761bf8ff1e8ea0903810ca27facdbfe23a6ad2dba14051532aed917
BLAKE2b-256 checksum
How to use checksums
0abb61e5d50fe55103d1a0dff1f7456a6868996a6dd9ce2070068a278ecf0584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / algodif-1.0.0-py3-none-any.whl

Download URL algodif-1.0.0-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d525c55312046494606d7197033dc031d62112e9732ac4906577e54cda45843
BLAKE2b-256 checksum
How to use checksums
ae0e4b288d653bfbbe57dac5079da477e46b2a527c4ed8c722729fb716e01fe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for algodif 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page