Skip to main content

A powder X-ray diffraction analysis and materials-characterization toolkit

Project description

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)
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.

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.

Project details


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.5.tar.gz (342.9 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.5-py3-none-any.whl (372.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxplore-2026.7.5.tar.gz
  • Upload date:
  • Size: 342.9 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.5.tar.gz
Algorithm Hash digest
SHA256 103d9dd59f3da3c4e0f7011834ef074bcaab86a7ccdcac5daf45cde79a44053e
MD5 dd58e30837cfcd400774618749b811e7
BLAKE2b-256 41bbc3573d2e2c50deafbf3a94f5221b46e1e65fb84138031e9f56d675eda765

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxplore-2026.7.5-py3-none-any.whl
  • Upload date:
  • Size: 372.0 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 17289ceb8058a72e9a9a4c7da580d8b8257b87d705acb8a4f4c8160ccc49bcfc
MD5 b92d7573e7e4a578886757328a6887cc
BLAKE2b-256 e5cb709f58fcedb90a065e9e9b516ef8faee0d51c1aa3b0d3c72a29b047842cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page