Build Packages / Build documentation (push) Successful in 48s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 15m47s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 23m19s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 18m47s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m54s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m27s
Build Packages / Unit tests (push) Successful in 1h50m25s
Build Packages / Validation Battery (push) Successful in 46m38s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 32m52s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 32m32s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 28m34s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 29m19s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 30m11s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 33m58s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 31m26s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 34m4s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 26m59s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 31m50s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 32m17s
Build Packages / Generate python client (push) Successful in 32s
Build Packages / Create release (push) Successful in 9s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 19m38s
* jfjoch_broker (experimental): Live Rugnux covers serial collections from DECTRIS detectors; a rotation collection too large for the image buffer falls back to standard per-image processing with a warning, and a stream that ends without its end message finishes the collection instead of hanging it. * jfjoch_broker (experimental): Live Rugnux settings to build the solvent during refinement and to process a rotation collection as stills, a Clear action for the last result, a `_report.txt` for live rotation runs, R-free reported for the refined model, and ice-ring detection on by default for rotation as in the command line. * jfjoch_broker (experimental): More complete and reproducible live serial merges, analysed for twinning, pseudo-translation and anisotropy, with merging statistics by resolution shell in the live status. * jfjoch_writer: Live results with large models are written reliably; update jfjoch_writer together with jfjoch_broker. * Rugnux: Several masters can be processed together with `--force-still`, including grid scans; more robust and faster merging of several sweeps; improved twinning, pseudo-translation, anisotropy, anomalous-signal and space-group decisions. * Rugnux: Molecular replacement places the copies of a multi-copy solution together; the pseudo-translation warning quotes the Patterson peak and is not raised once a model is placed; the report advises on extending the rotation or reorienting the crystal where the coverage would gain from it. * Web frontend: Light and dark modes, a phone layout, a hideable page list, a redesigned Rugnux live page with step-through of the Fo-Fc peaks in the structure view. * jfjoch_viewer: A broker URL given on the command line follows the running collection. Reviewed-on: #97 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
68 lines
4.0 KiB
C++
68 lines
4.0 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <cmath>
|
|
#include <vector>
|
|
|
|
#include "../../common/Reflection.h"
|
|
|
|
// Ice seen in the merged intensities, whatever the images said.
|
|
//
|
|
// A powder ring that the image-side gate did not catch - too weak for the radial profile, or diffuse -
|
|
// still leaves its mark on the integrated reflections: those on the ring come out too strong, since
|
|
// the ring under a spot is not what the background annulus beside it measures. The mark is narrow in
|
|
// resolution, so each ring's core (|q - q_ring| < ICE_INTENSITY_CORE_Q) and its flanks (out to
|
|
// ICE_INTENSITY_BAND_Q) are compared with a Wilson line fitted to the off-ring reflections within
|
|
// ICE_INTENSITY_WINDOW_Q of it only: anisotropy and the curvature of the Wilson plot cancel over so
|
|
// short a span, which is what a z-score against a whole-dataset Wilson curve (xtriage's ice test)
|
|
// cannot do, and the standard error is the band's own scatter, so a small cell with few reflections per
|
|
// band is not read as ice. The rings are then fitted together as one hypothesis - an additive ring
|
|
// intensity in proportion to the known ice line strengths - twice: the cores against the line, which
|
|
// is the size of the bias, and the cores against their own flanks, which is what decides. A feature of
|
|
// the Wilson plot broader than a ring moves core and flank alike and cancels in the second; a ring,
|
|
// narrower than the flank offset, does not, whichever way the integration bent it (a ring under the
|
|
// spot lifts the core; a ring in the background annulus beside it can as well depress the core and lift
|
|
// the flanks), so the decision is on the contrast's size, not its sign.
|
|
struct IceRingIntensityRing {
|
|
float ring_d = 0.0f; // the ice ring (A)
|
|
float rel = 0.0f; // its relative strength in hexagonal ice
|
|
int n_core = 0; // merged reflections in the ring's core
|
|
int n_flank = 0; // and in its two flanks together
|
|
int n_base = 0; // off-ring reflections the Wilson line was fitted to
|
|
double ratio = 1.0; // mean I / I_expected over the core
|
|
double z = 0.0; // (ratio - 1) / its standard error
|
|
double ratio_flank = 1.0; // the same over the flanks
|
|
double z_flank = 0.0;
|
|
double mean_expected = 0; // the fitted intensity at the core, in the merge's units
|
|
};
|
|
|
|
struct IceRingIntensity {
|
|
std::vector<IceRingIntensityRing> rings; // the rings the merge reaches with enough reflections
|
|
// The ice hypothesis across the rings, ratio_k - 1 = amplitude * rel_k / <I>_k: the cores against
|
|
// the line (the bias) and the cores against their flanks (the contrast, which decides).
|
|
double amplitude = 0.0;
|
|
double amplitude_z = 0.0;
|
|
double contrast = 0.0;
|
|
double contrast_z = 0.0;
|
|
int n_rings = 0; // rings that entered the fits
|
|
[[nodiscard]] bool Detected() const { return n_rings >= 2 && std::fabs(contrast_z) >= ICE_INTENSITY_Z; }
|
|
static constexpr double ICE_INTENSITY_Z = 5.0;
|
|
};
|
|
|
|
constexpr double ICE_INTENSITY_CORE_Q = 0.015; // the core, |q - q_ring| in A^-1
|
|
constexpr double ICE_INTENSITY_BAND_Q = 0.03; // reflections this close to any ring are not baseline
|
|
constexpr double ICE_INTENSITY_WINDOW_Q = 0.15; // the baseline is fitted within this of the ring
|
|
constexpr int ICE_INTENSITY_MIN_CORE = 20;
|
|
constexpr int ICE_INTENSITY_MIN_BASE = 60;
|
|
|
|
// `merged` needs I and d.
|
|
IceRingIntensity MeasureIceRingIntensity(const std::vector<MergedReflection> &merged);
|
|
|
|
// ln <I> against 1/d^2 through eight equal-count shells of `reflections`, each weighted by its own
|
|
// precision, with no I/sigma cut on the shells (a weak dataset has none that would pass one, and its
|
|
// rings still need a line to be read against). False where fewer than three shells have a positive
|
|
// mean.
|
|
bool WilsonLineThrough(const std::vector<MergedReflection> &reflections, double &intercept, double &slope);
|