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.3.0.tar.gz (8.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.3.0-py3-none-any.whl (3.0 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rietx-1.3.0.tar.gz
  • Upload date:
  • Size: 8.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.3.0.tar.gz
Algorithm Hash digest
SHA256 aad406d68e8c3a21e95bf91035b8e700024a0844575dd96b9116deb211294ee0
MD5 2428b790a69d27c10646ae50f5a9d7de
BLAKE2b-256 10f9d10fd44043365fb18c702634ef990848164886140d4e23cd822dea367902

See more details on using hashes here.

Provenance

The following attestation bundles were made for rietx-1.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: rietx-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03c48720fb7269738532f58d08596485aa734510f4f40827b1772fcd3ad28fec
MD5 c9097f20bc5c027df20f7b813b27dc5e
BLAKE2b-256 86a832b91f64a09ad659945f02a91b88d680e013edd3410b295cb8a1b996af5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rietx-1.3.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

1.4.0

2 files

This release

1.3.0 This release

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