Skip to main content

SeriesXRD

PyPI Python versions CI DOI License: MIT

GUI-driven workflow for powder X-ray diffraction: detector calibration review, dataset reduction, and pattern analysis. Facility-neutral by design — it works the same way for a synchrotron beamline or a lab (in-house) diffractometer, any calibrant, any detector pyFAI supports, and any beamline-specific frame naming or metadata convention (see "Site adoption" in docs/roadmap.md for exactly what a new site needs to supply). A single unified desktop application (seriesxrd) hosts all pipeline stages in one window. Heavy pyFAI work runs in separate worker.py subprocesses, so a crash in pyFAI or matplotlib is contained in the worker process rather than in the GUI.

SeriesXRD Analysis pattern review showing an integrated diffraction pattern, a two-dimensional cake, and the frame-series contamination trend

Pattern review in the unified SeriesXRD application, using the included Ti-6Al-4V demonstration workflow.

Pipeline

The workflow is one subpackage per stage, communicating only through artifacts on disk plus a shared workspace folder:

  1. seriesxrd.calib — calibration review: standard image → accepted .poni + mask + QA record, ending in a calibration_handoff.json (internal artifact passed automatically to the Reduction tab — not a user-facing step).
  2. seriesxrd.reduce — dataset reduction: apply the accepted geometry/mask to a sample dataset, parallel batch azimuthal integration → 1D patterns (mean, azimuthal-quantile-band "robust", and optional sigma-clipped trimmed mean) and optional 2D cakes in one HDF5 file + JSON manifest. Frame sources include plain images and HDF5/NeXus stack containers (Eiger-style master files), with per-frame metadata (timestamp, stage position, temperature) harvested automatically. seriesxrd-watch adds a live mode that reduces and periodically re-analyzes a dataset folder while frames are still being collected.
  3. seriesxrd.analysis — pattern analysis: SNIP background + diamond-spot separation (Step 1), pseudo-Voigt peak fitting (Step 2), pressure-aware EOS phase identification + residual removal (Step 3a), the ML candidate-ranking seam (Step 3b: deterministic cosine ranker by default, optional learned scorer — see docs/ml-training.md), and unknown-phase clustering of the leftover residual (Step 3c). Semi-quantitative phase fractions, azimuthal texture metrics, and a Rietveld hand-off export round out the tooling.

The calib→reduce handoff JSON is an internal artifact written to the workspace and automatically loaded by the Reduction tab — users do not need to manage it manually.

Repository layout

├── seriesxrd/             The installable package
│   ├── core/            Shared by all stages (stdlib/numpy only)
│   │   ├── config.py        SessionConfig, JSON/hash/file helpers
│   │   ├── env.py           dependency / conda environment checks
│   │   ├── naming.py        output folder/file naming conventions
│   │   ├── io.py            detector image readers (fabio/tifffile/PIL) and
│   │   │                    HDF5/NeXus frame-stack ingestion (Eiger master files)
│   │   ├── masks.py         automatic + polygon detector masks
│   │   ├── handoff.py       the calib→reduce handoff contract (load/validate)
│   │   └── inspect.py       detector-image diagnostic CLI (seriesxrd-inspect)
│   ├── guikit/          Shared GUI/plot theming
│   │   ├── theme.py         dark Catppuccin palette (Tk + matplotlib)
│   │   ├── tkstyle.py       shared ttk style (apply_dark_theme)
│   │   └── dpi.py           HiDPI / Windows DPI-awareness helpers
│   ├── calib/           Calibration review stage
│   │   ├── processing.py    pyFAI integration + QA figure generation
│   │   ├── worker.py        crash-isolated worker subprocess
│   │   ├── gui.py           tabbed Tkinter GUI (embeddable pane)
│   │   ├── dioptas.py       optional Dioptas hand-off
│   │   └── run_gui.py       CLI entry point (seriesxrd-calib-gui)
│   ├── reduce/          Batch reduction stage
│   │   ├── processing.py    batch azimuthal integration logic
│   │   ├── worker.py        crash-isolated worker subprocess
│   │   ├── session.py       workspace config seeding (seed_reduction_config)
│   │   ├── review.py        read-only HDF5 checkpoint review
│   │   ├── straighten.py    cake-waviness diagnosis + straightened-1D rescue channel
│   │   ├── texture.py       azimuthal texture metrics per saved cake (seriesxrd-texture)
│   │   ├── watch.py         live (during-beamtime) reduction + rolling analysis (seriesxrd-watch)
│   │   ├── gui.py           tabbed Tkinter GUI (embeddable pane)
│   │   └── run_gui.py       CLI entry point (seriesxrd-reduce-gui)
│   ├── app.py           unified application (seriesxrd entry point)
│   └── analysis/        analysis stage (background, peaks, identification,
│                        maps, ML ranking/training, and exports)
├── tests/               automated pytest suite
├── examples/            calibration_session_config.example.json (schema reference),
│                        fetch_benchmark_example.sh (downloads a real-data
│                        seriesxrd-benchmark example set — see docs/ml-training.md)
├── environment.yml      conda environment (recommended install route)
└── pyproject.toml       package metadata + pip dependencies

Stage convention: pure logic modules + a crash-isolated worker.py + an embeddable gui.py pane. Logic stays importable and headless so stages can also run as batch jobs without any GUI.

Installation

Recommended for a source checkout (pyFAI installs most reliably from conda-forge):

conda env create -f environment.yml
conda activate seriesxrd

Install SeriesXRD from PyPI:

python -m pip install seriesxrd
python -m pip install "seriesxrd[io,stacks,phases]"  # optional readers and crystallography

For development from a source checkout:

python -m pip install -e ".[dev]"

tkinter must be available in your Python (it ships with python.org and conda-forge Python; some Linux distros need python3-tk).

Usage

Unified application (primary)

seriesxrd --workspace <dir>
# Windows/macOS GUI entry point (no console window):
seriesxrd-gui --workspace <dir>
# or without installing:
python -m seriesxrd.app --workspace <dir>

Opens one window with 1 Calibration, 2 Reduction, and 3 Analysis tabs. Accepting a calibration hands its PONI + mask to the Reduction tab automatically; a finished reduction hands its output HDF5 to the Analysis tab automatically — the handoffs are automatic in both directions, not a manual file-picking step. The workspace folder holds the stage configs and all outputs. On first launch the configs are auto-created with sensible defaults.

The GUI embeds all three stage panes in one process; heavy pyFAI work runs in worker.py subprocesses (one per stage), so a worker crash is isolated from the host window and from the other stages.

End-to-end demonstration data

The Ti-6Al-4V demo downloads a compact, checksum-pinned set of real synchrotron detector frames and guides it through the unified GUI. The third-party CBF data remain in a gitignored local workspace and are not bundled with SeriesXRD.

Per-stage standalone GUIs

Each stage also has a standalone entry point for advanced use:

seriesxrd-calib-gui    --config <path/to/calibration_session_config.json>
seriesxrd-reduce-gui   --config <path/to/reduction_session_config.json>
seriesxrd-analysis-gui --config <path/to/analysis_session_config.json>   # optional; auto-found if omitted

Detector-image diagnostic

seriesxrd-inspect <image_file>
# or:
python -m seriesxrd.core.inspect <image_file>

Headless analysis + ML training

seriesxrd-analyze reduced.h5 --phases Au,Re          # Steps 1-3a, no GUI
seriesxrd-analyze reduced.h5 --ml-rank               # candidate-free: rank whole library
seriesxrd-ml-train --workspace <dir> --out scorer.pt # train the learned scorer

Training the Step-3b learned scorer (data collection, environment setup, corpus building, validation gates, deployment) is documented in docs/ml-training.md.

All console scripts

Command Purpose
seriesxrd Unified GUI: Calibration + Reduction + Analysis tabs in one window.
seriesxrd-gui Unified GUI without a console window on supported desktop platforms.
seriesxrd-calib-gui Calibration stage standalone GUI.
seriesxrd-reduce-gui Reduction stage standalone GUI (includes live watch-mode controls).
seriesxrd-analysis-gui Analysis stage standalone GUI.
seriesxrd-analyze Headless analysis CLI (Steps 1-3, ML ranking, exports).
seriesxrd-watch Live reduction + rolling analysis while frames are still being collected.
seriesxrd-ml-train Train the Step-3b learned candidate scorer.
seriesxrd-benchmark Score a scorer against labelled XY patterns (RRUFF/opXRD-style known-truth harness).
seriesxrd-corpus Fetch/screen a training-only CIF corpus for seriesxrd-ml-train --cif-dir.
seriesxrd-texture Azimuthal texture metrics (/texture) from a cakes-enabled reduction.
seriesxrd-export-refinement Rietveld hand-off bundle (.xy patterns + phase CIFs + GSAS-II instprm) from an analysis HDF5.
seriesxrd-export-gsas GSAS-ready raw patterns grouped by pressure.
seriesxrd-import-gsas Map GSAS-II sequential weight fractions, uncertainties, cells, and fit quality back to SeriesXRD frames under /refinement.
seriesxrd-stack Publication-style stacked or waterfall pattern plots.
seriesxrd-inspect Detector-image diagnostic: true format from magic bytes, per-reader interpretation, intensity statistics, and a verdict.

See docs/workflow.md for how each of these fits into the end-to-end pipeline and docs/ml-training.md for the ML-specific ones.

Tests

Install the development dependencies and run the test suite with pytest:

python -m pip install -e .[dev]
python -m pytest

Documentation

  • docs/workflow.md — end-to-end analysis workflow.
  • docs/architecture.md — how the stages fit together and the design decisions behind the pipeline.
  • docs/file-format.md — the HDF5 layouts and JSON manifests each stage reads and writes.
  • docs/validation.md — what is validated against what, expected tolerances, and the limits of each output.
  • docs/phase-sources.md — bibliography and provenance for every value in the bundled phase library.
  • docs/ml-training.md — training, validating, and deploying the Step-3b learned scorer (cluster-agnostic — works on any cluster or workstation).
  • docs/roadmap.md — implemented vs. planned features, and what a new facility needs to provide to adopt SeriesXRD.
  • docs/test-data.md — open datasets you can download to exercise each stage (calibration frames, measured patterns, CIFs, simulated patterns) and which command each one feeds.
  • examples/ti64_demo/README.md — prepared, end-to-end Ti-6Al-4V calibration and exposure-series demonstration.
  • docs/releasing.md — build, TestPyPI, and release verification checklist.

Citation

If SeriesXRD contributes to published research, please cite the exact version used:

Maples, R. (2026). SeriesXRD (Version 0.2.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.21479737

Machine-readable citation metadata is provided in CITATION.cff. GitHub can use this file to generate a formatted software citation. The DOI badge at the top of this page links to the permanent record for all SeriesXRD versions.

Project roles and acknowledgments are listed in CREDITS.md.

Feature status and planned work are maintained in docs/roadmap.md.

Contributing and support

See CONTRIBUTING.md to set up a development environment and submit changes, and GOVERNANCE.md for how decisions and releases are made. Report defects through the GitHub issue tracker; report security concerns according to SECURITY.md. Community participation is governed by CODE_OF_CONDUCT.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seriesxrd-0.3.0.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

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

seriesxrd-0.3.0-py3-none-any.whl (459.0 kB view details)

Uploaded Python 3

File details

Details for the file seriesxrd-0.3.0.tar.gz.

File metadata

  • Download URL: seriesxrd-0.3.0.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for seriesxrd-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f03cc228f1791908d47f5ec9f2d022ec6c1ed867e29fb156d13a1bdf4a566bef
MD5 3a7528036f148f975c2d6a8680d30ae1
BLAKE2b-256 361fe671bb24eecf5748351074c82b54142e346a42601259a573adc9e092bb0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for seriesxrd-0.3.0.tar.gz:

Publisher: release.yml on RushMaples/SeriesXRD

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

File details

Details for the file seriesxrd-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: seriesxrd-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 459.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for seriesxrd-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf8188ec37ccb307bb83e056ec163dcaffef1d5144c190ea2688c2cf4b57e1e5
MD5 cd0acd2917287b1cc24893de4d9de978
BLAKE2b-256 90b2f7a2982e23f5fb9b47002c7655defd02dba0a7a262bba528fdd4217c172c

See more details on using hashes here.

Provenance

The following attestation bundles were made for seriesxrd-0.3.0-py3-none-any.whl:

Publisher: release.yml on RushMaples/SeriesXRD

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