Outputs#
A run gives you two things:
the result dict that
powderline.run()returns, with the tables as pandas DataFrames;files in the output directory: the same tables as reports with fixed names, the output recipe, and the engine’s own files.
Every engine returns the same core keys and writes the same report files. The few exceptions are marked below. What the statistics, the output recipe and the dispositions mean is explained on Results.
The result dict#
result = powderline.run(recipe, "output/")
result["status"], result["rwp"], result["unit_cell_data"]["LaB6"]
Key |
Type |
Value |
|---|---|---|
|
str |
|
|
bool or None |
|
|
str |
|
|
str |
A UUID4 that identifies this run. |
|
float or None |
PowderLine’s uniform Rwp and Rexp over the fit window, in percent. |
|
float or None |
PowderLine’s uniform GoF and reduced χ², dimensionless. |
|
bool |
|
|
dict |
The engine’s own statistics and counts (below). |
|
list of dict |
Structured warnings from validation and from the run (below). |
|
float |
Wall-clock seconds. |
|
str |
Which execution path ran (below). |
|
list of str |
The paths written to the output directory. |
|
dict |
The recipe with the refined values written back (below). |
|
bool |
Whether |
|
DataFrame |
How each value of the output recipe came about (below). |
|
DataFrame |
The observed and calculated pattern (columns). |
|
dict of DataFrame |
Per phase, keyed by phase name: the seven unit-cell rows. |
|
dict of DataFrame |
Per phase, keyed by phase name: the reflection list. |
|
DataFrame |
Every refined parameter with its ESD, by the engine’s names. |
|
DataFrame |
GSAS-II and TOPAS results only. Single-peak fitting: the fitted peaks. Empty otherwise. |
|
DataFrame |
GSAS-II and TOPAS results only. Single-peak fitting: convergence diagnostics per peak. Empty otherwise. |
|
dict or None |
GSAS-II results only. For |
Statistics are None where they are undefined, for example when there are
no degrees of freedom. There is no success key: status is the outcome, and
a failed run raises instead of returning (When a run fails).
Engine details#
engine_details holds what the engine itself reports. The uniform statistics
above are PowderLine’s; these are the engine’s own.
Key |
Engines |
Value |
|---|---|---|
|
all |
The engine and the version that ran. For TOPAS, the declared version. |
|
all |
The number of points in the fit window with a positive weight. |
|
all |
The number of parameters the recipe refines, one per symmetry tie group. |
|
all |
The number of parameters the engine varied. |
|
all |
The engine’s own Rwp. |
|
GSAS-II |
GSAS-II’s own GoF, χ², point count, refinement message and convergence flag. |
|
GSAS-II |
The engine’s console text, after a verbose run that succeeded. |
|
TOPAS |
TOPAS’s own Rexp and GoF, and the |
|
easydiffraction |
The calculator, the peak type and the minimizer. |
|
easydiffraction |
easydiffraction’s own Rexp and reduced χ². |
|
easydiffraction |
lmfit’s success flag, message and iteration count. |
Warnings#
Each warning is a dict:
{"code": "gsasii_broadening_default_applied",
"message": "phase 'LaB6': size_broadening left out, so PowderLine applies ...",
"field_path": "payload.phases.LaB6.peak_broadening.size_broadening"}
codeis one of the warning codes.field_pathis the recipe path the warning refers to, orNone.levelis"warning"or"info". When it is absent, read it as"warning":w.get("level", "warning").
Method#
|
Meaning |
|---|---|
|
GSAS-II ran in the persistent GSAS-II server. |
|
GSAS-II ran in the calling process. |
|
TOPAS ran a refinement, or a simulation. |
|
The TOPAS input was written; TOPAS did not run ( |
|
easydiffraction ran a refinement, or a simulation. |
|
A TOPAS run that failed (only in a failure record). |
|
Nothing ran: the GSAS-II server was disabled, stale or unavailable, and no fallback was allowed (only in a failure record). |
|
Nothing ran (Validate-only summary). |
The output recipe#
output_recipe is a complete recipe with the same schema_name. It is
resolved:
refined values are written back at their recipe paths;
values derived from symmetry are in their exact form;
defaults the gateway applied are stated;
your flags, bounds, controls and data are unchanged.
It is ready to be the input of the next run. It is written to
output_recipe.json, about the size of the input recipe, because it repeats
the data arrays.
PowderLine writes one key into its metadata: powderline_provenance.
Key |
Value |
|---|---|
|
The |
|
The recipe’s schema and engine. |
|
The engine version the run used. For TOPAS, the declared version. |
|
The PowderLine version. |
|
When the recipe was written, in UTC (ISO 8601). |
output_recipe_valid is False when the output recipe does not validate as
written. This happens when an engine returned a value the schema refuses, or a
symmetry tie came back inconsistent. The recipe is still returned and written,
and the warning output_recipe_not_valid says why.
Parameter dispositions#
parameter_dispositions (and parameter_dispositions.csv) has one row per
refinable value of the recipe:
Column |
Value |
|---|---|
|
The recipe path, e.g. |
|
The value in the output recipe and its ESD. |
|
How the value came about (below). |
|
|
The disposition is the first of these that applies:
|
Meaning |
|---|---|
|
PowderLine applied a documented default. |
|
Symmetry fixes the value, or ties it to another. |
|
The refine flag is |
|
The flag is |
|
The engine refined the value. |
Report files#
powderline.run() writes these into the output directory with fixed names,
for every engine:
File |
Contents |
|---|---|
|
Every refined parameter: |
|
|
|
The reflection list: |
|
Tab-separated: |
|
The output recipe. |
|
The dispositions. |
Single-peak fitting adds:
File |
Engine |
Contents |
|---|---|---|
|
GSAS-II |
Each peak’s position, intensity and widths, and whether it converged. |
|
GSAS-II |
Written only when a peak did not converge. |
|
TOPAS |
Each peak’s position, intensity, widths, FWHM and integral breadth, with ESDs. |
Exceptions:
easydiffraction’s CrysFML calculator reports no reflection list, so no
<phase>_peak_list_report.csvis written with it.A GSAS-II simulation or peak fit (
gsasii.spf) writes norefined_parameters.csv. TOPAS and easydiffraction write one with no rows.In a simulation, every unit-cell
esdis0.0.
Note
One run per directory. Before every run, powderline.run() removes the
files in the first table above, the single_peaks_report files and
failure.json from the output directory. It never removes the engine’s own
files. It does this once the recipe has validated and the engine can be
imported, so an invalid recipe or a missing engine leaves the previous
results in place. An engine-version or option error found later, such as an
undeclared TOPAS version, comes after the clearing.
peak_convergence_diagnostics.txt is not removed. It is written only when a
peak has problems, so a copy from an earlier run can remain. Read
result["spf_convergence_diagnostics"] instead.
Unit-cell rows: two vocabularies#
The same cell values appear under two kinds of name:
Where |
Name for the |
|---|---|
|
|
|
|
The report uses the same row names for every engine, so a row stays
self-describing when you concatenate tables from several runs.
powderline.reports.UNIT_CELL_ROW_OF and UNIT_CELL_MEMBER_OF convert
between the two.
refined_parameters.csv uses a third vocabulary on purpose: the engine’s
names (0::A0 in GSAS-II, p1_cell_a in TOPAS, broad_gauss_u in
easydiffraction). It is the engine’s own table, with descriptive_name,
phase_name and atom_name beside each name. parameter_dispositions gives
the same values by recipe path.
Uncertainties (ESD and s.u.)#
Note
PowderLine labels uncertainties esd (estimated standard deviation), the
term the refinement engines use. The quantity is what the IUCr calls the
standard uncertainty (s.u.) (Schwarzenbach et al.,
Acta Cryst. A 51, 565–569 (1995)),
in line with NIST Technical Note 1297
(Taylor & Kuyatt, 1994).
The unit-cell report follows one rule on every engine:
Cell value |
|
|---|---|
Refined, and the engine reported an ESD |
the engine’s ESD |
Fixed by symmetry, or held by its flag |
|
Refined, but the engine reported no ESD |
empty |
Volume, when the engine propagates its ESD (GSAS-II, TOPAS) |
the engine’s ESD |
Volume of a cell with nothing refined |
|
Volume otherwise (easydiffraction) |
empty |
Native artifacts#
Each engine’s own files stay in the output directory beside the reports.
Engine |
Files |
|---|---|
GSAS-II |
|
TOPAS |
|
easydiffraction |
None. The data and structure are handed to the library in memory. |
<base> is the name of the directory above the output directory when the
output directory is called output, and topas otherwise. A base name that
is not ASCII is written as topas, with the warning
topas_base_name_sanitized.
Without a tc.exe, a TOPAS run writes <base>.inp and <base>.xye, plus
output_recipe.json and parameter_dispositions.csv, and returns
status: "generated". This is a normal outcome, not a failure. The output
recipe is the resolved input. Every parameter with a refine flag set has the
disposition requested_not_varied.
When a run fails#
A failed run never returns a result. It raises one of two errors:
Error |
Meaning |
|---|---|
|
The engine ran and failed. |
|
The engine never ran. |
Both carry .reason, a failure reason, and
.result, the failed envelope:
Key |
Value |
|---|---|
|
|
|
As in a result. |
|
The files kept for diagnosis: the engine’s own files written so far, and |
|
|
try:
result = powderline.run(recipe, "output/")
except powderline.EngineExecutionError as e:
print(e.reason) # e.g. "diverged"
print(e.result["failure"]["message"])
powderline.run() also writes the envelope to failure.json in the output
directory, beside the engine’s files. It adds a powderline_provenance block
with schema_name, engine, engine_version, powderline_version, created
and run_id, so a directory found later says what failed. No report file is
written for a failed run.
Validate-only summary#
powderline.run(recipe, output_dir, validate_only=True) and
powderline <recipe.json> --validate-only validate the recipe and write
nothing. The summary has the same keys for every engine:
Key |
Value |
|---|---|
|
|
|
|
|
|
|
|
|
From the recipe. |
|
The number of phases (0 for single-peak fitting). |
|
|
|
The number of parameters the recipe refines. |
|
The structured warnings of validation. |
|
The engine’s own controls: |
|
The resolved recipe, as the engine would receive it, and whether it validates. |
powderline.validate(recipe) is the lighter check: it returns the validated
model and its warnings (Python API).