Files
Jungfraujoch/rugnux/ReportDocument.h
T
leonarski_f 84228bf8be
Build Packages / Create release (push) Successful in 24s
Build Packages / build:viewer:macos-arm64:nocuda (push) Successful in 3m29s
Build Packages / build:rugnux:macos-arm64:nocuda (push) Successful in 2m43s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 8m27s
Build Packages / build:rugnux:linux-x86_64:cuda (push) Successful in 9m53s
Build Packages / build:viewer:linux-x86_64:nocuda (push) Successful in 9m58s
Build Packages / build:viewer:linux-x86_64:cuda (push) Successful in 11m22s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 13m39s
Build Packages / build:viewer:windows-x86_64:nocuda (push) Successful in 18m37s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 16m32s
Build Packages / build:viewer:windows-x86_64:cuda (push) Successful in 24m11s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m30s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 19m3s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 20m23s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 19m41s
Build Packages / Generate python client (push) Successful in 50s
Build Packages / Build documentation (push) Successful in 1m16s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 21m0s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 18m38s
Build Packages / build:rugnux:windows-x86_64:cuda (push) Successful in 14m33s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 17m55s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m50s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 18m38s
Build Packages / Unit tests (push) Successful in 1h46m14s
v1.0.0-rc.173 (#83)
* jfjoch_broker: Optional per-dataset authentication - statistics, images and plots can require a bearer token, which jfjoch_viewer supports.
* jfjoch_viewer: Dark mode and a theme-matched colour scheme, a magnifier panel, and simpler contrast and background controls.
* Rugnux: Multiple performance improvements on GPU and CPU (CPU-only processing up to 40% faster, faster image decoding on ARM), with unchanged results.
* Rugnux: `--model` rigid-body refinement runs on the GPU, and the model-validation check is faster and more reliable.
* Rugnux: Improved scaling and merging - error model, outlier rejection, absorption correction and French-Wilson amplitudes now agree more closely with XDS and ctruncate.
* Rugnux: Improved integration - radial background on powder and ice rings, crowded rotation data keep their reflections, and CPU-only builds integrate large unit cells as GPU builds do.
* Rugnux: More robust detector geometry - measured beam centre, X-ray bandwidth and goniometer rate, and geometry refinement accepted only on significant evidence.
* Rugnux: Merged files are written in the standard setting, or in the setting of a reference MTZ, structure-factor mmCIF or model, with its free-R flags.
* Rugnux: Richer report - ice and powder rings, further lattices, superstructure candidates and mosaicity, with warnings worded as prompts to check.
* Rugnux: Clear error messages when a data set needs more GPU or host memory than is available.

Reviewed-on: #83
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-09-29 15:57:32 +02:00

119 lines
7.3 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <cstdint>
#include <string>
#include <vector>
// One populated result object, rendered more than once.
//
// The report used to be printed as the writer walked the results, which fixed the order of the file
// to the order of the pipeline and made a summary at the top impossible - the warnings that decide
// the verdict are produced by the sections the verdict has to sit above. BuildReportDocument()
// therefore populates this document, and a renderer walks it afterwards: the text renderer in
// ResultReport.cpp reads ONLY from here and prints nothing on its own. A second rendering is a
// second walk over the same document, never a second hand-maintained emitter.
// The TYPE of a pathology, from a closed vocabulary a consumer can switch on, carried beside the
// open free-text description that says what actually happened to this crystal. One code per warning
// PRODUCER: a code appears in PATHOLOGY_FLAGS if and only if its warning fired, so lighting an
// indicator is one grep and needs no prose parsing. Add a producer, add a code here.
namespace PathologyCode {
constexpr const char *NO_LATTICE = "NO_LATTICE"; // nothing indexed
constexpr const char *INDEXING_AMBIGUITY = "INDEXING_AMBIGUITY"; // alternative indexing unresolved
constexpr const char *SYMMETRY_AMBIGUITY = "SYMMETRY_AMBIGUITY"; // the data do not pick a point group
constexpr const char *CENTERING_UNTESTED = "CENTERING_UNTESTED"; // centring from the metric only
constexpr const char *UNUSABLE_MERGE = "UNUSABLE_MERGE"; // the merged data carry no signal
constexpr const char *LOW_COMPLETENESS = "LOW_COMPLETENESS"; // too little of reciprocal space
constexpr const char *SWEEP_GAPS = "SWEEP_GAPS"; // ranges that delivered much less
constexpr const char *GONIO_SCALE = "GONIO_SCALE"; // the stage rotation is mis-scaled
constexpr const char *SPINDLE_CAP = "SPINDLE_CAP"; // the mounting cost unique data
constexpr const char *ANISOTROPY = "ANISOTROPY"; // strongly direction-dependent
constexpr const char *TWINNING = "TWINNING"; // twinning indicated
constexpr const char *MODEL_HAND = "MODEL_HAND"; // data and model in opposite hands
constexpr const char *MODEL_NOT_VALIDATED = "MODEL_NOT_VALIDATED"; // a model was given, not usable
constexpr const char *REFERENCE_MISMATCH = "REFERENCE_MISMATCH"; // the reference MTZ does not match; free flags not inherited
constexpr const char *CANCELLED = "CANCELLED"; // the run did not finish
constexpr const char *RESOLUTION_FIT = "RESOLUTION_FIT"; // the CC1/2 fall-off is not a fall-off
constexpr const char *FLIGHT_PATH = "FLIGHT_PATH"; // the assumed flight-path medium matters here
constexpr const char *PSEUDO_TRANSLATION = "PSEUDO_TRANSLATION"; // translational pseudo-symmetry indicated
// Both warnings under this code say the same thing to a consumer - a translation the cell in use
// does not declare is present in the data, so the centring or the cell is wrong - and differ only
// in how exact it is. ANISOTROPY and RESOLUTION_FIT are already shared this way.
constexpr const char *LATTICE_TRANSLATION = "LATTICE_TRANSLATION"; // a translation the cell does not declare
constexpr const char *HARMONIC_CONTAMINATION = "HARMONIC_CONTAMINATION"; // the beam carries a higher harmonic
constexpr const char *SUPERCELL_POSSIBLE = "SUPERCELL_POSSIBLE"; // Bragg-like intensity at half-integer positions
constexpr const char *MULTIPLE_LATTICES = "MULTIPLE_LATTICES"; // a second lattice carries much of the spot intensity
constexpr const char *GEOMETRY_NOT_CONVERGED = "GEOMETRY_NOT_CONVERGED"; // the geometry walk ran out of rounds
constexpr const char *SCALING_NOT_CONVERGED = "SCALING_NOT_CONVERGED"; // the per-frame scales hit their cap still moving
constexpr const char *POWDER_RINGS = "POWDER_RINGS"; // non-ice powder rings hold many spots
constexpr const char *ICE_RINGS = "ICE_RINGS"; // hexagonal-ice rings hold many spots
}
// A closed type plus an open description. The type is what machinery switches on; the text is what a
// person reads, and it is free-form on purpose - the vocabulary must not have to grow a code every
// time a sentence gains a number.
struct ReportWarning {
std::string code;
std::string text;
// Advisories about the pipeline's own internals rather than about this crystal. They still fire,
// still count in the developer report, and are kept out of the default one - a warning nobody can
// act on is how users learn to skip the warnings.
bool developer_only = false;
};
// A value with its type kept, so a rendering other than text does not have to parse the string back.
// `text` is always the exact spelling the text report prints, because that spelling is the interface.
struct ReportValue {
enum class Type { Text, Integer, Real, Boolean, Enumerated };
Type type = Type::Text;
std::string text;
double real = 0.0;
int64_t integer = 0;
bool boolean = false;
std::vector<std::string> domain; // Enumerated only: the closed vocabulary this value comes from
};
// Content that is a table in every rendering. The pre-formatted text lines and the typed cells carry
// the same content: the text renderer prints the former, another rendering reads the latter.
struct ReportTable {
std::vector<std::string> columns;
std::string text_header;
std::vector<std::string> text_rows;
std::vector<std::vector<ReportValue>> cells;
};
struct ReportEntry {
enum class Kind { Key, Prose, Blank, Table };
Kind kind = Kind::Key;
std::string key; // Key
ReportValue value; // Key
std::string prose; // Prose: a paragraph, already line-wrapped for the text rendering
ReportTable table; // Table
// Written only when the developer report was asked for. The document always holds everything;
// which rendering shows what is the renderer's decision, so nothing is lost by building once.
bool developer_only = false;
// The other half of the same idea: a short paragraph that exists only because the long one it
// summarises was moved out. Printing both would say the same thing twice.
bool default_only = false;
};
struct ReportSection {
std::string title; // empty for the header block, which has no banner of its own
std::vector<ReportEntry> entries;
bool developer_only = false;
};
// The whole report as data. Sections in the order they are written; warnings and the verdict live
// here rather than in a section, because the SUMMARY section is composed from them after every other
// section has been built.
struct ReportDocument {
std::vector<ReportSection> sections;
std::vector<ReportWarning> warnings;
std::string verdict; // closed: OK | WARNINGS | UNUSABLE | FAILED
std::string verdict_text; // one to three sentences, free text
std::vector<std::string> pathology_flags; // PathologyCode::*, deduplicated, in first-seen order
};