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.9.tar.gz (341.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.9-py3-none-any.whl (370.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxplore-2026.6.9.tar.gz
  • Upload date:
  • Size: 341.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.9.tar.gz
Algorithm Hash digest
SHA256 a3079d4ba0269455cad3c1bedc0258856d3784ae5bbba380bd87bd6a65417a15
MD5 80ce80609f090191660fd520253fed73
BLAKE2b-256 37943e4cffcf4c1fee9b603ed5abe5af9c7a21489d9c417c00dd10e6d50ad56a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxplore-2026.6.9-py3-none-any.whl
  • Upload date:
  • Size: 370.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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d5147ec3398772df194ecad78ed23d3721d9592b0cf5afa731256b0b6c0a786a
MD5 d15beea0cfabf6c5404bcd2b833fa14b
BLAKE2b-256 40d25292e35045969d816d7801a22103ef6011712e89e24deef1b63f90bacfc3

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