Repository navigation
rietx 1.6.0
rietx 1.6.0
This release carries everything that reached main in the fifteen days after 1.5.0, 217 merged pull requests.
It is the first release numbered when it was cut rather than when a milestone closed.
The largest addition is the first half of magnetic structure refinement.
A moment can be stated on a site and refined against a constant-wavelength neutron pattern.
It can be read from and written to magCIF, TOPAS and FullProf files, followed through a series, and proposed from the data.
The magnetic milestone is not finished, and each magnetic section below says what is still missing.
Around it sit fixes to answers that were wrong without saying so, the foreign readers and writers checked against the programs themselves, and a structure figure built from Python.
Three changes move numbers an unchanged script prints.
Every esd is smaller, because the factor that inflates it for correlated residuals now follows Bérar and Lelann's own correction.
On the shipped examples an esd is 0.79 (FAP) and 0.87 (NAC) of its 1.5.0 value, and no refined value moves.
A result's Rwp and χ² are now measured at the values it returns, which moves their last digits.
A constant-wavelength neutron fit refines in a wider profile box, estimates its own absorption where you declare a specimen size, and reads corrected isotope scattering lengths.
Apart from those three, a refined value moves only where one of the changes under Numbers that move applies to the fit.
VALIDATION.md quotes the new esds.
Everything that changes what 1.5.0 code gets back is in Upgrading.
Install
pip install --upgrade rietxUpgrading
Code to check
Code written against 1.5.0 runs unaltered, with the exceptions in this list.
capabilities().features["secondary_extinction"]is nowfeatures["primary_extinction"].
A powder has only primary extinction (Sabine, Von Dreele and Jørgensen 1988), so only the name changed.
The model andphases.N.extinctionare as they were, and the manual's anchor is nowcorrections.html#primary-extinction.write_reflection_tablewrites 13 columns on every table, magnetic or not.
satellite_orderandcomponentfollowintensity, andReflectionRowgains the same two fields.
Code that reads the CSV by column position needs the change.BackgroundPSpline.air_scatterisNonewherever no air term is declared.report.background.worst_absorptionisNone, andabsorptionbeside it isNonerather than{}, wherever the absorption screen had nothing to screen.
That is every Le Bail and Pawley fit, and a comparison such asworst_absorption < 0.25raises there.RefinedParameter.at_boundisNoneon a free row sitting at a zero floor, such as an absent phase's scale.
Code that testsat_bound is Falseneeds the change.write_htmlno longer takesinclude_plotlyjs, because the page carries everything it draws with.
viz.html.figure_from_arraysis gone, andviz.html.pagereturns the page as a string in its place.
A file an earlier version wrote still opens.- A pattern whose fit raised used to end
SequentialRefinement.fitin that exception.
It now records the pattern as a failure and carries on, which is the new defaulton_error="carry".
Passon_error="raise"for the old ending. A series that fits no pattern at all still raises. - The writers refuse what they used to write wrong without a word.
write_fullprof_pcr,write_topas_inp,write_gsas_expandwrite_gsas2_phase_cifeach refuse by name what their format cannot state, and spell an ion as their program reads it.
The sections on isotopes and on the.pcrwriter list each case. - A FullProf
.pcrwith aJbt = ±1phase at k = 0, and a TOPAS.inpwithmag_space_groupand site moments, used to raise.
Both now read, with the moments.
Code that caught the refusal to fall back now gets a magnetic model, which computes magnetic scattering on a neutron histogram. - A project that 1.6.0 saves does not open in 1.5.0, since the stored plan carries
lebail_passes.
A project that 1.5.0 saved opens in 1.6.0.
The same holds for any saved model that uses a field added since 1.5.0 (SCHEMA_VERSION0.22 to 0.41), so upgrade every machine that opens your files.
Diagnostics to check
Branch on Diagnostic.code, never on its text, and these changes pass you by.
BOUND_HITfires on some fits that were silent before, which is the point of it.
Its message ends with a parenthetical carrying its evidence, andDiagnostic.valueis a number where it wasNone.INDEX_SEARCH_INCOMPLETE's message changed on a search that a size cap stopped.- A series with a pattern above its Rwp fence carries
SEQUENTIAL_RWP_OUTLIER.
ASEQUENTIAL_DISCONTINUITYinto or out of such a pattern, or a diverged one, is no longer reported. GSAS2_GPX_PHASE_MAGNETICon a project whose phase names a magnetic partner but holds no magnetic phase isinfo, where it was awarning.
Its old message said the file's Rwp included magnetic scattering, which was wrong on every public file that triggers it (#606).
Numbers that move
- Every esd is multiplied by a smaller factor.
Refined values do not move, and the ratio of the two versions'Statistics.esd_inflationconverts one esd into the other.
ΔBIC fromsuggestandcompare_freed, theprofile_fractioninterval and the factor written into an exported CIF move with it. - A result's Rwp, χ² and curves come from a compile at its returned values.
χ² moved by at most 2.5e-3 of itself on the single-pattern acceptance fits, and by up to 2 % on one QPA series.
The history node keeps the figure from the stage's own compile, so a node's Rwp and its result's can now differ. - A refinement that tied a coordinate degree of freedom and then called another verb was accumulating that tie.
A refinement that tied a parameter of a phase the data cannot see, or a structural parameter under Le Bail or Pawley, was refining a column the corresponding freeze meant to stop.
Both now give the answer the tie declared. - A P-spline background built by
for_range, or byauto_backgroundwithout the air term, was refining that term anyway.
Every P-spline penalty now reads λ as a pure number (lambda_units = "intensity"restores the old one). Instrument.constant_wavelength_neutronbuilds its profile in a wider box (u from −0.5 to 8, v from −4 to 4, w, x and y up to 8).
1.5.0 used the X-ray box, with u up to 1, so a neutron fit can differ in its last digits.- A neutron instrument with a declared
capillary_radius_mmorthickness_mmand nomu_rormu_tnow gets an estimated one.
Absorption trades with scale and Biso, so both move on such a fit.
The Brindley correction ofparticle_radius_umnow reads the neutron table on a neutron histogram, so its weight fractions change. b_Sears.datcorrected 245 cells in 131 rows. Isotope scattering lengths moved by up to 12 %.
A natural-abundance neutron pattern moves only through He and Ra.- A σ column is floored at a thousandth of its own median esd.
1.5.0 floored it at 1e-3 or more, so a normalised pattern whose esds sit near or below 1e-3 had them raised.
Its χ², GoF and esds change. A pattern in counts is bit-identical (#650). CandidateGroup.delta_bicis now charged at N/f², which makes it smaller on every candidate the raw count favoured.
CandidateGroup.delta_bic_raw_nholds the number 1.5.0 gave.- A supercell the pattern does not support now sits directly below the smaller cell it contains in
IndexingResult.candidates, with a new refuting caveat,supercell_refuted. phases.i.atoms.j.dof.kis measured from where its fit began, and a series now starts each pattern's coordinates where the last one left them.
Its trajectory is each pattern's step, so chart the coordinate rows, which carry the same esd.- Three fixes move a fit only when they fire, and each names itself when it does:
CELL_RUNAWAY,SCALE_B_INSEPARABLEandPAWLEY_OFF_DATA_RIDGED.
The sections below say what each one changes.
Files that read differently
- A GSAS
.EXPor.prmnumeric field that is written but cannot be parsed now raises, naming the file, record and columns.
1.5.0 read it as absent. - A GSAS atom type such as
NI+2_58reads as ⁵⁸Ni²⁺, where 1.5.0 read a "+258" ion of natural Ni.
A GSAS-II.gpxreads the isotope its phase chose, so a deuterated project reads as ²H (b = 6.671 fm) where it read as H (−3.739 fm). - A TOPAS dataset opened by
RAW(...),XYE(...),XY(...),DAT(...),BRML(...)orSST(...)now counts.
Two such datasets no longer build into oneStructure, and a lone one gives its phasedataset = 0where it gaveNone.
A time-of-flight dataset is refused byto_structure, where 1.5.0 read it as constant wavelength. - A structure file with a Biso outside 0 to 25 Ų reads, where 1.5.0 refused the whole file.
Magnetic structures
A magnetic structure can be stated and refined
rietx 1.5.0 had no magnetic scattering model. Magnetic peaks in a neutron
pattern stayed in the residual, and the foreign-project readers refused a
magnetic phase. A moment is now an attribute of a site. Atom.moment takes a
Moment, holding crystal-axis components in μ_B, the form-factor ion and a
Landé g. A 4f or 5f ion needs the g stated. Phase.magnetic_symmetry takes a
MagneticSymmetry. That is the magCIF operator and centring loops, each
operation with its time-reversal sign, or a UNI, BNS or OG number resolved
into them. For MnF₂, Atom(..., moment=Moment.from_values((0, 0, 4.6), "Mn2+", vary=True)) puts 4.6 μ_B along c on Mn²⁺, and Phase(..., magnetic_symmetry="136.499") gives the group by its BNS number. The manual's
moment section
has the whole model.
The magnetic term reaches constant-wavelength neutron histograms only
(capabilities().radiations[*].magnetic_scattering). It shares the phase's
one Phase.scale, so qpa.weight_fractions never sees a moment. What refines
is phases.*.atoms.*.moment.dof*. dof0 is the signed modulus in μ_B, and
one or two angles follow inside the subspace the site symmetry allows. The
form factor is the dipole approximation, from a table of 96 ions.
These are refused by name where they are declared:
- a moment with no
Phase.magnetic_symmetry, or one outside the subspace it allows; - a Shubnikov symbol in place of a number, since nothing here parses one;
- an ion the table lacks, and a 4f or 5f ion with no
Moment.g; - a free moment that is exactly zero, where its derivative vanishes;
- a moment on a site that also carries
Atom.aniso; - a magnetic group that does not map the structure onto itself, refused when
aRefinementis built or a file is read (#597); - a
Phase.propagation_vectorbeside a moment model.
FitReport.magnetic carries one MomentEvidence row per site. It gives the
modulus and its esd, the approximation used, and supported. That reads
false when the modulus is below three of its own esds, and None when it has
no esd. A direction the powder average cannot see is held and named in
unmeasured_directions, with no esd. A flat rotation that spans two angles is
first turned onto a meridian. StageResult.moment_flat_axes and
StageResult.moment_turned record the turn (#599). MOMENT_PAIR_DEGENERATE
names two moduli the powder cannot separate and quotes their quadrature sum.
In a joint X-ray and neutron fit the term is computed on the neutron histogram
alone. The same holds apply there (#600).
On the GSAS-II tutorial's Cr₂WO₆ patterns from HB-2A (BNS 58.395, Cr³⁺), the
4 K moment refines to 2.12 ± 0.05 μ_B along a. At 150 K, above the ordering
temperature, the same model returns 0.07 ± 0.83 μ_B with supported false.
Rwp moves by one part in 10⁵.
The magnetic peaks can carry their own width. Phase.magnetic_lor_size and
Phase.magnetic_lor_strain add Lorentzian width to the magnetic component
alone. Both are off at their default of zero. Without them, magnetic order
coherent over a shorter length than the crystallites is fitted with a smaller
moment. The magnetic_width plan frees the moment, then the widths, then
both. MAGNETIC_WIDTH_UNMODELLED fires while the widths are held and the
residual's shape says they are needed. MAGNETIC_WIDTH_UNMEASURED and
MAGNETIC_WIDTH_MOVED_MOMENT report on them once freed.
STAGE_FREES_MAGNETIC_WIDTH_WITH_MOMENT names a plan that frees a width in
the stage that first frees the moment. On a synthetic MnF₂ pattern with 0.22°
and 4.60 μ_B planted, the plan returns 0.220 ± 0.011° and 4.600 ± 0.032 μ_B.
With the widths held at zero the moment comes back at 3.34 ± 0.14 μ_B, nine
esds low.
A commensurate k ≠ 0 structure is stated in its magnetic supercell.
rietx.crystallography.magnetic.supercell.magnetic_supercell builds that
phase from the parent. It is not exported at the top level and may change.
Such a child often needs Phase.symmetry_operations, a new field that carries
a group no Hermann-Mauguin symbol names in its cell under a bracketed
space_group label. CHILD_GROUP_UNNAMED says when the builder used it.
The report's THRESHOLDS_VERSION moves 1.5 → 1.6 for FitReport.magnetic,
1.6 → 1.7 for FitReport.satellites (next section) and 1.9 → 1.10 for the
magnetic width's thresholds.
The magnetic milestone is still open, and these parts are missing:
- an incommensurate k, a second k on one phase, time-of-flight, polarised
neutrons and magnetic X-ray scattering; - an analytic derivative for the moment, so it refines by finite differences,
and the jax and torch backends refuse a magnetic phase by name; - real-data checks beyond the Cr₂WO₆ k = 0 pair, since every k ≠ 0 test case
is synthetic; - a supercell on an F-centred parent at k = (½, ½, ½), such as MnO, which
magnetic_supercellcannot build yet (#612).
Unexplained intensity can be tested as magnetic
A phase can now declare a commensurate propagation vector,
Phase.propagation_vector, stored as three exact rationals. An
incommensurate component is refused. So is a k that is a reciprocal-lattice
vector, by a test that respects centring. The satellites at G ± k then join
the phase's reflection list. Le Bail and Pawley put intensity on them, and a
Rietveld stage gives them none. A satellite's tick row carries four indices.
ReflectionRow.satellite_order says which satellite a table row is.
Every report now asks whether the leftover peaks could be magnetic.
FitReport.satellites holds one SatelliteEvidence per phase, on X-ray fits
too. It sorts the positive residual peaks into those on a calculated line,
those on a lattice point the assumed group forbids, and the rest. Only the
rest are scored, against an enumerated set of zone-boundary k. The ranked list
comes back whole as SatelliteCandidate rows. The note names the best beside
its runner-up. Nothing in it needs a moment. On the 11-BM NAC example the arm
costs 0.04 s of a 0.44 s report(). On Cr₂WO₆ four residual peaks sit on
forbidden lattice points at 4 K and none at 150 K. That split is the k = 0
signature. A match count alone is weak evidence. The best candidates index 2
of 6 leftover peaks at 4 K, and 2 of 5 at 150 K, where there is no order.
rx.solve_magnetic(ref, data, sites=[...], ion=...) goes one step further,
and it is provisional. It takes a converged neutron fit and proposes k. It
builds candidate magnetic groups from each site's irreducible
representations. It refines one trial per class of models the powder cannot
separate. It ranks them by ΔBIC against a nuclear reference, then by an R
over the magnetic-only channels, then by fewer parameters. Rwp is never the
key. The answer is a MagneticSolution, whose verdict reads "solved",
"abstained" or "nothing to solve". It abstains when the leaders lie within
tie_width (6.0 by default) and neither tiebreak separates them.
write_magcifs writes one magCIF per class. K_VECTOR_UNSEPARATED and
MAGNETIC_SUBGROUP_PREFERRED arrive on MagneticSolution.diagnostics. On
Cr₂WO₆ at 4 K it solves with k = 0, BNS 58.395 and 2.05 ± 0.05 μ_B on Cr. At
150 K the verdict is "nothing to solve".
Three parts are not built yet. The candidate k are a fixed zone-boundary set
with no CDML label (SatelliteCandidate.cdml is None). Mode amplitudes are
not refinable. MagneticSolution has no model_dump. Expect the ranking
criterion to change too. SatelliteEvidence and SatelliteCandidate are
provisional with it, as the manual's compatibility page says.
A magnetic structure moves through magCIF, TOPAS and FullProf files
Structure.from_cif now reads a magCIF. It takes the operator and centring
loops with their time-reversal signs, and moments in crystal-axis, spherical
or Cartesian form. magCIF has no item for the ion or the Landé g, so
moment_ions= and moment_g= state them per site. nuclear_group=
("auto", "parent" or "file") chooses the group the positions refine
under. CIF_MAGNETIC_NUCLEAR_GROUP or CIF_MAGNETIC_NUCLEAR_SETTING says
which was taken. A site with an uncharged species takes the neutral atom's
form factor (CIF_MAGNETIC_ION_UNCHARGED). A lanthanide or actinide takes its
usual magnetic ion and a free-ion g instead (MAGNETIC_ION_ASSUMED,
LANDE_G_ASSUMED). A stated BNS or OG number that disagrees with the
operators is reported (CIF_MAGNETIC_NUMBER_MISMATCH), and the operators'
own numbers are stored. A moment component written ? is refused. So are a
modulated file and a file with k ≠ 0.
Structure.to_cif and write_refinement_cif write a phase with moments as a
magCIF. The file carries both loops, the moments with their esds, and the ion
and g under a private _rietx_atom_site_moment category. A phase with no
magnetic_symmetry is written as before. A supercell phase is written in its
own cell without the parent's k, so it reads back as k = 0 in that cell.
The TOPAS reader now reads mag_space_group, the site moments mlx mly mlz
and mg. 1.5.0 refused them. The components are in TOPAS's fractional
basis, checked against TOPAS 6's own intensities. A refined mg comes in
held, and TOPAS_MOMENT_G_HELD says so (#603). mag_only is refused.
write_topas_inp writes the three back. It refuses by name what a str
cannot state: a non-standard setting, a nuclear group larger than the
magnetic group's family group, a moment ion that differs from the site
species, and a propagation vector.
A FullProf .pcr whose Jbt = ±1 phase restates a nuclear phase in that
phase's cell at k = 0 now builds. to_structure puts the moments and the
group on the nuclear phase (FULLPROF_MAGNETIC_PHASE_READ). Every other
magnetic form is refused by name. nuclear_only=True now reports what it
dropped (FULLPROF_MAGNETIC_PHASE_OMITTED). GSAS .EXP and GSAS-II .gpx
magnetic phases are still not read. Their refusals now say why. A .gpx
whose phase names a magnetic partner but holds no magnetic phase gets an
info saying so. 1.5.0 warned that the file's Rwp included magnetic
scattering. That claim was wrong on every public file that triggers it (#606).
The FullProf, GSAS and GSAS-II phase-CIF writers refuse a phase with moments
by name, since each format would carry it as nuclear (#470). For GSAS-II this
was measured: GSAS-II 5.6.3's CIF import drops the magnetic loops without a
warning. The same writers refuse a Phase.propagation_vector (#567). Each
refusal names an export that keeps what it would drop: Structure.to_cif for
moments, the structure's JSON for k.
A series reports the moment and where it switches on
A sequential refinement of a magnetic model now reports the moment per pattern
and brackets the ordering transition. SeriesEntry.magnetic carries the
pattern's MomentEvidence rows, and SeriesEntry.moment(site) returns one.
SeriesResult.magnetic_trajectory(site) returns a MagneticTrajectory: |m|
against your axis, with the esd withheld on every point the data did not
support. Its onset is a MagneticOnset, read off the per-pattern verdicts
rather than the values. It brackets the onset between the last supported
pattern and the first held one. Its ± is half that spacing.
SEQUENTIAL_MOMENT_HOLD counts the unsupported patterns.
SEQUENTIAL_MOMENT_ONSET gives the bracket. Under direction="both" that row
also says whether the two chains agree, including on which side is ordered.
An unsupported modulus is reseeded to its floor before it starts the next
pattern. Moment angles stay in one range, so a re-wrap does not read as a
jump (#604). series.plot("magnetic.<atom>") draws held points hollow and
shades the bracket.
On the Cr₂WO₆ pair the 4 K moment is 2.12 ± 0.05 μ_B and the 150 K pattern
comes back held. The onset is 77 ± 73 K.
The series code is tested on a synthetic ramp and that two-pattern pair only.
A real ordering ramp is the open task. Nothing fits m ∝ (1 − T/T_N)^β to the
trajectory. MagneticTrajectory and MagneticOnset are provisional until
that ramp is measured.
Esds and fit statistics
Every esd is smaller, from Bérar and Lelann's own correction
Statistics.esd_inflation multiplies every reported esd to account for serially correlated
residuals. In 1.5.0 it summed each run of same-sign weighted residuals at full weight. Bérar and
Lelann (1991) describe that test in their § III and set it aside. It now computes their § IV
homogeneous correction, eqs (10)-(12), which adds a same-sign neighbour in proportion to the
probability that it is correlated with the point before
(#674, by @mustachefeeling). White residuals now
give 1.13, where they gave 1.51.
No refined value moves. Every esd shrinks by the ratio of the two factors, one number per fit.
On the FAP lab example the factor goes from 2.71 to 2.15 and every esd is 0.794 of its 1.5.0
value. On the NAC synchrotron example it goes from 9.25 to 8.07, a ratio of 0.873. Correlations
are unchanged. The same factor sets the effective count N/f² that suggest and compare_freed
charge ΔBIC at, the Δχ² cut of profile_fraction, and the factor an exported CIF quotes.
report_thresholds_version is 1.11 for the change.
A result's Rwp is measured at the values it returns
A stage freezes its peak windows and FCJ quadrature at the values it starts from. In 1.5.0 the
result's statistics and curves came from that frozen compile, so a rebuild at
result.parameters did not reproduce the χ² it reported
(#272). fit and run_stage now end with one
more compile at the returned values. It keeps the last stage's settings and the σ the solve used.
The esds are still the last solve's, and the history node keeps the frozen figure. The two χ²
differ by at most 2.5e-3 of themselves on the single-pattern acceptance fits, and Si SRM 640c
still reports Rwp 0.08263. FROZEN_COMPILE_STALE (info) quotes both where they differ by more
than 1 %. Over 358 logged fits that happened only on one QPA series. A Pawley result and a joint
fit still report the frozen compile.
Two directions the data cannot measure are named
- A phase's scale and B on a short range. With reflections at one d-spacing, a phase's scale
and its displacement parameters change the pattern the same way. Issue #204 had bcc Fe on a
25–50° Cu Kα scan return 0.0 wt% and 80.9 wt% from two staging orders at one Rwp, and on a
synthetic of that shape the fraction read 0.000 ± 0.000 wt%. Each stage of a single-pattern
fit now tests for this before solving, holds that phase's B at the value supplied, and reports
SCALE_B_INSEPARABLE(warning) with how far each Ų of error in B moves the fraction. On the
synthetic, Fe now returns 1.284 wt% against a truth of 1.211, with or without a bound on B.
StageResult.scale_b_heldrecords the hold (SCHEMA_VERSION0.40). - A combination of three or more parameters. A direction whose eigenvalue falls under the
covariance's cut is given zero variance, so every esd it touches reads too small, and a pair
test cannot see it.COVARIANCE_DIRECTION_DISCARDED(warning) names each parameter whose esd
is at least √2 short for this reason. About one acceptance solve in ten discards such a
direction, typically a QPA mixture's size, strain and instrument widths. The esds themselves are left as they were.
An esd that cannot be computed is absent, not raised
When the eigensolve behind the esds failed after a fit had converged
(LinAlgError: Eigenvalues did not converge, issue #225), the fit raised and
its answer was lost. The refined values come back now, bit-identical to the
same fit with a working eigensolver. Every esd, correlation and quantity
propagated from them is None, which is the empty state the schema has always
declared. COVARIANCE_UNAVAILABLE names the stage. On the stage that produced
the answer, it says every esd on the result is absent. On an earlier stage,
only that stage's correlation guard did not run. What makes the eigensolve fail
is not known: the reporter could not reduce it to a case without their data, so
the fix is a fallback and not a cure.
The series work takes two of this release's SCHEMA_VERSION steps, 0.22 → 0.23
for SeriesResult.failures and .n_failed and 0.24 → 0.25 for
SeriesEntry.rungs_raised, with the hold's 0.23 → 0.24 between them. All are
additive and default to empty, which is true of every series written before
them.
A phase whose scale reached zero keeps its fraction esds, or names why not
When a phase is not in the specimen, its scale falls towards zero and the fit
can leave it anywhere from 1e-28 down to exactly 0.0. Every weight-fraction esd
used to depend on where. Above about 1e-163 they were reported. Below it every
one was None, with no diagnostic, although the scale's own esd was an
ordinary 7.66e-9 on the fixture that measured it. An agent on a 48-pattern
series lost them on 16 patterns and propagated the scale esds by hand, without
the covariance.
The esds are now computed down to about 1e-300, and equal the 1e-135 answer
there. At exactly 0.0 the parameterisation has lost the direction, so the esds
stay None and QPA_ESD_UNAVAILABLE names the phase. It points at
Refinement.profile_fraction for an interval. The same applies to every
parameter whose value sits that close to zero, so a width at 1e-170 keeps its
esd too.
RefinedParameter.at_bound reads None on a free row sitting at its floor,
such as an absent phase's scale or a width at zero, where it read False.
Nothing tested it, because that floor is at minus infinity in the solver's
coordinates. Such a row also no longer draws a BOUND_HIT about its upper
limit, which it could when its esd, measured in those coordinates, grew wide
enough to reach it.
A joint fit (MultiHistogramRefinement) with a scale at 0.0 reported every
fraction as 1.0 ± 0.0 or 0.0 ± 0.0. It now withholds those esds and names the
phase, as a single fit has since 1.1.
A trace phase's weight fraction can be profiled
A weight fraction's esd is the curvature of χ² where the fit stopped, so it
describes one basin. A trace phase's scale trades against its width until its
peaks become background, and that ridge can hold several basins at one χ².
#203 measured a phase reported
at 1.41 ± 0.65 wt% on a pattern that admitted 0 %, about 1.5 % and 98.7 %
within 0.011 percentage points of Rwp, with nothing flagged.
Refinement.profile_fraction(data, phase) is the check. It pins each of the
phase's free width terms on a grid, refits the rest on a branch, and returns a
FractionProfile: every fraction the data admits within the 95 % Δχ² cut
(scaled by χ²_red and the Bérar-Lelann factor, as every esd is), and
QPA_FRACTION_UNDETERMINED when one lies more than twice the esd's 95 %
half-width from the fit's. It is opt-in, costs twelve refits per width term,
and changes nothing the fit returned. On a synthetic trace of CaF₂ in LaB₆
the fit reports 1.19 ± 0.39 wt% and the profile admits 0.86 % to 77 %.
compare_rivals on a refinement built with history=False now runs its fits
with the caller's ties, named variables and holds. It used to carry only the
free set, so a tie or a variable fell off the trial.
SCHEMA_VERSION 0.32 → 0.33 for the new answer type. It is additive.
ΔBIC stops blessing a parameter within 1σ of zero
ΔBIC charged its penalty at the raw channel count. A powder residual is
serially correlated, so at tens of thousands of channels almost any χ² gain
outvoted it. #270 measured +36
to +211 on four synchrotron fits for an occupancy each fit's own esd put within
0.76-1.89σ of zero, with 1.5.0's esd factor. suggest now charges N/f², with f the fit's Bérar-Lelann
esd_inflation, and keeps the raw-N figure beside it
(#431 by @mustachefeeling). For
one parameter that count makes ΔBIC close to t² − ln N/f², so the verdict and
the esd agree.
rietx.report.compare_freed(restricted, full) measures the same after the
fit. It takes two fitted refinements, the second freeing more, and returns
ΔBIC at N/f² and at raw N with each freed parameter's t-ratio beside them.
predict_then_verify attaches the same record to its outcome as
VerificationOutcome.comparison. The agent skill's rule now reads the
t-ratio first.
SCHEMA_VERSION 0.26 → 0.27 for CandidateGroup.delta_bic_raw_n and
SuggestionResult.n_effective, and the report's THRESHOLDS_VERSION
1.7 → 1.8 for the comparison. Both are additive.
RefinementResult.usable says whether a fit can be read
status is the optimiser's exit and makes no claim about quality. A fit could read converged
beside its own MODEL_FAR_FROM_DATA at Rwp 84-235 %
(#243). RefinementResult.usable is False
when the solver did not converge or any diagnostic is at level error. A True still leaves
every warning standing. PEAK_WIDTH_LAW_MISMATCH now also fires on a refinement
(#249). It compares the median width of the 12
most prominent lines with the fitted width of each phase the data can see, and fires when none
comes within 3×.
What a plan frees, holds and ties
A hold a plan may not override
vary=False never kept a parameter fixed, and nothing said so. A plan
replaces the vary flags rather than continuing them, so any stage whose
turn_on glob matched a parameter you had pinned freed it and refined it,
while the Structure you handed in went on reporting vary=False and the
result reported vary=True. Issue #211 reported the cost as an invalidated
pin-and-scan study.
Refinement.hold(globs) is the declaration that survives a plan, and
Refinement.unhold(globs) takes it back. Both take the same fnmatch globs
set_vary does, both record a history node, and the register survives a
checkout, a branch and reopening a .rex. A released parameter comes back
fixed rather than free.
ref = rx.Refinement(standard, instrument)
ref.hold("phases.0.cell.*") # the certificate's cell
result = ref.fit(data, plan="lab_calibrate")Calibration is the case it is for. On the 11-BM SRM 660a pattern over
2-30° 2θ, with the cell declared at the certificate's 4.1569162 Å,
mccusker_default moves it to 4.156826 Å (21.7 ppm) and takes 296 µ° of
zero shift with it. Held, the cell is bit-identical and the zero is the one
the certificate's scale implies. Note that the fit which moved the cell has
the better Rwp (0.090 against 0.097), which is why this was quiet
for so long.
A stage that matched a hold says so: StageResult.blocked_by_hold names the
paths per stage, and HOLD_BLOCKED_PLAN (info) names them once per fit
with the stages that asked. Nothing is wrong when it fires; it is the record
of which declaration won.
ParameterRow.held is the fifth reason a row cannot be freed, reported
through refinable and held_because like the other four, and drawn in the
GUI and the .rxt document. A series declares a hold through
SequentialRefinement.fit's constrain hook, as it declares a tie.
SCHEMA_VERSION moves 0.23 → 0.24 for StageResult.blocked_by_hold and
RefinementState.holds, both additive and both defaulting to empty, which is
true of every result written before this.
A stage that asked for a parameter the model does not have
A plan stage whose turn_on named a path the model has no row for freed
nothing, converged, and said nothing. Issue
#265 reported it on
instrument.source.wavelength, which the table spells
instrument.source.lines.0.wavelength. Its follow-up comment reported the
same silence costing a whole joint refinement: instrument.profile.* freed
the one constant-wavelength histogram and none of the time-of-flight banks,
and the fit reported converged at Rwp 0.115 where globs naming the banks'
own rows gave 0.066.
Two findings, and each is careful about what it does not report. A pattern
that matches nothing is how the shipped plans reach components a model may
not declare, so it stays silent. lab_sample_refine frees
phases.*.microstrain.dof.* whether or not any phase has a Stephens block.
STAGE_PATH_UNKNOWN (warning) fires on a literal path, one with no *,
? or [, that names no row. The message carries the nearest real path, and
StageResult.unknown_paths lists them per stage. It is not raised, because
one plan runs every pattern of a series.
STAGE_FREED_NOTHING (info, joint fits) fires when a stage's globs freed
rows of one histogram and matched none of another's.
StageResult.unreached_histograms maps each such histogram to those globs. A
glob scoped to one histogram (hist.0.…) is a plan aimed on purpose and is
not reported. Nor is a row that exists and is force-fixed.
A typo inside a glob cannot be told from a glob that correctly matched
nothing, so it is still silent. Read StageResult.freed for any stage you
wrote yourself. A glob under a name a release retired is the exception: one such
as instrument.background_peaks.* fires STAGE_PATH_UNKNOWN with the current
spelling, instrument.extra_components.* (#641). A plan built in code is not
migrated the way a saved project is.
SCHEMA_VERSION moves 0.25 → 0.26 for the two fields, both additive. They
default to None, meaning nobody looked, which is what a result stored before
this opens with. Every fit now writes a value, so an empty list is a stage
that was checked. One smaller change rides along: every "did you mean"
the package prints now offers an exact match up to case first, so
instrument.profile.U, Caglioti's U as papers print it, is answered with
instrument.profile.u rather than instrument.profile.y.
BOUND_HIT now says the bound changed the answer
The flag that reports a parameter sitting on its limit used to decide by
distance. It asked whether the value had stopped within a fixed tolerance of
the limit. How close a bounded fit stops is a function of the stage's ftol
rather than of the fit, because the trust-region solver keeps every iterate
strictly inside the allowed range. The same pinned parameter was therefore
reported at one convergence tolerance and silent at a looser one. Measured over
32 constructed cases on the fluorapatite and Si SRM 640c fixtures, nine ended
converged with the parameter on its limit for any physical reading, carrying
ordinary esds and no flag. Reported as
#273 by @mustachefeeling, from
a profile coefficient that sat 9e-8 from its declared maximum with an esd of
about 1e5 and nothing said so.
The test is now a conjunction. The value must sit within a hundredth of its own
esd of the limit, and the residual must still push the parameter out of the
allowed range. At an unconstrained stationary point the normal equations leave
the residual orthogonal to every free column, so a column that keeps an angle
is being held by something. At a limit that something is the limit. Both halves
earn their place: a stage that ran out of iterations while still travelling
towards a bound pushes outward just as hard as a binding one, and only the
distance tells the two apart.
All 32 cases now fire, at every tolerance swept from 1e-9 to 1e-3. Nothing that
should stay quiet started speaking. A free optimum half an interval away from
its limit is silent at all of them, and so is that early-stopped stage.
The diagnostic now carries the evidence for its own claim. Diagnostic.value
was None on this code and is the signed cosine between the residual and the
parameter's Jacobian column, with the distance in esds beside it in the
message. A reader can tell a limit that carried load from one the solver
happened to stop near, without re-running anything.
Both fixes the issue proposed were ruled out by measurement first. Reading
scipy's own active_mask fixes none of the nine cases, since it agrees with
the old test on every one of them, and scipy's documentation disclaims that
field for this solver. Scaling the test to ftol fits whichever fixture wrote
it, the same tolerance leaving one fixture 1.2e-10 from its bound and another
1.6e-6.
No fitted value moved anywhere. Across all fifteen acceptance suites the only
text that changed is that one sentence.
A tie onto an atomic coordinate stops drifting
A tie whose target is a coordinate degree of freedom now means the same thing
after the tenth call as after the first. Until this release every verb that
wrote the models back added the tie's whole value to the coordinate again, so
the position drifted by one displacement per call while the variable naming it
still read the value you declared.
ref.add_variable("A", 0.01, min=-0.5, max=0.5)
ref.tie("phases.0.atoms.1.dof.0", "vars.A")
ref.set_values({"phases.0.scale": 0.02})
ref.set_values({"phases.0.scale": 0.02})On 1.5.0 that leaves phases.0.atoms.1.x at 0.2293. It started at 0.1993 and
one displacement of 0.01 was asked for. It now reads 0.2093 after each of those
calls, and vars.A reads 0.01 throughout on both versions.
Two consequences reached a number you would read. A second fit() on one
Refinement reported the variable at zero with the structure still carrying
the displacement in full, at an identical Rwp, so the refined quantity had
moved out of the name you gave it. And two sites tied to one variable in
antiphase came back asymmetric, the first one declared having collected one
application more than the second.
replay had the same fault, and there it was invisible. A replayed node
answered for a model one displacement past the node it was asked about.
Check any refinement that tied a coordinate degree of freedom and then called
set_values, set_vary, edit or fit a second time. No other kind of tie
is affected. A tie onto an anisotropic displacement parameter or a Stephens
coefficient was always correct, both being absolute rather than displacements
from a stored value, and so was a coordinate degree of freedom following
another one.
One thing to know about the repaired behaviour. Each tie call declares a
displacement from where the coordinate stands at that moment, and untie
leaves the coordinate where it is. Untying and tying the same degree of
freedom again therefore moves it by one more displacement, 0.1993 to 0.2093 to
0.2193 at a declared 0.01. Found during a design review rather than reported,
so there is no issue of its own to read.
A freeze that could not see a tie
Two decisions in refine.py asked what a free parameter was called where
they meant to ask what it can move. Tie a parameter to a variable of your own
and the only free name is the variable's, so both tests matched nothing and
both freezes reported that they had done their job.
The first is the hold on a phase the data cannot see. On 1.5.0 a cell driven
through vars.A stayed free for the whole stage while the same cell driven by
its own column was held:
ref.add_variable("caf2_a", 5.4631, min=5.30, max=5.60)
ref.tie("phases.1.cell.a", "vars.caf2_a")Across five patterns of a ramp containing no CaF₂ at all, that returned cell
values of 5.30422, 5.38679, 5.57821, 5.39074 and 5.59999 Å. That is a 0.296 Å spread,
with two of them resting on the declared bound. Every Rwp sat within 1e-5 of the
repaired run's, three of the five patterns reported no diagnostic, and no
chain-level finding fired. The walk is not monotone, so it reads as a
trajectory rather than as a fault. It now holds the variable on every pattern,
reports PHASE_UNCONSTRAINED on each, and says "5 of 5".
The second is the Le Bail and Pawley force-fix. A variable driving an atom's
biso entered the free vector, where the parameter itself could not, and came
back with a value and an esd against an intensity model that has no |F|² to
fit. It is now dropped, and the fit is bit-identical to the untied one. The
GUI's plan panel asked the same question the same wrong way and now agrees with
the stage it previews.
A variable driving two phases is never held. It changes the calculated
pattern wherever either phase is visible, so it is not the flat direction a
hold exists to remove; holding it would freeze a cell the data can measure.
Measured on a two-phase fixture, holding it anyway left the visible phase's
cell at its starting value, 10 441 ppm from the truth at Rwp 0.9589, against
1 ppm and Rwp 0.0416 with it free.
StageResult.held therefore names a column, which need not be a path under
phases.N. at all, and PHASE_UNCONSTRAINED's where names it too. The new
StageResult.held_reach maps each held column to the tied parameters it was
also driving, so a cubic a lists the b and c that followed it and a held
vars.A lists the cell it drove. Reading held alone still tells you which
values are not measurements; held_reach is how you get from a variable back
to the parameter.
Nothing changes for a refinement that declared no tie of its own. Every tie the
package derives stays inside the phase that owns it, so the new test and the
old one agree there by construction. Found during a design review rather than
reported, so there is no issue of its own to read.
A cell that runs away inside a stage is pulled back
Two free phases with nearly the same cell can trade intensity along a direction the data does
not fix. The phase left walking it can be one the data sees clearly, so no support test stopped
it. On a synthetic pair of LaB₆ phases one cell went from 4.1566 Å to 3803 Å in a stage that
reported converged, and the next stage raised while listing reflections
(#374).
After every stage, in every mode, a free cell length more than 15 % from where the stage started,
or an angle more than 6° away, is put back at that edge. The check reads the solver's answer and
is never a bound the solver sees, so a fit whose cells stay inside is bit-identical.
CELL_RUNAWAY (warning) names each path with its escaped and restored values. When it fires in
the stage that produced the answer, that cell and every path tied to it have no esd. A cell
driven by a free vars.X is named with its variable and left alone, since moving the variable
would move everything else it drives. Joint fits run the same check
(#385 by @mustachefeeling).
A Parameter you supply keeps its field's range
Most fields with a physical range declare it in their default: Phase.scale
is [0, inf] under softplus, Instrument.zero_shift is [−0.5, 0.5]°,
ProfileTCHZ.u is [−0.05, 1.0] deg². Until now the range applied only when
the field was left out. A Parameter(value=..., vary=...) you passed came out
unbounded, with no unit and the identity transform, so a scale or a width
could refine negative and nothing said so
(#204). Atom.occ and
Atom.biso were fixed in 1.4.0. Every other such field now does the same:
Phase, PreferredOrientation, AnisoU, StephensStrain and
eleven instrument classes, and the new Moment does the same from the start. An attribute you state still wins, in
either direction. A transform is inherited only together with the bounds it
enforces, so a Phase.lor_size given min=-1.0 keeps its identity transform
rather than having a negative value moved to zero. A value outside the
inherited range is refused when the model is built, naming the field, the
range and the escape.
A history log written before this carries the unbounded range for every
Parameter a caller supplied, and it would have reopened unbounded
(#209).
RefinementTree.load now restores the declared range wherever a node
predates its class's inheritance, and reports each parameter once as
DECLARED_RANGE_RESTORED. It lands on the diagnostics= list the method now
takes, and on Project.history_diagnostics after Project.open.
load_instrument_profile makes the same repair on a saved profile and takes
the same list; save_instrument_profile now stamps the schema version. No value
moves. Where a stored value lies outside the declared range, that parameter is
left as stored in every node and reported as DECLARED_RANGE_NOT_RESTORED, so
no log stops opening. SCHEMA_VERSION 0.34 → 0.35, and every node now stamps
the version it was written under (HistoryNode.schema_version), since the
header stamps only a log's creation. A node this release writes is never
walked.
Four walking parameters that now speak when they misbehave
Four new diagnostics, all of them reports rather than bounds, and none of their
thresholds a number anyone chose. None of the four changes a fitted value.
RESOLUTION_NOT_POSITIVE. The Caglioti resolution function Γ_G² is a
variance, and the constraint is on the quadratic rather than on U, V and W
separately, since a negative V alone is ordinary on a focusing geometry.
Nothing checked the sum. Where it goes below zero gaussian_fwhm clamps Γ_G to
a 1e-4° floor to keep its root real, so the model reported a resolution four
orders finer than any goniometer and the fit converged. On the configuration
this was built for, Γ_G² is negative at every point of an ordinary scan.
BISO_UNUSUALLY_LARGE names an isotropic displacement parameter past the point
where its own crystal would have melted, judged against a bound computed per
phase from that phase's packing (Gilvarry 1956). Per phase because the bound
runs 4.6 Ų on corundum to 8.7 Ų on NaCl, both ordinary, so one constant would
be wrong at one end. A flag and not a cap, which the IUCr round robin asks for
by name and which Watkin (2008) explains: a false atom's displacement parameter
rises, so the number is evidence about the model and clamping it destroys the
evidence.
RESOLUTION_UNCONSTRAINED names U, V or W refined on a pattern whose peaks are
predominantly Lorentzian, where the data does not determine them. This is
McCusker's § Synchrotron failure, and it carries that paper's remedy: measure
the instrument on a standard and hold it, rather than refining it here. There
is deliberately no test on how wide the widths are, because the same
paper's next paragraph has these three "easily determined" on
constant-wavelength neutron data, so a width threshold would have to be wrong
for one technique or the other.
FLAT_DIRECTION names a correlated pair whose |ρ| is 1.000 to the three decimals
the message prints. That is a statement about the rank of the data rather than
a strong correlation: one direction of the pair is not measured at all, and
each esd is conditional on the other parameter being right. It is reported
beside the pair's HIGH_CORRELATION rather than instead of it, so nothing that
counts correlations loses a row. FLAT_DIRECTION_OMITTED bounds the list the
way HIGH_CORRELATION_OMITTED already did, on its own budget.
Two bounds were measured and deliberately left alone, with what they permit now
written down where a caller meets them. Atom.biso's 25 Ų ceiling needs 109
to 338 ų per atom to be reachable below melting, five to twenty times any
ordinary packing, so it bounds nothing physical. Geometry.sample_displacement's
±1 mm sits about twenty times above a carefully packed plate, and because the
shift goes as s/R the same bound means three times more angle on a small
goniometer than on a large one. Both are runaway guards rather than physical
limits, both stay as they are, and both now say so in help.py and in the
schema. Declare your own bound to tighten either; an explicit one always beats
the declared default. A structure reader widens the Biso bound for a file that
states more, and says so (see Reading and writing files).
fit runs the Le Bail alternation itself
A Le Bail fit refines the profile against intensities extracted with the previous profile, so it
is often run more than once. RefinementPlan.lebail_passes sets a cap. Under mode="lebail",
fit runs the plan again from where it ended, stops at the first pass that does not lower Rwp,
and keeps the best pass. LEBAIL_ALTERNATION_STOPPED names the kept pass and each pass's Rwp. It
is info at a fixed point and a warning otherwise. On the 11-BM LaB₆ + cBN pattern started 0.3 %
off in cell, Rwp went 16.987, 16.969 and 16.967 % and stopped at pass 3. From 2 % off it
wandered, and pass 3 of 4 was kept. The default, 1, is the single run of 1.5.0. The cap is saved
in a .rex project and an .rxt document (SCHEMA_VERSION 0.41, project format 1.4).
A Pawley intensity past the end of the data is restrained
A reflection centred just past the fitted range has a Pawley intensity the data barely
constrains. On one synthetic fit the (6 0 2) reflection, 0.45° past the last channel, reached
4.13e7 against a median of 81. On a ten-pattern warm-started series such intensities reached
1e11 to 1e12, and some patterns ended at Rwp 865 % and 8726 % while reporting converged
(#440). Such a reflection now keeps its place, so
a stage can move it onto the data, and gets one restraint row pulling it towards zero.
PAWLEY_OFF_DATA_RIDGED (info) lists those reflections per phase. Their values and esds come
from the restraint. The carried and cleared chains now agree to four decimals. Le Bail is
unchanged. SequentialRefinement(carry_hkl_intensities=False) starts each pattern's extracted
intensities afresh; the default carries them.
Smaller fixes to what a fit reports
tie()refuses a tie that would push a coordinate past a bound it reaches through symmetry,
names the tie, the value and the bound, and registers nothing. A refusedtie()used to stay
registered, so the corrected retry was refused too (#246).suggest()andsummary()on a
Pawley fit no longer fail inside numpy (#244).- A joint fit raises
DISPERSION_NEGLECTED,SPECIES_FALLBACK_NEUTRALand
NEUTRON_RESONANT_ABSORBERon the histogram each concerns, inHistogramResult.diagnostics.
1.5.0 raised none of them on a joint fit.rietx.multi.DIAGNOSTIC_SCOPESsays where each
finding lands. - The
rwpon everystage_endevent counts declared peaks, so the progress line and
rietx watchshow the result's figure. A fit declaring a peak read 1.4-2.9× worse at every
stage (#441).fit_startcarriesn_fittedbeside the file'sn_points. LOW_ANGLE_UNMODELLEDstarts its region at the first reflection with intensity the data could
see. A phase at a vanishing scale or a declared peak of zero area no longer silences it (#436).PATTERN_UNDERSAMPLEDno longer counts noise as peaks on a file whose σ is smaller than √y, as
monitor-normalised neutron data is (#275). Scaling the declared σ alone moved the measured
steps per FWHM by a median 5.45× over 27 bundled patterns, and now by 1.000.
PATTERN_DEAD_CHANNELS(warning) names detector channels that measure nothing and outweigh the
pattern. Two such channels took a fit from Rwp 0.0016 to 0.55 and its cell 342 ppm away while
it reportedconverged(#274).
Background
An air term nobody declared is no longer refined
BackgroundPSpline.air_scatter scales a 1/2θ term for the low-angle
air-scatter rise. It defaulted to a parameter held at 0, and auto_background
turned it on only when the pattern diagnostics reported the rise. Neither
choice survived a fit. Every preset frees instrument.background.*, and a plan
replaces the vary flags, so the declined term was refined on every P-spline
fit. Inside a fine spline's span its column is a flat direction, and the
correlation guard reported that one direction once per pair of background
columns. On the 11-BM NAC pattern with 0.75° knots, one fit printed 1074
HIGH_CORRELATION and FLAT_DIRECTION rows about the background alone, at the
same Rwp as the fit without the term.
The field is now Parameter | None and defaults to None, which means no
design row, no parameter path and nothing for a glob to free.
BackgroundPSpline.for_range builds no air term, and auto_background still
declares one only where the diagnostics fire. The same NAC fit now reports no
correlation rows at 8°, 2° or 0.75° knots. SCHEMA_VERSION goes 0.28 → 0.29,
and this step is not additive: a document written now stores null in that
field, which 1.5.0 cannot read.
A project saved before this opens with the old default, a parameter at 0, and
refines it as before. To drop it, set instrument.background.air_scatter to
None. To keep a term you want, declare
Parameter(value=1e-3, min=0.0, transform="softplus").
A P-spline fit with no air term now reports AIR_SCATTER_UNDECLARED (warning)
when a 1/(2θ) column would remove at least 0.5 % of χ² and 25 times the reduced
χ². auto_background's envelope test can miss the rise on a line-dense, humped
pattern (#636).
auto_background spans the range you fit
auto_background took its knot range from the whole file, and a fit over a
narrower window left every coefficient past the window held by the penalty
alone. Those coefficients carry the curve wherever its slope points, and on
one series it went negative from 35° past the fitted range, where nothing
checks it. It now takes two_theta_limits, the tuple fit takes, and takes
the diagnostics, the Chebyshev order and the knots over that range. Pass the
same limits to both. Without the keyword it behaves as before.
A P-spline penalty that means the same thing in any unit
BackgroundPSpline.lambda_smooth weighted rows √λ·D₂c whose coefficients
carry the intensity's unit, while every data row is divided by its σ. So λ
itself carried inverse intensity squared. Multiply the intensities and their σ
by k and the penalty's weight moved by k². On the 11-BM NAC pattern, one
auto_background model went from unpenalised to a straight line on a unit
change alone, and on high-count data the default λ = 1 left a straight line
where the background had structure. That is the silent side. On round-robin
sample 2, a penalty stiffened that way moved corundum's Biso by 28 % and no
background code fired.
λ is now a pure number. The rows are √(λ·m)·D₂c/σ̄, with σ̄ the median σ over
the fitted channels and m the fitted channels per coefficient, so one λ means
the same stiffness in counts or in a normalised unit, at any count level and at
any step size. The default is still 1.0. At the count levels of NAC and sample
2 it is close to what the old default was there, and sample 2's structure
does not move anywhere between 0.1 and 100. The same NAC fit repeated at four
intensity units a hundred-fold apart now gives the same background to 13
digits.
BackgroundPSpline.lambda_units = "intensity" gives back the old rows
exactly, to reproduce an earlier fit. A project saved before this opens with
its λ read as the new pure number, because nothing stored says which unit the
old one was chosen in. A λ tuned by hand against an earlier version, such as
λ ≈ 1/σ², does not carry over.
A background screen with nothing to screen says so
report.background.worst_absorption measures how much of a structural
parameter the background could imitate. It screens a phase's scale, its
displacement parameters and its occupancies. Le Bail and Pawley fix every one
of those, so on those fits the screen had nothing to measure, and it reported
0.0. A reader, the agent skill included, took that as a clean result. The
same happened on a Rietveld fit whose last stage freed none of those
parameters, or no background term (issue #451).
It is now None in all of these cases, with absorption None beside it.
summary(deliverable="qpa") prints "not measured" and says why. Nothing that
fired before stops firing, because 0.0 could never cross the threshold
either. The report's THRESHOLDS_VERSION moves 1.8 → 1.9 for this and for the
next section.
A width that grows while the fit gets worse is named
Sometimes a phase's peaks broaden along a series because the phase is standing
in for something the model lacks, such as a second phase or a diffuse signal.
Each fit still converges, and no per-pattern code fired until
STRAIN_UNUSUALLY_LARGE at 1.5°. On issue #451's synthetic, a one-phase chain
over a growing second phase had its width grow 15× and its Rwp 7.5×, and no
warning fired.
A series now reports SEQUENTIAL_WIDTH_GROWTH at warning when a phase width
reaches 3× the first value the series measured while GoF reaches 2× its own,
at the same pattern. The message names the pattern where both first held.
summary(deliverable="series") prints it. A width that grows while GoF stays
flat is a real broadening, and fires nothing. None of the series the test
suite runs fires it.
Series
A constraint a series can declare
SequentialRefinement.fit and refine_sequential take a constrain hook,
(index, ref) -> None, called on each pattern's Refinement once it is built
and warmed and before its fit:
def constrain(index, ref):
ref.add_variable("B_site", 0.5, min=0.0, max=5.0)
ref.tie_equal(["phases.0.atoms.0.biso", "phases.0.atoms.1.biso"],
source="vars.B_site")
result = rx.refine_sequential(patterns, structure, instrument,
constrain=constrain)Before this there was nowhere to put one. A tie and a named variable live on the
Refinement and in no model, so carry could not reach them, and prepare runs
one line before that Refinement exists. A tie declared by hand held pattern 1
and no pattern after it. That was an absence and never a silent drop: reported
as #376 by @mustachefeeling, from
an in-situ series needing a Biso tie between the two occupants of a
mixed-occupancy site on every pattern.
Three things to know about the hook.
It fires once per fit rather than once per pattern. Every rung of the
escalation ladder gets it, and so does the cold refit verify_discontinuities
runs, because a verification fit that dropped the constraint would not be
comparing like with like.
It is a hook rather than a list of ties because tie_equal resolves its globs
against a live ParameterTable and nominates the first match in table order as
the source. Each pattern has its own table, so re-declaring against it is the
only spelling that means the same thing on every pattern.
A named variable's value now crosses the pattern boundary under the same
carry globs as everything else, vars.B_site being an ordinary dot-path. It
warms from the last accepted pattern, so a quarantined one seeds no successor
here either. On a seven-pattern synthetic whose tied biso walks from 0.4 to
3.4 Ų that saves about 5 % of the chain's iterations, 176 against 186, and
moves no fitted value beyond the fourth decimal. Keep it for the declared
control: carry=["phases.*.cell.*", "vars.*"] now does what it says.
A user tie naming a path symmetry already owns is refused on the first pattern
with the message a single Refinement gives, since every table rederives the
symmetry ties before the hook sees it. There is no pattern on which the same
declaration quietly takes.
Refining many patterns § Declaring a constraint
on every pattern is the chapter.
A series survives a pattern that raises
One pattern that could not be fitted used to end a whole series and take every
pattern already fitted with it. Issue #224 lost 20 of 24 patterns to one
refused cell, and issue #225 lost 103 of 182 to an esd computation that failed
after the fit had converged. A series now returns what it measured, marks the
pattern it could not fit, and says so.
A rung that raises escalates. The ladder already retried a warm start that
came back diverged: the collapsed warm refit, then the staged plan from the warm
state, then the staged plan cold. A rung whose fit raises now counts as lost in
the same way, so the next rung runs. This matters for #224's case: the cell
that ran away belonged to a neighbour that converged, so every warm rung
inherited it, and the reflection enumerator refused it before the fit began.
The cold rung starts from the initial models, never sees that cell, and rescues
the pattern. SeriesEntry.rungs_raised records what each earlier rung raised,
and SEQUENTIAL_RESEED quotes it.
A pattern on which every rung raised is a failure, and the chain goes on.
It appears on SeriesResult.failures as a SeriesFailure and is counted by
SeriesResult.n_failed. SERIES_PATTERN_FAILED names it, and it has no entry.
SequentialRefinement.fit takes on_error to choose what happens next.
"carry", the default, warm-starts the next pattern from the last accepted
one. "skip" starts it cold. "raise" ends the chain in the exception, and
what completed stays on SequentialRefinement.results_ and .failures_ and on
the exception itself. Whatever the policy, a series that fits no pattern
raises, because an empty result is not an answer. An exception raised in your
own prepare or constrain hook is yours, and ends the series as itself.
SERIES_PATTERN_FAILED's where is the pattern's label, as on every other
per-pattern series diagnostic.
A path-dependence check that did not run says so
direction="both" runs the chain each way. Its only product is
SEQUENTIAL_PATH_DEPENDENT, and zero of them was also what a series reported
when the comparison never happened. Issue #224's third series had all 125
forward patterns and a backward chain that crashed, and it reported exactly what
a clean series reports. Worse, under a raising policy that crash replaced the
complete forward results with the backward chain's partial ones.
SEQUENTIAL_PATH_CHECK_INCOMPLETE fires at warning when the comparison did
not run: the forward chain was cancelled, the backward chain was cancelled, or
the backward chain raised. It names the chain and the pattern it stopped on.
It fires at info when the comparison ran on less than the series. where
then lists the patterns one chain has no entry for, or the paths that some
chain measured and no pattern could judge because no pattern had an esd for
them in both chains. The second is issue #269's case, a path held throughout
one direction. So zero SEQUENTIAL_PATH_DEPENDENT findings with neither of
these present now means the comparison was made and found nothing. A clean
both-way run fires neither.
The forward chain is kept before the backward one starts, so a raise in the
backward pass no longer costs it. It is on SequentialRefinement.result_ and
on the exception as series_result. The backward chain's own failures are kept
on result.backward.failures.
summary(deliverable="series") reads the new record, so it no longer calls a
backward chain that raised "cancelled", and it prints a partial comparison
beside its count.
A blank frame in a series says so, and its step no longer hides a real one
Issue #481 fitted a ramp with one blank frame, background and noise only, and
a real cell step planted five patterns later. The blank was reported as a
good fit. Its cell, fitted to noise, took the one discontinuity flag each cell
path carries, and a cold refit confirmed that step because two fits of the
same noise agree. The real step went unreported.
A pattern every rung left above the Rwp fence now says so.
SEQUENTIAL_RWP_OUTLIER (warning) names it, with value its Rwp over the
fence, and SeriesEntry.rwp_fence records the limit the fence set there.
The message quotes GoF and Rexp against the last pattern inside the fence,
because Rwp cannot say why it rose. A GoF well above that pattern's is a model
this pattern has outgrown. A GoF like it with a higher Rexp is fewer counts:
the blank frame, fitted perfectly, or a shorter frame whose fit is sound. The
pattern is not quarantined. It seeds its successor and joins the median, so a
lasting change can become the chain's new normal. SEQUENTIAL_RESEED no
longer calls such a pattern a good fit.
A step into or out of a rejected pattern is no longer scanned. A pattern
above the fence and a diverged one both have their own code, and neither takes
a path's discontinuity flag now. On #481's ramp the planted step is flagged
and verified at 1.00. SeriesResult.discontinuities holds each flagged step's
two patterns as fields (a SeriesStep), so nothing parses the message for
them, and the trajectory plot shades that pair rather than the largest step.
SCHEMA_VERSION 0.35 → 0.36 for the two fields. Both are additive and default
to None: a series written before them opens with neither recorded.
The skill no longer promises that the reseed fence catches a collapsed
refit="single" chain. Issue #475 found a width-freeing plan collapsed on
every mixture of a round-robin series, 4-29 % above the staged chain in Rwp,
with no reseed, because the median rose with it.
SEQUENTIAL_PERSISTENT_FINDING on RESOLUTION_UNCONSTRAINED for U, V and W
names it.
A refined coordinate crosses a series' pattern boundary
A series started every pattern's atomic coordinates at the model you handed
in, while carry=["*"] said they crossed. A coordinate refines through the
degree of freedom its Wyckoff site allows, and that degree of freedom is
rebuilt at zero for every fit, so copying it copied nothing. The cell beside
it carried. Each warm pattern now starts its coordinates where the last
accepted pattern left them.
A site moves as a site. A carry glob naming only x, or only the dof path a
plan frees, moves every coordinate the site ties to it, and no atom leaves the
special position your model puts it on.
A constrain hook that ties a coordinate's degree of freedom to a named
variable gets the displacement once. The carried coordinate already holds the
variable's fitted value, so warming the variable would have added it a second
time: on a synthetic LaB6 ramp the second pattern would have started the boron
at 0.2092 instead of 0.1996. A variable left out of carry restarts, and the
coordinate restarts with it, as any tie follows its source.
This is about the claim carry makes, not speed. On a seven-pattern synthetic
LaB6 ramp with the boron started at 0.19, the chain took 125 iterations against
the old 122. The fitted coordinates, cell and Rwp agree with the old chain to
8e-10, 6e-12 Å and 4e-12 relative. What changes is that direction="both" now
judges a coordinate that chains. One that restarted on every pattern could
never have looked path-dependent, whatever the data said.
The degree of freedom's own value is now each pattern's step from the one
before (Upgrading, above). The series' discontinuity and path-dependence checks
skip it and judge the coordinate rows it drives. Judged, that step fired both
checks on a clean both-way run whose coordinate agreed between the chains to
1e-9.
Peaks, contamination and indexing
A contamination flag now means the beam is leaking
diagnose(data, wavelength=...) reported a Kβ or tungsten contamination
whenever any one strong reflection had a weaker line near the position such a
line would occupy. That is not evidence of anything. Whether Kβ reaches the
detector is a property of the optics, so a real leak puts a line at the
predicted position of every strong reflection, all at one ratio, while a
coincidence puts one line somewhere.
Measured on seventeen bundled patterns (the sixteen IUCr round-robin phases and
SRM 660c), each collected behind a graphite diffracted-beam monochromator that
removes both lines: the old rule
flagged 0.94 Kβ per pattern, and a control fed twenty-six wavelengths that are
not an emission line of anything flagged 1.01. Each flag took a real reflection
out of PeakList.usable(), which is the list index_pattern searches. A
public demo notebook showed the same screen returning thirty-four flags on a
pattern whose strongest line has nothing at its Kβ position.
The finding is now joint: five of the eight strongest reflections must carry a
candidate at one common ratio before anything is reported. Those seventeen
patterns now report nothing, on both the channel-census and fitted-list paths,
and so does a neutron pattern whose wavelength happens to match Cu Kα. A Kβ
image injected at 10 % of its parent is still found on all six hosts tried,
with the ratio it was given.
Read ContaminationFlag.leak_ratio, which is new and is the ratio fitted
across the supporting parents. intensity_ratio is still there and is still
one line's. n_parents and n_parents_searched carry how many reflections
supported the finding and how many were in range to be asked. The upper end of
the accepted ratio window moved from 0.6 to 0.25: Hölzer et al. (1997) Table VI
puts an unfiltered tube at about 0.14, so 0.6 was admitting four times what a
tube can produce.
The detection floor is about 10 %, and how far below depends on how many
peaks the pattern yields. Zincite is caught at 1 %, magnetite at 22 usable
peaks not until 10 %. A residual leak past a working filter is below that and
comes back as nothing, so an empty contamination list means "no leak this
rule can see" and never "the beam is clean". That was true in 1.5.0 too, and the list is
now usually empty.
An instrument can say what stops Kβ
A contamination screen cannot tell from a pattern whether the beam can carry Kβ. Source.kbeta is None (undeclared, and the screen runs as in 1.5.0), "filter", "monochromator" or "mirror". A neutron source and "monochromator" skip the Kβ and tungsten searches. A filter or mirror is recorded and skips nothing, since the screen still found an image injected at 2 % of Kα on corundum and zincite (6 to 8 lines at r = 0.14, 0.10, 0.05 and 0.02). Instrument.bragg_brentano(monochromator_two_theta=) sets it. diagnose, flag_ghosts, pick_peaks and auto_background take source=. The xrdml reader records the optics, and the import wizard fills kbeta from a diffracted-beam monochromator, a filter or a mirror. A monochromator before the sample leaves it undeclared. The brml and rasx readers do not read optics yet.
A peak the fit never located leaves the peak list
Separately, and found because the change above stopped hiding it: the peak
fitter can return a component and report its position as uncertain by more than
the whole 2θ axis. On the GSAS-II fluorapatite tutorial pattern an unresolved
shoulder at 64.330° comes back at ±1 961° against a 115° measurement.
Nothing read that, so the cell search used the line, and the indexed cell sat
1 376 ppm from the cross-code reference.
PeakFlag gains position_unmeasured, raised when the fitted position esd
reaches 180°, and it is in PEAK_UNUSABLE_FLAGS, so such a line stays in
PeakList.peaks (a report must be able to say why a line went) and leaves
usable(). INDEXING_THRESHOLDS_VERSION is 1.4 for it, because
pick_peaks answers differently on any pattern carrying one.
Measured over 1 165 usable lines from seventeen bundled laboratory patterns:
the largest position esd outside this case is 0.868°, so the bar clears the
next-worst line by 207× and drops exactly one. It is deliberately the weak form
of the rule (a line uncertain by half a pattern still passes), and the
docstring says what the stronger version would cost.
Neither change is reported by an issue: both were found by measuring a screen
against a control. Issues #274 and #275 prompted the WP that led here.
An unfinished indexing search names what stopped it
INDEX_SEARCH_INCOMPLETE says an engine did not exhaust a crystal system, so
its silence there is not evidence. The message blamed the per-system budget
whatever the cause, and suggested raising budget_seconds. An engine also
stops when the domain outgrows a size cap on its grid or its trial
reflections, and there more time changes nothing. On 11-BM NAC the dichotomy
explored no box in 0.26 s, and the message said it had not finished within
300 s.
The message now names the cause for each system. A system its own
per-system budget stopped reads as before. A system that hit a cap reads
"outgrew a size cap on cubic", and its suggestion names what shrinks the cap:
a smaller max_volume, a shorter d-axis range, or a peak list that ends at a
lower angle. A system the run's total_budget_seconds ceiling or a cancel
stopped reads "was stopped on cubic by the run's ceiling or a cancel", and its
suggestion names total_budget_seconds. Neither of the last two suggests
budget_seconds any more. The code, the level and where are unchanged.
A supercell the pattern does not support ranks below the cell inside it
index_pattern could rank a cell above another reported candidate that it is
a supercell of. The figures of merit favour the larger cell by construction,
since it explains every line the smaller one does. On the round-robin brucite
pattern an a × 2 supercell stood first, above the certified cell. On 11-BM NAC
the P description of the I-centred cell stood above it.
Each such pair is now checked. The lines the larger cell adds are counted only
where no space-group extinction could remove them, off every mirror plane and
rotation axis of its lattice. The count is compared with how often a position
with no line still falls inside an observed line's matching window. When the
added lines are seen no more often than that, the larger cell moves directly
below the smaller one. It stays in the list with the refuting caveat
supercell_refuted, and INDEX_SUPERCELL_REFUTED names the smaller cell and
the counts. Nothing else in the order moves, and a check that cannot decide
moves nothing.
CellCandidate.supercell_checks records every pair asked, with the counts,
the chance rate and the p-value. It is None on a candidate nothing asked.
INDEXING_THRESHOLDS_VERSION is 1.5 for it, because the same search now
orders differently wherever such a pair was reported.
Measured on the acceptance suite's finished searches, brucite's and NAC's true
cells now rank first. The certified corundum cell over its own c/2 subcell
has 18 added lines no extinction could remove. 8 of them are seen where chance
puts 2.7, so it keeps its place. Every cell known to be wrong that was tested
this way was refuted.
The dichotomy search runs on a compiled kernel
search_dichotomy's box search now runs on a compiled kernel, beside the peak
kernels a refinement already uses. It searches the same boxes in the same
order, so every search that finishes returns the same candidates as before, bit
for bit. What changes is how long it takes, and that depends on how many free
metric parameters the crystal system has. On a synthetic monoclinic list (four)
the engine takes 9.99-10.02 s where it took 195-206 s. On the round-robin brucite and
corundum patterns (two each) it saves 3-8 %, since most of their time goes to
refining the cells the search finds. Real monoclinic data behaves like the
second case. On the bethanechol benchmark's manual mode every set is cut at its
30 s budget on either path, and both paths score the same. On set F the
compiled search tests 13 % more boxes inside that budget, because once the
search is fast most of the time goes to refining candidates.
RIETX_COMPILED=0 turns it off along with the other kernels, and
features["compiled_kernels_active"] covers it. The first indexing search on a
machine compiles it, in 4.4-4.6 s, before any crystal system's budget starts, and
later processes load it from the same cache in 0.23-0.27 s.
An indexing search spends its time on the cells it finds
Most of a real dichotomy search went to its leaves, and most of that went on
rows that could not matter. Each leaf re-tested every reflection of each
centring and scanned the whole trial set whenever it assigned lines to a cell.
It now works on the rows a leaf's box or cell can reach. Every search that
finishes returns the same candidates as before, bit for bit: cells, line
assignments and the order they come in. This was checked by replaying the
round-robin brucite and corundum searches and a synthetic monoclinic one to
completion. On brucite and corundum's two-parameter crystal systems a search
takes 81-107 s where it took 255-363 s on the same machine, and corundum's
tetragonal search 237 s where it took 794 s. What is left is mostly refining
the cells the search finds. The same trial-set restriction speeds up
trial_error on a large trial set (corundum's hexagonal unit 14.5 s → 6 s).
Merging duplicate candidates is faster on a large harvest, 18.8 s → 2.6 s on
the bethanechol benchmark's set F. Merging distinct lattices is faster too. Its
pairwise χ² tests run as one stacked solve wherever a start-up probe shows that
solve gives each pair's own answer, and every group comes out identical. On
corundum's tetragonal unit the merge takes 6.5-7.4 s where it took 28-30 s.
Duplicate indexing candidates are compared in one frame
index_pattern merges candidates that are the same lattice. Each engine that
reached a merged lattice joins its found_by, and that agreement is what the
grade rests on. The test weighs the difference between two Niggli-reduced
metrics against their joint covariance. The metrics were reduced and the
covariances were left in the setting each engine refined in. The reduction
reorders a setting's components whenever its axes are out of reduced order, as
for a tetragonal cell with c < a or most monoclinic cells. So a difference in
one component was weighed against the precision of another.
Both kinds of error happened. Two monoclinic cells 0.1° apart in β merged as one
lattice. A tetragonal lattice refined twice split in two in 41 % of simulated
pairs. On the bethanechol benchmark's manual mode, each of the 99 passes that
merge duplicates changed at least one group.
Each covariance now goes through the same change of basis as its metric. A pair
already in its reduced setting, such as corundum's hexagonal cell, is compared
exactly as before. On the acceptance suite no candidate at rank 1 or 2 moved and
no grade changed. Candidates graded low reorder at rank 3 and below on five of
its patterns. On bethanechol set Db the true cell drops from rank 1 to rank 2.
The cell above it is wrong, and two engines found it in two settings the old test
could not match, so it now counts as agreed. The manual mode scores −3 where it
scored −2. INDEXING_THRESHOLDS_VERSION is 1.6, since the same search can now
order its candidates differently.
Reading and writing files
Four silent reads of a pattern file now say so
A GSAS file whose BANK line a tool had commented out read as a
two/three-column file (#230).
Its 2θ axis came back in centidegrees, 50-4399.6° for a measurement that ran
0.5-43.996°, with the same point count and no diagnostic.
#266 found two more silent
reads in the two/three-column reader. A numeric header row parsed on its first
three tokens and became a point at (0, 1). A constant third column became σ.
Each now says so on the diagnostics= list read_pattern takes:
- A
BANKline behind a#is read as the bank record where the file has no
live one, and reportsGSAS_BANK_COMMENTED. The two copies #230 compared
now read the same axis. - The x axis is checked for every format. Past 180° it raises, naming the
file, the reader and the range. When the two/three-column reader took the
file, it also gives the ÷100 reading where that lands in range. At or below
0° it reads and reportsPATTERN_X_AXIS_IMPLAUSIBLE. - The two/three-column reader keeps a row only at the file's most common
column count, and reports the rest by line asPATTERN_ROWS_DROPPED. A row
cut short no longer strips σ from every other row, as the old minimum column
count did. - A σ equal on every point is kept and reports
PATTERN_SIGMA_CONSTANT, for
every format that reads one. A PDFgetX2.sqfile has a constant 1.0 in the
column the two/three-column reader takes.
None of the 42 patterns in the test suite's data gains one of these codes.
Their axes run from 0.4995° to 167.75°.
Three more reads say what they did:
- A GSAS
.EXPor.prmfield that is written but is not a number is refused
with the file, record and columns. A field of asterisks is Fortran's
overflow: a required one is refused as such, and an optional one reads as
NonewithGSAS_FIELD_OVERFLOW. - A σ column is floored at a thousandth of its own median esd, so a
normalised pattern keeps its esds (#650). Structure.from_cifandStructure.to_ciftake apathlib.Path, where 1.5.0
raisedTypeError.
A published Biso outside 0 to 25 Ų no longer refuses the file
Every structure reader gave biso bounds of 0 to 25 Ų, and one site outside them refused the whole file. COD 4335638 carries a C at U_iso 0.34 Ų, a B_iso of 26.8 Ų, and two COD lead iodides carry riding H at 0.35 Ų and above. FullProf, GSAS, GSAS-II and TOPAS files store negative refined B, which their readers refused as well.
The CIF, recipe, FullProf, GSAS, GSAS-II and TOPAS readers now keep the value and widen the bound to it, with no headroom past it. A freed B can move back toward the usual range and no further, so a fit that wants more reports BOUND_HIT. Each file reports the sites it widened as BISO_BOUND_WIDENED (warning), naming a negative B as one. A fit that finishes with a negative B reports BISO_NEGATIVE, since the Debye-Waller factor then grows with sinθ/λ and the column is standing in for something else, usually absorption, a wrong species or occupancy, or a background that bends at high angle. The FullProf, GSAS and TOPAS writers write a negative B back, so it round-trips. Atom.biso itself keeps 0 to 25 Ų, and a value you give outside it still raises.
A neutron fit estimates its own specimen absorption
1.5.0 declined to estimate Geometry.mu_r or mu_t on a neutron instrument, because the X-ray table is the wrong quantity. Neutron attenuation is σ_abs(λ) + σ_coh + σ_inc, with σ_abs linear in λ and hydrogen among the strongest attenuators. A constant-wavelength neutron source now estimates both from the Sears table (rietx.estimate_mu_r, and the automatic estimate at fit time). A source with no table still declines and says why. A resonant absorber (Cd, Sm, Eu, Gd, Yb) is refused with ABSORPTION_ESTIMATE_UNAVAILABLE. On the bundled Ca-Al-Na fluoride CIF (cod_1000236) at 3 mm radius and packing 0.6, µR is 0.052 at 2.4067 Å and 32 at 1.5406 Å for X-rays.
The Brindley particle-absorption correction of particle_radius_um used the X-ray µ whatever the source. On a neutron histogram a correction well under 1 % used a µ two to four orders too large, and the reporter's NaCl + W mixture moved one fraction from 0.887 to 0.002 (#543). Each histogram of a joint fit now reads its own table. A species written as a nuclide (D, 2H, 7Li) no longer stops QPA, and 2H weighs 2.0141.
Neutron files and tables, five changes
b_Sears.datkept the uncertainty digits NIST prints in brackets as decimals (58Fe "15.(7.)" became 15.7). 245 cells in 131 rows are corrected (#644). Natural-element coherent lengths are unchanged except He (3.263 to 3.26 fm) and Ra (10.01 to 10.0). Isotope lengths moved by up to 12 % (144Sm -3.4 to -3, 58Fe 4.5 %). An element's cross-sections moved by at most 2.3 % (Ra, 13.3 to 13 barn) and its absorption by at most 0.5 % (Tc, 20.1 to 20 barn), which reaches only the µR estimate. The calculated pattern of a natural-abundance neutron fit moves only through He and Ra.NEUTRON_RESONANT_ABSORBERquotes the lowest resonance of 113Cd, 149Sm, 151Eu, 155Gd, 157Gd and 168Yb (ENDF/B-VIII.0) as an energy and a wavelength beside the instrument's.read_gsas_prmreads a type-3 PNCR file ontoInstrument.constant_wavelength_neutron(#437).read_recipebuilds a GSAS-IIPNCrecipe as a neutron instrument (#271).- The neutron preset builds
ProfileTCHZ.coarse()widths, sofwhm_deg=1.2builds where 1.5.0 raised. A bare wide width still refuses by name (#276). - A joint fit lists a shared parameter once in
StageResult.freed.
An isotope or an ion reaches another program spelled as it reads it
A species an X-ray lookup could not parse stopped compilation: D, 2H, 7Li and 7Li1+ were refused on any X-ray instrument, so a deuterated structure could not enter a joint X-ray and neutron fit (#552). Every X-ray lookup now reads an isotope as its element. A CIF site labelled D1 reads as D.
The writers had the opposite fault. Each copied rietx's own spelling, which the target program reads as something else. All four now spell the species as the program does, or refuse by name:
- TOPAS stops on
O2-and7Li1+.write_topas_inpwritesO-2and7Li+1, and the reader maps them back (#550). - GSAS-II turns
7Li,2Hand60Niinto H andCu+into C when it imports a CIF.write_gsas2_phase_cifwrites2HasDand reportsGSAS2_CIF_DEUTERIUM_AS_D, naming GSAS-II's b (6.681 fm) beside Sears's (6.671 fm). It refuses any other isotope (#553). - A GSAS
.EXPtypes an atomaasv_nnn, as inNI+2_58. The reader took that as a "+258" ion of natural Ni. It now reads 58Ni2+ and writes the same spelling back (#555). read_gsas2_gpxbuilds the isotope a phase chose inGeneral['Isotope']. A deuterated project read back as natural H (#554).- A digitless ion such as
Cu+is refused by every writer, since no spelling states rietx's reading of it.
A .pcr that FullProf runs
FullProf stopped on every file write_fullprof_pcr wrote, on U = V = W = 0 with no resolution file (#557), and then on rietx's species spelling (#558). The writer now writes a Thompson-Cox-Hastings profile with non-zero widths. Pass instrument= for its U, V, W, wavelengths and each phase's sample terms, or get a default profile and Cu Kα. Species follow FullProf's tables: ZR+4, O-2 for X-rays and the bare element for neutrons. A neutron isotope is a LINE-12 user scattering length (LI7, -2.22 fm), and read_fullprof_pcr reads it back as the isotope. An X-ray file carries rietx's f′ and f″ in LINE 12, because FullProf's own differ (Fe at 1.85 Å: -2.095 and 0.566 against -2.548 and 0.521).
The writer refuses what the file cannot state, naming the field: a site with occ != 1, a zero shift, displacement, absorption, roughness, extinction or preferred orientation away from its identity, a Stephens block, axial divergence, harmonics, an exact Voigt shape, an isotope on an X-ray file, and dispersion=None on an X-ray file. A f′/f″ pair in a file that differs from Cromer-Liberman by over 0.01 e is refused on read for the same reason. FullProf 8.20 ran the writer's output as a black box.
The TOPAS reader says what it did not read
read_topas_inp now reports each of these where 1.5.0 read on in silence.
- A dataset opened by a data macro (
RAW,XY,XYE,DAT,BRML,SST) counts. Two such datasets no longer build into one structure (#616). - A peak shape, size, strain, texture, 2θ or absorption term written as a library macro (
TCHZ_Peak_Type,CS_L,Zero_Error) is named inTOPAS_FEATURES_NOT_IMPORTED(#649). - A call to a name the file never defines is named in a second
TOPAS_FEATURES_NOT_IMPORTEDand incoverage.unread_calls(#651). It can also name a real TOPAS macro the reader has no row for (LP_Factor). - A held
bkglist reports its length inTopasModel.background_termsand whether any is refined inbackground_refined(#652). - A time-of-flight dataset is recorded on
TopasModel.time_of_flight, reported asTOPAS_FEATURE_REFUSEDand refused byto_structure(#193). - A
strblock skipped for lacking aphase_nameorspace_groupsays which line would make it a phase.
It also reads more. for xdds and for strs [N to M] loops expand, on rules measured against TOPAS 6. STR(sg) and STR(sg, name) phases read. #prm, #if, #elseif and #out are evaluated. A file whose #if tests Run_Number while num_runs states more than one run reads as run 0 and reports TOPAS_FIRST_RUN_READ. Four files read this way stop at to_structure, because their phases are rigid bodies.
Figures, the GUI and the watcher
A pattern can be drawn before any model exists
1.5.0 drew only results. A pattern just read from a file had no figure of its own. rx.viz.plot_pattern(data) and PatternData.plot() now draw it in the style of the result panel, with the same margins, intensity axis and keywords (two_theta_range, x_axis, wavelength, y_scale, style, figsize, font_size, dpi), so a before and after pair lines up. σ is not drawn. excluded_regions are shaded and their channels stay drawn, since they are a measurement the next fit will not use. Q and d axes, and λ on the 2θ axis, need wavelength=. plot_result, plot_pattern and plot_trajectory also take title=.
A picture of the structure from Python
rietx.viz.render_structure(structure) draws one phase as the GUI's structure
viewer draws it, and returns the picture as an array. path= writes
a PNG. It needs no browser, no display and no new dependency. The balls, the
ellipsoids with their principal rings, the two-tone bonds, the polyhedra, the
cell frame and the a, b, c letters are the viewer's own. A Python test replays
the viewer's scene rules against a committed corpus, so the two stay equal.
A view is named the way a crystallographer names one: "a", "b" or "c",
a direction [u, v, w], a plane normal {"hkl": (h, k, l)}, or a rotation,
with up= and an ASE-style turn="30y,-15x". The figure carries the rotation
it drew, and passing that back draws the same picture. It also carries each
atom's and each letter's position in pixels. On an Apple M4, NAC at 1000 px
takes 33-40 ms warm. The first call in a process compiles for about 1.5 s.
One change reaches the GUI. Its b button now keeps c up, as the a button
does, where it kept a up. That is the convention VESTA's standard orientation
sets, and render_structure uses the same one. The function is provisional by
declaration, because it follows the viewer.
A structure figure that says what it left out
render_structure raises on a cell past the atom cap and names the count to
pass as max_atoms. build still trims a cell for the GUI's viewer, and its
dict now counts what the cap left out in cut. The figure's report and its
warnings repeat that count. A polyhedron lists every one of its own bonds, so
no stick is drawn through its faces. Site labels take the first of eight
places clear of atoms and bonds, and the report counts any that could not.
Four arguments replace what an agent patched around.
cell=False drops the frame and fits the view to the atoms. stick=0.5
halves the sticks. keep(..., complete="polyhedra") completes a window's
polyhedra without the far ends of its cut bonds. fig.to_px maps Å to the
picture's pixels for a legend, axis triad or scale bar drawn beside it, and
examples/structure_furniture.py draws all three. The report's stacked
is the part of hidden that sits behind a copy of the same site, which a
view down a cell axis does by construction.
Parts of a structure figure, a view that hides least, and a report
A figure can show part of a structure. rietx.viz.select(geometry, element=, species=, label=, site=), plane(geometry, hkl, distance), sphere(geometry, centre, radius) and component(geometry, atom) return a boolean mask over the atoms of rietx.gui.structure3d.build's dict. keep(geometry, mask, complete=) returns a consistent dict with only those atoms. complete=True re-adds the far ends of cut bonds and the vertices of kept polyhedra, "polyhedra" the vertices alone and "bonds" the far ends alone. On NAC, keep on the 15 Na atoms with complete=True leaves 66 atoms, and its note says 26 polyhedra cut · 81 bonds cut. recolour(geometry, mask, colour) recolours the masked atoms and their polyhedra. periodicity(geometry, mask) returns 0 to 3, the lattice directions the kept atoms repeat in. build(structure, extent=((0, 2), (0, 2), (0, 1))) draws a block of cells and raises past max_atoms. Each atom carries image, its orbit index and lattice translation.
render_structure(structure, view="auto") draws the low-index direction, indices up to 2, that hides the fewest atoms and leaves the least of the frame empty, and figure.candidates holds the runners-up. figure.report says what the picture hides and cannot show: hidden, stacked, dangling_bonds, the label overlaps, empty and cut. figure.recipe is the call that redraws the picture bit for bit. A single cell draws no polyhedron-centre atom without its polyhedron, and hidden= stubs count in dangling_bonds (39 for the Na of NAC).
The GUI's pattern plot holds every channel
The pattern plot in rietx gui draws with uPlot, where it drew with plotly. It receives every channel of the pattern once and zooms in the
browser, so a zoom asks the server for nothing and a zoomed view shows every
point the file holds. Under plotly each zoom refetched a decimated window. A
drag-zoom now costs the page 3.9-4.4 ms of work an event, against 8.2-9.3 ms
under plotly on the same machine, and a resize 1.5-3.5 ms against 11-17 ms.
Two gestures are new. Scroll zooms about the pointer, and shift-scroll or
alt-drag pans. Double-click still returns the whole pattern. The readout strip,
the peak gestures and the range and exclude modes work as before. A pattern
past 150 000 channels arrives as a min/max sample, and the line under the plot
says so.
GET /api/result/window is gone. GET /api/result/curves sends the pattern and
the fit's curves as float64 arrays instead. The GUI's routes are provisional by
declaration, so the old one goes without a deprecation.
The Series panel draws with uPlot too. A trajectory is drawn in the order the
chain ran, so a heat-then-cool series comes back along its own axis, and
pointing at a point names its pattern, coordinate and value. A pattern's own
fit comes through GET /api/series/curves, and GET /api/series/window is
gone the same way.
rietx watch draws with the same chart
The plot in rietx watch is now the GUI's pattern chart, drawn with uPlot. It takes the same gestures. Drag to zoom, or scroll to zoom about
the pointer. Shift-scroll or alt-drag pans, and a double-click shows the whole
pattern. The legend is the page's own. Clicking an entry hides that curve, and
a stage landing leaves it hidden. Pointing at a tick still names the
reflection.
The watcher no longer needs plotly. It serves the chart out of the installed
package, so a base install draws the picture. It used to print
pip install 'rietx[viz]' in its place. The /plotly.js route is gone, and
/rxplot.mjs, /uPlot.iife.min.js and /uPlot.min.css serve the chart. The
watcher's routes are provisional by declaration, so the old one goes without a
deprecation.
The GUI's 3D view draws with its own renderer
The structure viewer in rietx gui no longer draws with plotly. It
draws each atom and bond as the exact sphere, ellipsoid or cylinder it is, on
the GPU through WebGL2. A surface stays smooth at any zoom. On an Apple M4 the
Model tab reached a drawn picture in 395-619 ms in Chromium, against 1963-4771
ms under plotly on the same machine.
In ellipsoid mode each anisotropic site also shows its three principal
ellipses, the rings of an ORTEP drawing. An isotropic site shows none. Where
two displacements are equal, as on a site uniaxial by symmetry, two of the
rings are free to turn round the third axis. One of them is drawn through a
lattice vector, so every machine draws them alike. The line under the picture names the atom or bond under the pointer. Shift-drag or
right-drag pans, and scrolling zooms. PNG renders the picture again at 3000
pixels on its long side, and transparent PNG leaves the background out.
No GUI page loads plotly now, so the gui extra installs nothing. It is kept,
so pip install 'rietx[gui]' still works. The GUI's /plotly.js route is
gone. Its routes are provisional by declaration, so it goes without a
deprecation.
The GUI's 3D view draws coordination polyhedra
Ball mode draws the coordination polyhedra around each cation. A
centre is a metal, or a non-metal bonded to a more electronegative one, as Si
is in SiO₄. A ligand is any other non-metal except hydrogen. The shell ends at
the largest jump in the ligand distances, as Brunner & Schwarzenbach (1971)
draw it. Shells of four to six ligands are drawn by default and larger ones
start switched off. On 21 test phases the default draws the tetrahedra and
octahedra and nothing else.
The row under the species legend holds a polyhedra switch and one button per
formula, such as AlF₆. The switch is held per mode, so polyhedra start off in
ellipsoid mode. Pointing at a face names the polyhedron, its ligand count, its
mean distance and its gap.
The sticks change with it. No stick joins a metal to a cation, so forsterite
loses its 36 Mg–Si sticks. Two non-metals closer than 0.7 times their radius
sum are read as one atom split over two positions, so high cristobalite's
split O positions lose their O–O sticks.
/api/structure3d carries a polyhedra arm, and each atom a vertex_only
flag. Its routes are provisional by declaration.
The 3D view reads cyanides, split oxyanions and disorder groups
A cyanide's or a carbonyl's C is now its metal's ligand. It was
read as a cation, and Cu₃[Co(CN)₆]₂ drew CoN₆ from the N 3.03 Å out. A
non-metal bonded to a metal and to one more electronegative atom is a ligand,
and an atom bonded to one of the centre's own ligands and lying behind it is
left out of the shell. Prussian blue's C-bonded iron draws FeC₆. The default
picture on the 21 test phases is unchanged.
Two partly occupied non-metals lose their stick when they sit closer to each
other than to an atom both are bonded to. A disordered nitrate's split O
positions drew O–O sticks until this.
Atom.disorder_assembly and Atom.disorder_group carry the CIF's two
disorder items. structure_from_cif reads them and Structure.to_cif writes
them, and nothing in the fit reads them. The viewer draws no stick and no
polyhedron across two groups of one assembly. major alternative only, under
drawing, draws each assembly's most occupied group alone.
SCHEMA_VERSION 0.33 → 0.34, for the two fields. They default to None,
so every stored document loads unchanged.
Pointing at a polyhedron names a second gap when it is nearly as large as
the one that closed the shell, on Brunner & Schwarzenbach's own scale of
"approximately equal". None of the 21 test phases has one, and an ionic
conductor's large cation often does.
The rule that picks centres and corners can be overridden, as Mercury's two
element lists override its own. The round and corners rows under
drawing take any element, so an anion-centred FCa₄ or an intermetallic's
environments can be asked for. A double-click on an atom draws its environment
alone, its shell among every element.
A formula whose polyhedra would take the picture past the 400-atom cap keeps
its legend button, greyed out. /api/structure3d carries seven new arms
(polyhedra_dropped, disorder, minor_sites, centres, ligands,
centre_elements and ligand_elements), each polyhedron a rival, and takes
disorder, centres and ligands query parameters. Its routes are provisional by declaration.
rietx compare draws with the same chart
The page rietx compare serves draws with uPlot, where it drew with plotly. Its three panes share one 2θ axis and take the GUI's gestures. The
variant list is the legend. Each variant shows the colour it is drawn in, and
unticking one hides it in every pane. The line above the panes reads each
variant's value at the pointer, and pointing at a tick names the reflection.
The Δχ² against the reference is now a subtraction, channel for channel. It
was a linear interpolation between two grids decimated separately. Every
variant of a standard fits the same channels, and a test holds the registry to
that. The page draws every fitted channel, up to the 150 000 the GUI's chart
takes.
The page no longer needs plotly, so a base install draws it. Each variant's
curves come once from GET /api/curves as float64 arrays, and GET /api/state no longer carries them. A failed variant used to stop the page,
because its statistics went out as NaN, which no browser parses. They go out
as null now, and the variant's row shows the error. The /plotly.js route
is gone. compare.run returns its curves as numpy arrays at every channel,
where it returned lists decimated to 4000 points.
The page write_html writes draws with the same chart
The file write_html and rietx html write is now the GUI's pattern chart,
drawn with uPlot. It takes the same gestures, and clicking a legend
entry hides that curve. The line over the chart reads the channel under the
pointer. Over the ticks it names the reflection. The difference now has its own
pane under the ticks, where it was drawn offset below the pattern.
weighted=True still draws Δ/σ with its ±3σ band.
The file needs no plotly, so the viz extra installs matplotlib alone. The
GUI's html export now works on a base install. It used to answer 409 naming
the viz extra. On the NAC example the file is 1.23 MB, against 6.49 MB with
plotly, and draws 80-87 ms after it starts loading, against 521-601 ms.
Past 150 000 channels the curves arrive as a min/max sample, as the GUI's do.
max_points still sets that budget, and its default was 200 000. The sample
now keeps the extremes of the raw difference too. The file draws that
difference by default, and so does the GUI's Δ view. Before, its deepest misfit
could be dropped: on a synthetic pattern sampled to 600 channels it read −363
where the pattern holds −391.
Every chart saves and copies what it shows
Each browser chart now has four exports. PNG saves the picture as
drawn. SVG saves it redrawn as vectors. copy image puts the picture on the
clipboard, and copy data copies the channels in view as tab-separated columns
a spreadsheet pastes. All four act on the view the reader has zoomed to. They
sit under the GUI's pattern and Series charts, in the header of the file
write_html writes, in an Export section on the rietx compare page, and
behind export in the rietx watch bar. They replace plotly's camera button.
The legend is not in either picture, because every page draws it as text over
the chart.
The SVG export draws through svgcanvas. It is vendored beside uPlot and
fetched on a page's first SVG. rietx watch and rietx compare serve it as
/svgcanvas.esm.js, and the written file carries it inline. The line under the
pointer is now solid in every chart. The rietx compare page had drawn it
dashed.
Provenance
A checkout stamps the version it runs
rietx.__version__ came from the installed metadata alone. So did the version
on every result's provenance, history header, project and run record. An
editable install writes that metadata once, when it is installed. A checkout
bumped since its last reinstall therefore stamped the older number, and
nothing said so. One agent session left 887 run records and a report saying
1.4.0, about code whose pyproject.toml said 1.6.0.dev0.
When the package is imported from a source tree whose pyproject.toml
disagrees with the installed metadata, the stamp is now the source version
with the commit as a local label. That is 1.6.0.dev0+g followed by twelve hex
digits of the commit, with .dirty added when a tracked file differs from it.
When git cannot name the commit, the stamp is the bare source version. Either
way, a RuntimeWarning at import names both versions. A wheel install, and an
editable install whose metadata agrees with its source, stamp exactly what
they did before.