rietx
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
- Multi-phase Rietveld, Le Bail and Pawley
- Preset staged plans
- Extensively documented forward model
- Multiple solvers
- Optional JAX & torch differentiable backends
- Readers for many standard formats including
.xy/.xye, GSAS raw, pdCIF,.chi, Rigaku.ras/.rasx, Bruker.uxd/.brml/.rawand PANalytical.xrdml - The
FitReport, an output bundle designed for agentic consumption. - A git-style branchable refinement history
- Sequential refinements
- Indexing
- Extensive agentic surface
- GUI mode
rietx gui(currently in beta)
Validation
Validation suites are run in CI against real data. Details here: docs/VALIDATION.md
Documentation
- HTML manual: https://rietx.org/
- Driving instructions for agents: AGENT_PROTOCOL.md
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df32d118ea9bb38c3618854409ee0ea0b9dfe07a5672385549cf1b8978bd75f6
|
|
| MD5 |
cdfc20836e2da35ef9619ab836ea567d
|
|
| BLAKE2b-256 |
a208dc9564901ab9ef6a601d3c67349a1fcb5374371b4114e37cbf245812a42c
|
Provenance
The following attestation bundles were made for rietx-1.1.0.tar.gz:
Publisher:
release.yml on yue-here/rietx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rietx-1.1.0.tar.gz -
Subject digest:
df32d118ea9bb38c3618854409ee0ea0b9dfe07a5672385549cf1b8978bd75f6 - Sigstore transparency entry: 2569919528
- Sigstore integration time:
-
Permalink:
yue-here/rietx@f2880dba3e2e87a2a8425d6d910f83c6a1b94cd5 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/yue-here
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f2880dba3e2e87a2a8425d6d910f83c6a1b94cd5 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e1f4b0070c1a2e4362314c82a049b458ba7124f832dcba339b5c052ef608738
|
|
| MD5 |
7d0fb73b225f67bf62f02c7ca47a59b5
|
|
| BLAKE2b-256 |
75ab8439b51081ac0eafc9387e8d57afd929454f9ef710ae70990ca5091d22bb
|
Provenance
The following attestation bundles were made for rietx-1.1.0-py3-none-any.whl:
Publisher:
release.yml on yue-here/rietx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rietx-1.1.0-py3-none-any.whl -
Subject digest:
9e1f4b0070c1a2e4362314c82a049b458ba7124f832dcba339b5c052ef608738 - Sigstore transparency entry: 2569919610
- Sigstore integration time:
-
Permalink:
yue-here/rietx@f2880dba3e2e87a2a8425d6d910f83c6a1b94cd5 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/yue-here
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f2880dba3e2e87a2a8425d6d910f83c6a1b94cd5 -
Trigger Event:
release
-
Statement type: