Skip to main content

A Python package for visualizing and analyzing X-ray Diffraction (XRD) experimental data, providing tools to process, visualize, and extract meaningful insights from XRD patterns and measurements.

Project description

XRD-utils is a Python package for loading, aligning, analyzing, and visualizing X-ray diffraction (XRD) data, including line scans and reciprocal space maps.

Installation

Install from PyPI:

pip install XRD-utils

Install from source:

git clone https://github.com/yig319/XRD-utils.git
cd XRD-utils
pip install -e .

Clone On A New Desktop

From a fresh machine, use:

git clone https://github.com/yig319/XRD-utils.git
cd XRD-utils
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements-dev.txt
pip install -e .

Notes:

  • requirements.txt contains runtime dependencies.

  • requirements-dev.txt includes runtime + test/build/docs tooling.

Quick Start

import numpy as np
from xrd_utils.xrd_utils import detect_peaks, calculate_fwhm

# Example synthetic profile
x = np.linspace(40, 50, 500)
y = np.exp(-((x - 45.0) ** 2) / 0.02) + 0.05

peak_x, peak_y = detect_peaks(x, y, num_peaks=1, prominence=0.1)
fwhm, amp, left, right = calculate_fwhm(x, y, peak_x[0])

Usage Guide

See USAGE.md for a practical guide to scan loading, stacked plotting, peak tables, reciprocal-space maps, and the boundary between XRD-utils and sci-viz-utils.

Runnable Demo

Try a full synthetic workflow (peak detection, FWHM, alignment, and plotting):

# from repo root
PYTHONPATH=src python examples/demo_xrd_scan.py

This writes a demo figure to examples/output/demo_xrd_scan.png.

Features

  • Peak detection and alignment utilities for XRD scans.

  • FWHM estimation and fringe-based thickness estimation helpers.

  • Visualization for stacked 1D XRD scans.

  • Reciprocal space mapping (RSM) plotting tools.

Documentation

Sphinx documentation is provided in the docs directory.

Build docs locally:

pip install -r docs/requirements.txt
pip install -e .
sphinx-build -b html docs docs/_build/html

License

This project is licensed under the MIT License. See LICENSE.txt.

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

xrd_utils-5.0.2.tar.gz (570.1 kB view details)

Uploaded Source

Built Distribution

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

xrd_utils-5.0.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file xrd_utils-5.0.2.tar.gz.

File metadata

  • Download URL: xrd_utils-5.0.2.tar.gz
  • Upload date:
  • Size: 570.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xrd_utils-5.0.2.tar.gz
Algorithm Hash digest
SHA256 a0572236739a8bb6c681034503d08874c8ef6be89b82c2b3c82e0a7700acf92d
MD5 1e98f71e74432a508d7331990fd7ec53
BLAKE2b-256 332c8f6379f281158fc823855620cebf2c37197f9378897df3ce7baa07ddf753

See more details on using hashes here.

Provenance

The following attestation bundles were made for xrd_utils-5.0.2.tar.gz:

Publisher: main.yml on yig319/XRD-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xrd_utils-5.0.2-py3-none-any.whl.

File metadata

  • Download URL: xrd_utils-5.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xrd_utils-5.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54fe44dfc20b8000ab34a161afdf874175930c041c0820d4bf9c417023e88cce
MD5 a883b67445b8ad3b8e339cfe08449d50
BLAKE2b-256 27185a8839cde64836c26a8bf9492ddbc286bb53e7728a920fc28df2e9ede9c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for xrd_utils-5.0.2-py3-none-any.whl:

Publisher: main.yml on yig319/XRD-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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