Skip to main content

PyXplore

PyXplore is a Python toolkit for powder X-ray diffraction (XRD) analysis and broader materials characterization.

It bundles the WPEM (Whole-Pattern Expectation-Maximization) refinement engine together with utilities for XRD simulation, background fitting, peak decomposition, XPS / EXAFS spectrum analysis, amorphous-material RDF calculation, and crystal-graph generation for machine-learning workflows.

Paper: https://arxiv.org/abs/2602.16372


Features

  • WPEM XRD refinement — Whole-pattern EM solver for crystallographic refinement, lattice-constant optimization, and quantitative phase analysis.
  • XRD simulation — Simulate diffraction patterns from CIF files; supports supercells, solid solutions, vacancies, grain-size broadening, preferred orientation, thermal vibration, and zero-shift.
  • Background fitting — FFT + Savitzky-Golay two-stage filter for XRD / XPS / Raman background removal.
  • Extinction analysis — Compute systematic extinctions and multiplicity factors for all seven crystal systems.
  • Amorphous materials — Multi-peak amorphous fitting and radial-distribution-function (RDF) calculation.
  • XPS decomposition — EM-based decomposition of X-ray photoelectron spectra with satellite-peak handling.
  • EXAFS analysis — k-space / R-space EXAFS data processing with wavelet & Fourier inverse transforms.
  • Crystal graphs — Convert CIF batches into node/edge graph representations for GNN training.
  • Structure relaxation — Optional M3GNet-based geometry relaxation.
  • Substitutional search — Bayesian-optimization-driven solid-solution composition search.

Installation

pip install PyXplore

Requirements

  • Python ≥ 3.8
  • numpy, scipy, pandas, matplotlib, sympy, scikit-learn, tqdm
  • pymatgen, monty
  • ipywidgets, ipython, plotly, PyWavelets
  • (Optional) tensorflow, ase — required only for the m3gnet extra

Public API

All high-level entry points are exposed under PyXplore.WPEM:

Function Purpose
XRDfit Whole-pattern XRD refinement (WPEM engine); can save refined CIFs from templates
BackgroundFit Two-stage FFT + Savitzky-Golay background fitting
FileTypeCovert Convert .dat / .xrdml files to standard format
Amorphous_fit Amorphous multi-peak fitting
AmorphousRDFun Radial distribution function calculation
Plot_Components Plot decomposed-peak components
XRDSimulation Single-crystal / supercell XRD simulation from CIF
CIFpreprocess CIF reading, unit-cell preview, extinction calculation
SubstitutionalSearch Bayesian-optimization-driven solid-solution search
XPSfit XPS spectrum EM decomposition
EXAFSfit EXAFS k-space / R-space processing
CryGraph Crystal-graph generation from a folder of CIFs

Utility helpers — ToMatrix, ToAdj, split_datasets, Laplacian — are also available under PyXplore.WPEM.

CIFpreprocess now saves a binary structure record alongside its generated HKL file, including the CIF space group and symmetry operations. After XRDfit, the corresponding CIF is found from the HKL set; initial lattice parameters are not compared because refinement can change them. The output is written to WPEMFittingResults by default (or cif_output_dir), retaining atom sites and symmetry while changing only the refined unit-cell parameters. If multiple candidates match, CIF export is stopped rather than risking a wrong phase assignment. cif_files can optionally restrict the candidate templates, but their order is not used.

Citation

If you use PyXplore in your research, please cite:

@article{cao2026wpem, title={AI-Driven Structure Refinement of X-ray Diffraction}, author={Bin Cao, Qian Zhang, Zhenjie Feng, Taolue Zhang, Jiaqiang Huang, Lu-Tao Weng, Tong-Yi Zhang}, journal={arXiv preprint}, year={2026}, url={https://arxiv.org/abs/2602.16372v1} }

About

Developed and maintained by Bin Cao, PhD of the Hong Kong University of Science and Technology (Guangzhou).

Please open an issue on GitHub for bug reports, feature requests, or general questions.

License

Released under the MIT License.

Download files

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

Source Distribution

pyxplore-2026.7.22.tar.gz (346.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyxplore-2026.7.22-py3-none-any.whl (375.3 kB view details)

Uploaded Python 3

File details

Details for the file pyxplore-2026.7.22.tar.gz.

File metadata

  • Download URL: pyxplore-2026.7.22.tar.gz
  • Upload date:
  • Size: 346.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for pyxplore-2026.7.22.tar.gz
Algorithm Hash digest
SHA256 ef0b8d5a0bbec495ac6d95217de06e724ea515ee87dca74368ba043bf5de3156
MD5 6f007f718b96672ddab4e6ce08e40a9d
BLAKE2b-256 0402762c5e72207c3b55a66c4ef1dbf3a31d259d7df7113bb602583c801c8e58

See more details on using hashes here.

File details

Details for the file pyxplore-2026.7.22-py3-none-any.whl.

File metadata

  • Download URL: pyxplore-2026.7.22-py3-none-any.whl
  • Upload date:
  • Size: 375.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for pyxplore-2026.7.22-py3-none-any.whl
Algorithm Hash digest
SHA256 ca3bb1a6e67ab359bd4739cfdf4cf3b0d298de39cda10b2b9285de71745323db
MD5 2e67730a75daef0a2fb0282b567834ee
BLAKE2b-256 a139fd7d3c7213d09f8f2e98e1e3145fb795359c5e412e2ebba8cb9ac2956e01

See more details on using hashes here.

Release history Release notifications | RSS feed

2026.8.17

2 files

This release

2026.7.22 This release

2 files

2026.7.5

2 files

2026.6.17

2 files

2026.6.9

2 files

2026.3.20

2 files

2025.7.21

2 files

2025.6.10

2 files

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