<a id="diagnostics-series-and-joint-fits"></a>

# Diagnostics: series and joint fits

These codes come from a chain of fits over many patterns, or from one fit over several patterns.
Each section gives the code’s name, what it means and why it fires, its level, and the source files that raise it.
The [diagnostic codes](diagnostics.html.md) page lists every code in one table.

<a id="parametric-form-rejected"></a>

## `PARAMETRIC_FORM_REJECTED`

A parametric equation does not fit its target.

The equation that sets a parameter across the patterns of a joint fit leaves a misfit that freeing the parameter in each pattern would remove. Several equations can also be rejected together when none is rejected alone. The esds of the coefficients assume the form is right, so they are too small. Add the next term to the basis, or narrow the subset to where the form holds.

Level: warning. Raised in [`rietx/multi.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/multi.py).

<a id="parametric-out-of-range"></a>

## `PARAMETRIC_OUT_OF_RANGE`

An equation put a parameter outside its bounds.

A parametric equation sets a parameter, in some patterns, to a value outside that parameter’s own limits. The equation’s coefficients are unbounded, so the limits never constrained the solve. Do not quote the parameter there as a measurement. Narrow the subset to where the form holds, lower the order of the polynomial, or use a basis that stays inside the range.

Level: warning. Raised in [`rietx/multi.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/multi.py).

<a id="parametric-target-unseen"></a>

## `PARAMETRIC_TARGET_UNSEEN`

Equation sets a parameter in unseen patterns.

In some patterns the phase that a parametric equation controls is too weak or absent to be seen. There the parameter’s value and esd come from the equation and not from the data. The test of the form cannot check the equation in those patterns. Quote the equation’s coefficients. If the equation should hold only where it is measured, narrow the subset to the patterns that see the phase.

Level: warning. Raised in [`rietx/multi.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/multi.py).

<a id="sequential-cancelled"></a>

## `SEQUENTIAL_CANCELLED`

The series stopped before the last pattern.

The series was cancelled part way. The pattern being fitted was abandoned and the remaining patterns were never started. The fits that finished are complete and stand on their own. The trajectory is truncated, so its last point is not the end of the ramp. Run the series again to extend it.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-discontinuity"></a>

## `SEQUENTIAL_DISCONTINUITY`

A parameter jumps between two patterns.

A parameter changes between neighbouring patterns by far more than its typical step in the series. Either the specimen changed there, as in a transition or a new phase, or the chain failed and carried the error forward. The trajectory is left as fitted. Check the fits on either side, or refit the pair independently with `verify_discontinuities=True`.

Level: info. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-moment-hold"></a>

## `SEQUENTIAL_MOMENT_HOLD`

A magnetic moment is indistinguishable from none.

In some patterns the refined moment lies within the noise of its own esd. That reads as a moment the data do not support, and says nothing about a small moment. Patterns where the modulus has no esd give no verdict at all. The value shown is the modulus the fit reached. Quote these points as held.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-moment-onset"></a>

## `SEQUENTIAL_MOMENT_ONSET`

The magnetic onset is only a bracket.

The series locates where a moment stops being supported by the data. The result is a bracket between two patterns, set by their spacing. It is no fitted critical point. The bracket is less reliable when the forward and backward chains disagree, when the verdicts switch back and forth, or when the supported side stopped early. Run both directions and compare before you quote a transition value.

Level: warning, set at run time. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-path-check-incomplete"></a>

## `SEQUENTIAL_PATH_CHECK_INCOMPLETE`

The forward and backward comparison was partial.

The check that compares the forward and backward chains either did not run or covered less than the whole series. Zero path-dependent findings is a clean result only when the check ran in full. A chain may have stopped, a pattern may have failed, or a parameter may have had no esd in both chains. Rerun in both directions to completion before you quote per-pattern esds as the uncertainty.

Level: info, warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-path-dependent"></a>

## `SEQUENTIAL_PATH_DEPENDENT`

A trajectory depends on the refinement order.

A parameter takes different values when the series is refined forward and backward, by more than their esds allow. The data alone do not determine it, so the path of the chain decides the value. Its per-pattern esd understates the uncertainty. Hold the parameter, restrain it, or report the spread between the two directions.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-persistent-finding"></a>

## `SEQUENTIAL_PERSISTENT_FINDING`

A per-pattern finding recurs across the series.

The same diagnostic fired in most of the patterns. One occurrence says a pattern has a problem. Most of the series says the model or the plan has it. Refitting the individual patterns reproduces the finding. Change the model or the plan instead. The per-pattern diagnostics carry each occurrence.

Level: set at run time. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-reseed"></a>

## `SEQUENTIAL_RESEED`

A pattern was refitted from the initial model.

The warm start from the neighbouring pattern failed, so this pattern was refitted from the initial model. Its starting values did not come from its neighbour, so it is no evidence that the trajectory is continuous at this point. Check whether the specimen or the model changed there. If the same pattern also carries an outlier or a finding the chain did not recover from, read that first.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-rwp-outlier"></a>

## `SEQUENTIAL_RWP_OUTLIER`

A pattern fits much worse than its neighbours.

Even its best attempt left this pattern’s Rwp well above that of the patterns accepted before it. Compare its GoF and expected Rwp with an accepted neighbour. A higher GoF means the model has been outgrown, by a missing phase or a bad frame. A similar GoF with a higher expected Rwp means fewer counts, and the fit may be sound. If restarts were switched off, a cold start may still help.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-unrecovered"></a>

## `SEQUENTIAL_UNRECOVERED`

A pattern failed every restart.

The fit diverged on this pattern and stayed diverged after every restart the chain tried. Its values are not a measurement, so do not interpolate across it. It seeded no later pattern and was left out of the series median, so its neighbours are unaffected. Fit the pattern on its own to find out why.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="sequential-width-growth"></a>

## `SEQUENTIAL_WIDTH_GROWTH`

A phase width grows as the fit worsens.

A peak-width parameter grew a long way over the series while the goodness of fit rose. A phase broadened that far usually stands in for something the model lacks, such as a second phase, a diffuse signal or a background the function cannot follow. Its width, scale and cell are then unreliable. Fit the pattern at the onset with the missing component added.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="series-pattern-failed"></a>

## `SERIES_PATTERN_FAILED`

A pattern could not be fitted.

Every attempt to fit this pattern raised an error, so it has no entry in the series. The gap is a missing measurement and is not a zero or a held value. The last attempt usually started from the initial model, which points at the pattern itself and clears its neighbour. Fit it on its own and read the error.

Level: warning. Raised in [`rietx/sequential.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/sequential.py).

<a id="size-normalised-across-wavelengths"></a>

## `SIZE_NORMALISED_ACROSS_WAVELENGTHS`

Shared size term scaled across wavelengths.

A size-broadening coefficient scales with wavelength. A joint fit over several wavelengths therefore shares the crystallite size and gives each histogram its own coefficient. The shared value is the coefficient at the first histogram’s wavelength. Nothing is wrong. Read the crystallite size, which is one number for the specimen, instead of the raw coefficient.

Level: info. Raised in [`rietx/multi.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/multi.py).

<a id="stage-freed-nothing"></a>

## `STAGE_FREED_NOTHING`

A stage freed nothing in one histogram.

A refinement stage freed parameters in other histograms of a joint fit and none in this one. The stage’s parameter patterns matched only the other histograms, so this histogram kept its starting values for that stage. Nothing is wrong if it has no such component. Otherwise its parameters go by other names, so widen the patterns or scope the stage to one histogram.

Level: info. Raised in [`rietx/multi.py`](https://github.com/yue-here/rietx/blob/v1.10.0/src/rietx/multi.py).
