Build Packages / Create release (push) Successful in 7s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 4m56s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 9m10s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 13m51s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 16m56s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 20m59s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 21m25s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 21m17s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 14m14s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m59s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 25m48s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 15m52s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 19m33s
Build Packages / Generate python client (push) Successful in 29s
Build Packages / Build documentation (push) Successful in 1m19s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m49s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 25m31s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 25m24s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 26m5s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 22m19s
Build Packages / Unit tests (push) Failing after 2h28m24s
Build Packages / Validation Battery (push) Successful in 40m33s
* Rugnux: Processes a collection live while jfjoch_broker writes it (`rugnux <master.h5> <broker URL>`). * Rugnux: Processing starts on the first images and confirms its choices once all are in, so analysis can begin during collection. * Rugnux: Faster processing, especially on servers with several GPUs and CPU sockets and on computers without a GPU (`--no-gpu`, macOS). * Rugnux: Uses much less GPU memory, so large data sets stay on the GPU of smaller cards, and a data set too large for the card is processed on the CPU instead. * Rugnux: On macOS, Bragg integration runs on the Apple GPU. * Rugnux: Better handling of twinning and pseudo-symmetry, with the twin hypothesis written as `<prefix>_twin_<SG>.mtz`, and a wrong `--model` no longer confirms the data or decides the hand. * Rugnux: `--model` accepts predicted (AlphaFold) models and falls back to molecular replacement when the model is not placed as a rigid body (experimental `--mr` forces it), settling space group, hand and twinning and writing a different answer as `<prefix>_mr.mtz`. * Rugnux: Molecular replacement is faster and settles the space group in more cases with several copies in the asymmetric unit. * Rugnux: Deposition-ready mmCIF, a richer report, and numbered steps on the terminal with the full log in `<prefix>_log.txt`; `_P1.mtz`, `--estimate-beam-center` and `--beam-center-search` are removed. * Rugnux: The beam-stop shadow is found correctly on tilted detectors. * Rugnux: Stills files that record a stationary goniometer axis get the default stills geometry refinement. * jfjoch_viewer: "Analyze dataset" uses the same defaults as a bare `rugnux <file>`, and shows the results of processed CBF, marCCD and SMV sweeps. * jfjoch_viewer: The Files panel refreshes on F5 and every few seconds, and the plot type and other selections stay put during live collection. * jfjoch_writer: Memory stays bounded and old data files are closed efficiently on long runs, any failure ends the run in an error state the broker is told about, and the master file appears only after its data files; the ZeroMQ pusher logs when a stalled writer makes it drop images. * Fixes: The TCP image pusher no longer blocks the broker's receiver, GPU out-of-memory failures stop with a clear message, and the XDS plugin masks module and chip edges. --------- Co-authored-by: Filip Leonarski <jungfrau@filips-mac-mini.home> Reviewed-on: #85 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
55 lines
2.9 KiB
C
55 lines
2.9 KiB
C
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
// Where on its rocking curve a rotation frame records a reflection.
|
|
//
|
|
// The rocking curve is a Gaussian in the rotation angle, centred on the exact diffracting condition,
|
|
// and a frame records the part of it inside its own oscillation: [phi - w/2, phi + w/2] in the
|
|
// convention of the rotation predictor, where phi is the frame's offset from that condition and
|
|
// c1 = zeta / (sqrt(2) sigma_M) is the curve's reciprocal width. The flux-weighted centre of that slice
|
|
// is the mean of a truncated normal,
|
|
//
|
|
// c = (exp(-a^2) - exp(-b^2)) / (2 sqrt(pi) c1 p), a = (phi - w/2) c1, b = (phi + w/2) c1,
|
|
//
|
|
// with p the slice's mass - the partiality. A frame whose oscillation straddles the condition
|
|
// symmetrically gets c = 0; one that only catches the curve's tail gets a c of up to several curve
|
|
// widths.
|
|
//
|
|
// It matters because the recorded spot is not fixed on the detector while the crystal rotates through
|
|
// the curve: it walks along its Debye ring, one detector velocity per radian of rotation, and a partial
|
|
// recorded at c sits c times that velocity from the exact-condition position. Measured on rotation
|
|
// data the walk follows this c with slope ~1 (0.9 at high angle, where the r1 centroid it was measured
|
|
// with is truncated least), and at |zeta| < 0.2 it is pixels - the reflection moves nearly tangent to
|
|
// the Ewald sphere, so its curve is wide and the spot travels far along the ring while it lasts.
|
|
|
|
#include <cmath>
|
|
|
|
#ifdef __CUDACC__
|
|
#define ROCKING_SLICE_HD __host__ __device__ inline
|
|
#else
|
|
#define ROCKING_SLICE_HD inline
|
|
#endif
|
|
|
|
// The frame's slice of the rocking curve, (erf(b) - erf(a)) / 2 with a = (phi - w/2) c1, b = (phi + w/2) c1.
|
|
// Where the slice lies in one tail of the curve both erf are near +-1 and their difference cancels to a
|
|
// few float ulps of 1, so the same difference is taken from erfc, which keeps its relative precision there.
|
|
ROCKING_SLICE_HD float RockingSlicePartiality(float phi, float half_wedge, float c1) {
|
|
const float a = (phi - half_wedge) * c1, b = (phi + half_wedge) * c1;
|
|
if (a > 0.0f)
|
|
return (erfcf(a) - erfcf(b)) / 2.0f;
|
|
if (b < 0.0f)
|
|
return (erfcf(-b) - erfcf(-a)) / 2.0f;
|
|
return (erff(b) - erff(a)) / 2.0f;
|
|
}
|
|
|
|
// Flux-weighted centre of the frame's slice of the rocking curve, relative to the exact diffracting
|
|
// condition, in radians of rotation. partiality is the slice's own mass (the caller has it already).
|
|
ROCKING_SLICE_HD float RockingSliceCentroid_rad(float phi, float half_wedge, float c1, float partiality) {
|
|
if (!(partiality > 0.0f) || !(c1 > 0.0f))
|
|
return 0.0f;
|
|
const float a = (phi - half_wedge) * c1, b = (phi + half_wedge) * c1;
|
|
return (expf(-a * a) - expf(-b * b)) / (2.0f * sqrtf(3.14159265f) * c1 * partiality);
|
|
}
|