# PyXplore 

**PyXplore** is a modern, extensible toolkit designed for modeling of X-ray based data, including XRD (X-ray Diffraction), XPS (X-ray Photoelectron Spectroscopy), and EXAFS (Extended X-ray Absorption Fine Structure).

This project empowers researchers to extract structural information, fit spectral profiles, simulate atomic arrangements, and visualize results in a reproducible, notebook-driven environment.

## Author

**[Bin CAO](https://bin-cao.github.io/)**
Advanced Materials Thrust, Hong Kong University of Science and Technology (Guangzhou)

---

## Key Features

- **Peak Decomposition and Profile Fitting**: Based on EM-Bragg Process
- **X-ray Spectrum Support**: Integrated workflows for XRD, XPS, and EXAFS analysis
- **Amorphous and Crystalline Materials**: Suitable for mixed-phase materials and complex disordered states
- **Atomic Structure Simulation**: Support for solid solution models and local distortion analysis
- **Interactive Visualization**: Publication-quality plots, contour maps, and data exports
- **Notebook-Based Tutorials**: Comprehensive step-by-step guides for practical applications

---

## Theoretical Background

### WPEM Method

WPEM method is a statistical approach for analyzing powder X-ray diffraction patterns. The method treats diffraction pattern fitting as a probabilistic problem, where each observed intensity point is modeled as a mixture of contributions from different crystallographic phases.

The core algorithm employs the Expectation-Maximization (EM) framework to iteratively refine:
- Lattice parameters
- Peak shape parameters (Lorentzian and Gaussian components)
- Phase fractions
- Background contributions

The probability density function for each diffraction peak follows a pseudo-Voigt profile, combining Lorentzian and Gaussian components to accurately describe peak shapes arising from both size-strain broadening and instrumental effects.

### XRD Analysis

X-ray diffraction analysis in PyXplore supports:
- Multi-phase refinement with automatic phase identification
- Background subtraction using adaptive filtering
- Amorphous phase quantification
- Crystallite size and microstrain analysis

### XPS and EXAFS

The toolkit extends beyond XRD to include:
- **XPS**: Peak fitting for chemical state analysis and elemental quantification
- **EXAFS**: Local structure determination through radial distribution function analysis

---

## Overview

This documentation is organized with the following structure:

- **Parameters Documentation**: Configuration options and input parameters for all functions
- **Results Files**: Output file types and their interpretations
- **Tutorials**: Interactive notebooks demonstrating specific use cases
- **References**: Citation information for relevant academic work

---

## Getting Started

To begin using PyXplore, navigate to the [Tutorials](Tutorials/index.md) section for practical examples, or explore the [parameter configuration](parameter.md) documentation for detailed function references.

For issues, contributions, or questions, please visit the GitHub repository or contact the author.
