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.1457  GoF=5.52  a=10.251214 A
Rietveld: status=converged  Rwp=0.0932  GoF=3.53
          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

FitReport: Rwp=0.0932 GoF=3.53; 52 regions, top 15 shown (74% of χ²); 54 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.1725
   …
                                 └─ *n0012  stage:biso             Rwp 0.0932

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rietx-1.1.0.tar.gz
Algorithm Hash digest
SHA256 df32d118ea9bb38c3618854409ee0ea0b9dfe07a5672385549cf1b8978bd75f6
MD5 cdfc20836e2da35ef9619ab836ea567d
BLAKE2b-256 a208dc9564901ab9ef6a601d3c67349a1fcb5374371b4114e37cbf245812a42c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rietx-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e1f4b0070c1a2e4362314c82a049b458ba7124f832dcba339b5c052ef608738
MD5 7d0fb73b225f67bf62f02c7ca47a59b5
BLAKE2b-256 75ab8439b51081ac0eafc9387e8d57afd929454f9ef710ae70990ca5091d22bb

See more details on using hashes here.

Provenance

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

1.3.0

2 files

1.2.0

2 files

This release

1.1.0 This release

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