Skip to main content
AutoEMX

PyPI version Python Version CI License: Custom Non-Commercial Nature Communications Publication Docs Test quantification PR Welcome

Automated Electron Microscopy X-Ray Spectroscopy for Compositional Characterization of Materials

AutoEMX is a fully automated framework for SEM-EDS workflows — from spectral acquisition and quantification, to principled filtering and compositional analysis — all in one click.

🎥 Watch AutoEMX in action on a desktop SEM-EDS system at https://youtu.be/Bym58gNxlj0

🧪 Try quantification now: upload a .msa or .emsa spectrum at https://autoemx-singlespectrum.streamlit.app

📖 This work is described in:
A. Giunto et al., Accurate SEM‑EDS Quantification, Automation, and Machine Learning Enable High‑Throughput Compositional Characterization of Powders, Nature Communications 17, 9735 (2026).
DOI: https://doi.org/10.1038/s41467-026-76633-x

✨ Key Features

  • Fully automated SEM-EDS phase-level compositional analysis workflow, which includes:

    • Acquisition of EDS spectra, including particle localization if sample is powder. Compatible also with bulk samples, or manual navigation.
    • Automated peak identification and element assignment for unknown samples
    • Quantification of compositions using the peak-to-background method
    • Rule-based filtering of compositions to discard poorly quantified spectra from the analysis
    • Unsupervised machine learning–based analysis to identify the compositions of individual phases in the sample
  • AutoEMX GUI — acquire spectra with the microscope, quantify the samples of a project, run their clustering analysis with every parameter and explore the clusters in interactive 3D / ternary / 2D plots linked to the spectra and SEM images, and fit/quantify single spectra. Works also with spectra acquired and exported with commercial software (.msa, .emsa, .msg)

  • Automated experimental standard collection scripts

  • Automated particle size distribution measurements scripts

  • Extensible architecture — adaptable to other techniques such as

    • Wavelength Dispersive Spectroscopy (WDS)
    • Scanning Transmission Electron Microscopy (STEM) with EDS
  • Extensible hardware support — includes driver for ThermoFisher Phenom Desktop SEM series, and can be extended to any electron microscope with a Python API

📊 Performance

  • Benchmarked on 74 single-phase samples with compositions spanning 38 elements (from nitrogen to bismuth), it achieved <5–10% relative deviation from expected values
  • Machine learning compositional analysis detects individual phase composition in multi-phase samples, including minor phases
  • Intermixed phases can also be resolved
  • Works with spectra from any microscope, although recalibration is recommended for maximum compositional accuracy

🧪 Supported Use Cases

  • Scanning Electron Microscopy (SEM) with Energy-Dispersive Spectroscopy (EDS)
  • Powders and rough samples, e.g. rough films, or pellets, with automated segmentation.
  • Bulk, flat samples, probed by defining a grid of points.
  • Manual navigation of any sample.

⚙️ Requirements

  • Cross-platform: runs on Linux, macOS, and Windows
  • Quick installation via pip

📑 Table of Contents


🧪 Try quantification on your spectrum

Upload a .msa or .emsa spectrum acquired at 15 kV and test quantification in the browser:

👉 https://autoemx-singlespectrum.streamlit.app


📘 Documentation

Installation instructions, usage examples, and workflow descriptions are available in the AutoEMX documentation:

👉 https://cedergrouphub.github.io/AutoEMX/


📦 Requirements

  • Python 3.11 or newer
  • All dependencies are installed automatically via pip or conda.
  • Tested versions of dependencies are specified in pyproject.toml.

    The package may work with more recent versions, but these have not been tested.


Electron Microscope Support

  • ✅ Developed and tested for Thermo Fisher Phenom Desktop SEMs.
  • ✅ Compatible with any Phenom microscope equipped with PPI (Phenom Programming Interface).
  • ⚠️ For other microscope models, the driver must be adapted to the appropriate API commands (easy to do with modern LLMs).

📂 Project Structure

The repository is organized as follows:

AutoEMX/
├── autoemx/                 # Main package source code
│   ├── config/                 # Configuration files, including default values to employ during measurements.
│   ├── core/                   # Core objects and source code
│   ├── data/                   # Libraries of X-ray data
│   ├── microscope_drivers/              # Electron Microscope driver (⚠️ adapt to your own instrument)
│   ├── runners/                # Runner functions calling on core objects
│   ├── scripts/                # Scripts to run acquisition, quantification, etc. (see full list below)
│   ├── web/                    # Streamlit app of the online single-spectrum demo
│   ├── gui/                    # Local GUI: acquisition, quantification, analysis, single spectrum (`python -m autoemx.gui`)
│   ├── calibrations/             # Detector models of supported microscopes (your instrument's calibrations are kept in ~/.autoemx)
│   ├── utils/                  # Utility functions and strings employed by the program
│
├── examples/                  # Example scripts for fitting, quantification and compositional analysis of example data
├── tests/                     # CI smoke suite (`test_ci_smoke.py`) + offline workflow/unit tests
│                               # Hardware-only scripts stay capitalized (`Test_EM_driver.py`)
├── paper_data/                # Raw paper data uploaded on Git LFS (Dowload instructions in Paper Data section below)
│
├── LICENSE.txt
├── README.md
└── pyproject.toml

📁 Scripts

This repository includes a collection of scripts that streamline the use of AutoEMX. Each script is tailored for a specific task in spectral acquisition, calibration, quantification, or analysis. Below are the main scripts available in autoemx/scripts/ and their purposes:

🔬 Acquisition, Quantification & Analysis

  • Run_Acquisition.py — Acquire X-ray spectra from the microscope (supports automated and manual modes).
  • Run_Quantification.py — Quantify acquired spectra (single or multiple samples) and perform machine-learning analysis.
  • Run_Analysis.py — Launch customized machine-learning analysis on previously quantified data.
  • Set_Active_Analysis.py — Choose which quantification run and analysis of a sample are active (reused by later runs, shown in the GUI).
  • Fit_Quant_Single_AutoEMX_Spectrum.py — Fit and optionally quantify a single spectrum measured with AutoEMX. Prints fitting parameters and plots fitted spectrum for detailed inspection of model performance.
  • Fit_Quant_Single_MSA_Spectrum.py — Fit and optionally quantify a single spectrum exported by proprietary software.
  • quantify_external_spectra.py — Quantify spectra acquired outside AutoEMX (e.g., from other SEM-EDS systems).
  • Annotate_Particle_Images.py — Draw the positions of the measured spectra on the particle images of a sample.
  • Online demo — upload .msa / .emsa and test quantification at https://autoemx-singlespectrum.streamlit.app, without installing AutoEMX. Locally, use the Single spectrum tab of the AutoEMX GUI.

📊 Particle Size Distribution Measurements

  • Collect_Particle_Statistics.py — Analyse sample, collecting particle size statistics and distribution.
  • Process_Particle_Stats_Files.py — Filter out particles from acquired particle size data and recompute the statistics.
  • Reanalyse_Particle_Stats.py — Segment the saved frame images of a particle size measurement again with other settings and rebuild the statistics.

🛠️ Calibration of Your Instrument

  • Run_SDD_Calibration.py — Calibrate the energy scale of the SDD detector.
  • Run_Experimental_Standard_Collection.py — Acquire and fit experimental standards, to obtain reference P/B values.
  • Refit_Experimental_Standards.py — Refit previously acquired experimental standards.
  • Modify_EDS_Standards_File.py — Delete standards, or exclude them from the reference P/B values.
  • Extract_Experimental_Standards_Details.py — Summarize the available standards (elements, peaks, P/B values).
  • Calibrate_Peak_Sigma_Params.py, Calibrate_Peak_Shape_Params.py, Calibrate_Background_Params.py — Calibrate the detector model of a new microscope (peak widths, peak tails, background).

⚗️ Characterize Extent of Intermixing in Known Powder Mixtures

(see Chem. Mater. 2025, 37, 6807−6822 for example)
Use the same scripts as regular composition characterization, as described in the docs Tutorial.

👉 All scripts can be executed directly from the command line or imported into a Python environment, making them accessible from anywhere on your system.


🤝 Contributing

Contributions are welcome! Need a feature or guide that is not available? Please ask for it in the GitHub Discussions: requests help us prioritize.

Open to collaborations to extend this package to different tools or to different types of samples, for example thin films. Please contact me at agiunto@lbl.gov


📄 License

Free use for non-commercial use only. Contact IPO@lbl.gov for commercial purposes.

This project is licensed under a NON-COMMERCIAL USE ONLY license — see the LICENSE file for details.


📖 Citation

If you use AutoEMX in your research, please cite the following publication:

A. Giunto, Y. Fei, P. Nevatia, B. Rendy, N. J. Szymanski & G. Ceder, Accurate SEM‑EDS Quantification, Automation, and Machine Learning Enable High‑Throughput Compositional Characterization of Powders, Nature Communications 17, 9735 (2026). DOI: https://doi.org/10.1038/s41467-026-76633-x

BibTeX

@article{Giunto2026AutoEMX,
  author  = {Giunto, Andrea and Fei, Yuxing and Nevatia, Pragnay and Rendy, Bernardus and Szymanski, Nathan J. and Ceder, Gerbrand},
  title   = {Accurate SEM‑EDS Quantification, Automation, and Machine Learning Enable High‑Throughput Compositional Characterization of Powders},
  journal = {Nature Communications},
  volume  = {17},
  pages   = {9735},
  year    = {2026},
  doi     = {10.1038/s41467-026-76633-x},
  url     = {https://doi.org/10.1038/s41467-026-76633-x},
}

📂 Paper Data

The raw data used in the associated publication is stored in the paper_data/ directory.
These files are tracked with Git LFS (Large File Storage).

🔽 Download with Git LFS

The repository is automatically cloned without Git LFS; you will only see placeholder files instead of the actual datasets inside paper_data/.
To download the full data, on the terminal go to the repo directory and:

# 1. Install Git LFS (only needed once per machine)
git lfs install

# 2. Fetch the data files
git lfs fetch --all
git lfs checkout

Alternatively, download manually from the github repo Download button.

After downloading, run the run_analysis.py or run_quantification_analysis.py scripts within the folder.


📬 Contact

For questions or issues, please open an issue on GitHub.


Metadata

Release files for autoemx 1.8.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 autoemx 1.8.0
File Size Uploaded Provenance Actions
autoemx-1.8.0.tar.gz 8.6 MB Without provenance Details for autoemx-1.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 17.4 MB

Release files / autoemx-1.8.0.tar.gz

Download URL autoemx-1.8.0.tar.gz
Size 8.6 MB
Tags Source
SHA-256 checksum
How to use checksums
655aed77adacc8dff821f43b1a7698df6ca7c7c26ca0951166432dc86acf0687
BLAKE2b-256 checksum
How to use checksums
c41fc5571df13503db912dbb709669d382d98f6c526842fbe40a6552ebf2c1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / autoemx-1.8.0-py3-none-any.whl

Download URL autoemx-1.8.0-py3-none-any.whl
Size 8.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c37275999d5d79b2880cd0171462336f240562ab0c64cd0aeac4741615f81485
BLAKE2b-256 checksum
How to use checksums
3e3d3ef91700103cf283bb70c30526e297ff42c73ad52773ba17317a33882f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for autoemx 1.8.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.

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