Repository navigation
rietx 1.4.0
rietx 1.4.0
The free-standing-peaks milestone. Peaks without a structure: fitted
standalone at positions you name, and declared as components of the instrument
when something in the pattern is not a phase you are refining. Around that
milestone sits two weeks of work that landed after 1.3.0 shipped — model files
from other programs, two more vendor pattern readers, a joint fit that shares
the crystallite size rather than the coefficient, and named variables.
The forward model moved in one place. A multi-wavelength joint fit now
shares a specimen's size across histograms in physical units rather than
sharing the angular coefficient, so such a fit gives different numbers from
1.3.0 — better ones, measured. Everything else in the forward model is
untouched: a single-histogram fit that declares no extra component gives what
1.3.0 gave.
Install
pip install --upgrade rietxFit exactly the peaks you name
rx.fit_peaks(data, instrument, positions) fits peaks at the positions you
give it, with no structure, no phase and no plan:
peaks = rx.fit_peaks(data, ins, [28.094, 34.087, 39.985, 48.226])It returns the same PeakList that pick_peaks returns, so everything that
reads a peak list reads this one. The components in each window are your
positions and no others.
Two answers it gives rather than withholding. A position where there is no
peak comes back flagged rather than silently dropped, so a typo in your list
is visible instead of being a shorter list than you passed. And a position
sitting beside a real peak you did not name is flagged too: fitting your
model alone where the data shows more biases the position you asked about, and
the only numeric trace would otherwise be χ²_red. The manual's
Fitting peaks you name
chapter runs a Williamson-Hall analysis over the result.
Declare a peak your phases cannot account for
A sample holder at its own specimen distance, a mount, an unidentified impurity
line: declare it as a component of the instrument and the channels stay in the
fit, instead of being excluded along with the sample peaks underneath them.
from rietx.schemas.common import Parameter
from rietx.schemas.instrument import PeakComponent
instrument.extra_components.append(PeakComponent(
label="steel holder 110",
center=Parameter(value=44.6, min=44.3, max=44.9, unit="deg"),
area=Parameter(value=800.0, min=0.0, unit="counts*deg",
transform="softplus"),
))A declared peak joins result.ticks under the reserved key "(extra)", which
is what stops Layer 0 of the report calling it an unindexed impurity. Under Le
Bail and Pawley its curve is subtracted before the intensities are partitioned,
so a holder's counts are never handed to a phase. Two diagnostics come with it,
both advice rather than gates: EXTRA_PEAK_ON_REFLECTION (the component sits
on a line your model already predicts, which is a degeneracy and is legitimate
when the overlap is real) and EXTRA_PEAK_NO_INTENSITY (the area refined to
zero, so the centre is not a measurement).
What it is measured to do, and what it is not. On the SRM 660c protocol
with two holder lines injected onto reflections, declaring them recovers the
clean-pattern cell to −1.0 ppm where ignoring them costs +7.6 ppm and inflates
the cell esd 7.5×. Excluding the regions instead also recovers it, to
+0.6 ppm, for 4.8 % of the channels. So on a pattern as reflection-rich as LaB6
what you gain is the retained channels and a measured intruder, not cell
accuracy. The gain grows as the reflection count falls, which is the operando
case this was built for.
A refinement another program wrote, opened by content
model = rx.read_project_model("refined.inp") # or .pcrread_project_model works out which program wrote a file and returns its
phases, sites, refine flags and the data files it points at.
identify_project_format answers the question without reading the model, and
read_topas_inp, read_fullprof_pcr and read_gsas_prm are the individual
readers. Dispatch is by content, never by suffix: several unrelated
programs write .inp.
What a reader could not carry it says so about, in the same diagnostics channel
the pattern readers use — TOPAS_FEATURE_REFUSED, TOPAS_BLOCK_SKIPPED,
TOPAS_CELL_COUPLING_DROPPED, TOPAS_ORIGIN_TRANSLATED,
FULLPROF_TIE_DROPPED, FULLPROF_ORIGIN_CHOICE,
FULLPROF_OCCUPANCY_UNCHECKED, GSAS_PRM_FIELD_DROPPED,
GSAS_PRM_GEOMETRY_ASSUMED, and the two species normalisations. This surface
is provisional: it is new, and the compatibility chapter says plainly that
it may change.
Two more vendor pattern formats
PANalytical .udf and Philips .rd/.sd (V3 and V5), plus three things
declined by name rather than by traceback: a binary .raw that matched no
reader, and the peak-list formats .pks and .udi, which are tables of
reflections rather than measured profiles.
The .rd intensities are √-compressed. Read the obvious way — the way the
only permissively-licensed description of the format reads them — every peak
lands in the right place and every intensity is wrong, with no symptom: the
profile looks like a diffraction pattern and the fit converges. This reader is
checked channel for channel against the IUCr CPD kit's own ASCII conversions of
the same scans, 15 of 16 bit for bit and the sixteenth off by one count on 2108
channels from a different rounding rule in the kit.
A joint fit shares the size, not the coefficient
This changes numbers. A specimen has one crystallite size, and a size
coefficient is (180/π)·K·λ/L — so in a joint fit over histograms at different
wavelengths, sharing the coefficient shares the wrong thing. A joint fit now
shares the size itself, scaling each histogram's coefficient by λ_h/λ_0, and
says so with SIZE_NORMALISED_ACROSS_WAVELENGTHS. Both strains and Stephens'
Λ(hkl) are λ-free and stay shared as they were.
Left unfixed, one specimen came back at 363.3 Å against 623.9 Å for the same
material, converged, with Rwp 1.8× worse on the long-wavelength histogram and
4.7× worse for the Gaussian size term. A single-histogram fit is unaffected.
Beside it, RefinementResult.microstructure reports each phase's size and
strain readings with exact single-parameter esds, the Gaussian and Lorentzian
readings compared rather than combined (size_agreement), and a verdict on
whether size and strain are separable in this fit at all.
Named variables
A parameter of your own, outside the model tree, that other parameters follow:
ref.add_variable("B_metal", 0.7, min=0.0, max=25.0)
ref.tie_equal(["phases.0.atoms.0.biso", "phases.0.atoms.1.biso"],
source="vars.B_metal")
ref.tie("phases.0.atoms.3.biso", "vars.B_metal", scale=2.0)
ref.set_vary("vars.*", True)The path is "vars." + name and behaves like any other dot-path: parameters()
lists it, set_vary globs it, a fit refines it and gives it an esd. This is
TOPAS's prm, and it exists so a constraint can be written in terms of a
quantity rather than in terms of whichever model parameter happened to be
nominated as the master.
Smaller changes worth knowing
- A neutron fit names a resonant absorber (
NEUTRON_RESONANT_ABSORBER):
the tabulated b is the real part of the thermal value and is incomplete near
the resonance, which the fit now says rather than using it silently. - A missing species falls back to the neutral atom and says so
(SPECIES_FALLBACK_NEUTRAL), where it used to swallow the substitution. - The region below the first reflection is diagnosed
(LOW_ANGLE_UNMODELLED) when it carries misfit nothing in the model can
reach. - Two symmetry silences are reported: a site sitting within tolerance of a
special position and expanded at it, so the multiplicity is the special one
(SITE_SNAPPED_TO_SPECIAL_POSITION), and a symbol the tables hold in more
than one setting, resolved to one of them (SPACE_GROUP_SETTING_ASSUMED). - Path dependence is judged per pattern, and only where both chains measured
an esd. Adirection="both"series compares the same pattern in each
chain, so a path can be reported on for part of a series and stay silent for
the rest rather than being judged on a chain that never refined it. Refinement.summary()accepts a report you already built
(summary(report=...)), so a caller that has one does not pay for a second.- A compile fault names the atom it came from, with a spelling hint that
resolves before it is offered. - Magnetic symmetry groundwork:
crystallography.magneticconverts
magnetic space-group identifiers into operator lists and back, and gives a
site's allowed moment basis. No magnetic refinement ships in this release;
this is the layer the magnetic WPs stand on.
The manual
Both parts were rewritten out of the compressed register the repository's own
rulebooks are written in, and twelve defects reported against the theory part
are fixed.
Every Source: line is a link into the code. All 105 of them resolve their
dotted name through inspect at build time, so an equation reaches the function
that computes it in one click. A renamed symbol now fails the build naming the
symbol and the chapter line, rather than leaving a dead link on a published
page.
Two equations printed their own substitution names. A MyST substitution is
not substituted inside a {math} directive, so (3.3) and (3.4) in
Peak profiles typeset
STRAINCAPRANGEFRACTION as a product of italic letters. Four further equations
ran under their own number, the worst 179 px into it in a 736 px column.
The Thompson-Cox-Hastings attribution is corrected from the paper. TCH
(1987) credit the pseudo-Voigt to Wertheim, Butler, West & Buchanan (1974) and
the mixing expansion to Hastings, Thomlinson & Cox (1984), whose coefficients
they renormalised for the unit-area form. The chapter had them fitting both
polynomials. Citations across Part 2 now read by author and year.
Six rx.help() entries follow three renamed headings. The GUI's help
popover builds live manual links out of those anchors, so they would otherwise
point at sections the published manual no longer has.
Two diagnostic rows moved. EXTRA_PEAK_ON_REFLECTION and
EXTRA_PEAK_NO_INTENSITY sat under the recipe codes in the agent skill's
diagnostics reference, away from the rest of the fit diagnostics.
Contract versions
Six versioned contracts, and capabilities() is where a program reads them
rather than this table. Two moved since 1.3.0:
| Contract | 1.3.0 | 1.4.0 |
|---|---|---|
schema_version |
0.14 | 0.19 |
report_thresholds_version |
1.4 | 1.5 |
project_format_version |
1.3 | 1.3 |
indexing_thresholds_version |
1.3 | 1.3 |
event_schema_version |
2 | 2 |
textdoc_format_version |
1 | 1 |
report_thresholds_version moved once, for FitReport.microstructure — a new
field on the report, no gate or threshold touched. schema_version moved five
times, and the comments beside the constant in rietx.schemas.common are the
authority on each: 0.15 the microstructure
field, 0.16 named variables in the history document, 0.17 Atom inheriting its
field's declared bounds, 0.18 the extra_components rename, 0.19 the
PeakComponent member. Two of the five can refuse something that worked in
1.3.0, and both are in Upgrading below.
Upgrading
Who has to do something, and what.
-
You assign
instrument.background_peaks. The field is
instrument.extra_components, a list of a discriminated union whose members
areHumpComponent(v1.2'sBackgroundPeak, plus akindfield) and
PeakComponent.RefinementResult.n_background_peaksis
n_extra_components, and theBACKGROUND_PEAK_*constants and the
BACKGROUND_PEAK_TOO_NARROWdiagnostic areHUMP_*/HUMP_TOO_NARROW.Saved documents are unaffected. A 1.2 or 1.3 project, history tree or
.rxtopens unchanged, and its saved plan still frees the hump it froze —
the migration repairs the stored dot-paths as well as the field, because a
stored glob under the old spelling would otherwise load clean and match
nothing, which stops refining a declared hump in silence. -
You construct an
Atomwith a bareParameterforoccorbiso.
Such a parameter now inherits the field's declared bounds and unit instead of
falling back toParameter's own(-inf, inf). A construction that used to
succeed can now raise:Parameter(value=-165.0)forbisois outside the
declared range. Give the parameter the bounds you mean, or pass the plain
number. Already-written documents are unaffected — a persistedAtom
always serialises its bounds, so nothing is inherited on load and every
stored value deserialises exactly as before. -
You read the refinement protocol from
rietx/data/AGENT_PROTOCOL.mdor
https://rietx.org/AGENT_PROTOCOL.md. Both are gone. The protocol is the
agent skill:rietx skill --path,capabilities().skill_path, or
https://rietx.org/skill/rietx/SKILL.md. Section numbers are unchanged, so a
citation of §7d still resolves. The pointer that forwarded these paths was
kept for one release, which was 1.3. -
You run a multi-wavelength joint fit. Your numbers will move; see
A joint fit shares the size
above. Nothing is required of you.
The measured record
docs/milestones/v1.4.md
carries this milestone's acceptance rows, written at the open rather than at
the ship, with the measurement behind each and the ship appendix at the end.