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.6.17.tar.gz (342.6 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.6.17-py3-none-any.whl (371.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyxplore-2026.6.17.tar.gz
Algorithm Hash digest
SHA256 5e6161f4e4063088ca82d7e4e4dffa1edb6ee166f2dc8579129626ec50d14061
MD5 c3fbd23e75f8ede3bfe7025062c90f10
BLAKE2b-256 a1bed03591f6bf0fdb8091defae168b00c94340f456be1181e5c101148f5f1cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxplore-2026.6.17-py3-none-any.whl
  • Upload date:
  • Size: 371.6 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.6.17-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d15c2dae111d12cccd85a53a6dbde6fb1aa356a8ea6a85d5b65a13c5e236a8
MD5 b49b3b3d08df58cd9a87989e916ba806
BLAKE2b-256 48d9feac527f7f53f6ca1daa528c70c3cadf2309e7586d409208e3a6d19bec1b

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