Skip to main content

rietx

CI PyPI

rietx is an open-source Rietveld refinement and pattern analysis Python module with a streamlined API designed for those who want to drive refinements from code.

Installation

pip install rietx            # Python >= 3.11; numpy/scipy core, compiled kernels on
pip install "rietx[viz]"     # + matplotlib and plotly rendering

Example refinement

Condensed from examples/nac_11bm.py, which fits APS 11-BM synchrotron data on Na₂Ca₃Al₂F₁₄ with a CaF₂ impurity.

import rietx as rx

data = rx.read_pattern("11BM_NAC.fxye")              # esd column read from file
structure = rx.Structure.from_cif("cod_1000236.cif")
instrument = rx.Instrument.debye_scherrer(wavelength=0.4139090)

ref = rx.Refinement(structure, instrument)

# structure-free Le Bail first: cell + profile + background
lebail = ref.fit(data, mode="lebail", two_theta_limits=(2, 24))

# then Rietveld under the staged turn-on order of McCusker et al. (1999)
result = ref.fit(data, plan="mccusker_default", two_theta_limits=(2, 24))

report = rx.build_report(result)                     # numbers, not pixels
result.plot(path="fit.png")                          # obs/calc/diff/ticks

Output of the full script (trimmed at the ):

Le Bail:  status=converged  Rwp=0.1435  GoF=5.44  a=10.251214 A
Rietveld: status=converged  Rwp=0.0933  GoF=3.54
          a = 10.251216 +/- 0.000046 A (COD reference 10.257(1); high-accuracy powder ~10.2497-10.2506)
          [warning] BOUND_HIT: phases.1.atoms.0.biso refined to its bound
          [info] CAPILLARY_OFFSET_UNAVAILABLE: this capillary geometry declares no goniometer radius, …

FitReport: Rwp=0.0933 GoF=3.54; 53 regions, top 15 shown (74% of χ²); 53 unmatched observed peak(s); …
  region  14.22- 14.54 deg  localRwp=0.154  chi2share=13.6%  max|d/sig|=49.5
  …

Refinement history (every stage is a restorable checkpoint):
t5544a638  13 nodes  data=11BM_NAC.fxye
 n0000  root                   —
└─  n0001  stage:bkg              Rwp 3.1772
   …
                                 └─ *n0012  stage:biso             Rwp 0.0933

Current features

Validation

Validation suites are run in CI against real data. Details here: docs/VALIDATION.md

Documentation

Development

git clone https://github.com/yue-here/rietx && cd rietx
uv venv --python 3.12 && uv pip install -e ".[dev]"
.venv/bin/python -m pytest -n auto --dist loadgroup -m "not slow"   # ~1-3 min
.venv/bin/python -m pytest -n auto --dist loadgroup                 # + real-data acceptance, ~15-30 min
.venv/bin/python -m ruff check src tests examples

--dist loadgroup is required to keep shared expensive fixtures on one worker. For the test ladder and style see CONTRIBUTING.md, and AGENTS.md if your contributor is an agent.

License and credits

MIT. Algorithms are independently implemented from the published literature, with sources cited in the manual. A full list of sources is also provided in ATTRIBUTION.md. and test-data provenance is listed in tests/data/README.md. CIF and symmetry handling uses gemmi. To cite the package, use CITATION.cff.

Download files

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

Source Distribution

rietx-1.4.0.tar.gz (10.8 MB view details)

Uploaded Source

Built Distribution

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

rietx-1.4.0-py3-none-any.whl (3.3 MB view details)

Uploaded Python 3

File details

Details for the file rietx-1.4.0.tar.gz.

File metadata

  • Download URL: rietx-1.4.0.tar.gz
  • Upload date:
  • Size: 10.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rietx-1.4.0.tar.gz
Algorithm Hash digest
SHA256 60db63e1e01316a6f2975f613ace6f405263812c1c6bdfc4499691e9b0caa67f
MD5 407a8ad89d042a1c28a9b8df82956486
BLAKE2b-256 cc08f48b22a2f55fe459bfa144315fdf40faeda2bb55f2274a2b4ee94c396ce6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rietx-1.4.0.tar.gz:

Publisher: release.yml on yue-here/rietx

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

File details

Details for the file rietx-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: rietx-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rietx-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3af7cea705a66ce605b7714011b8a067216da32e320436d9c2c1e317aece4167
MD5 1206c6ad314567c4b26657cd7899ddb2
BLAKE2b-256 2f6d57acddc6f0aa453f9e00869868a5cf665f45e7d92d47e92010e60a0cf143

See more details on using hashes here.

Provenance

The following attestation bundles were made for rietx-1.4.0-py3-none-any.whl:

Publisher: release.yml on yue-here/rietx

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

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page