Build Packages / Create release (push) Successful in 17s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 4m41s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 20m49s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 13m6s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 23m44s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 7m28s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 11m50s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 14m9s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 16m25s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 15m42s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 20m50s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 20m36s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 22m18s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 23m29s
Build Packages / Generate python client (push) Successful in 30s
Build Packages / Build documentation (push) Successful in 1m10s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 21m38s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 17m8s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 23m10s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 19m16s
Build Packages / Unit tests (push) Successful in 2h8m4s
Build Packages / Validation Battery (push) Successful in 40m53s
* Rugnux: Processes serial crystallography data from XFELs - SACLA (MPCCD), PAL-XFEL and European XFEL (CXI), LCLS (XTC) and SwissFEL Alvra (JUNGFRAU with a CrystFEL module geometry) - with several files or Jungfraujoch master files merged in one run (`rugnux *_master.h5`). * Rugnux: Stills processing takes a known unit cell and space group as a starting point, finds the beam centre (and, with a cell, the detector distance) from the images, detects the saturation level in other facilities' files and refines the placement of individual detector panels. * Rugnux: The stills report gives R_split and CC1/2 from frame half-sets, comparable with CrystFEL. * jfjoch_viewer: Opens the same XFEL file formats. * Validation: A stills battery checks Rugnux against deposited structures from SACLA, PAL-XFEL, LCLS, European XFEL and SwissFEL. * Rugnux: More reliable convergence of rotation scaling, and live molecular replacement starts as soon as the model is uploaded. * jfjoch_broker: Initialize clears the previous dataset's bearer tokens, image buffer and live Rugnux status, and a slow CUDA JIT cache is reported at start. Reviewed-on: #88 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
40 lines
1.8 KiB
C++
40 lines
1.8 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
// Where a detector's pixel values stop, read off the values themselves. The bright tail of a frame -
|
|
// the cores of Bragg peaks - falls off steadily with value; a detector that saturates clips everything
|
|
// beyond its ceiling down to it, so the values pile up just below where they stop. Where each pixel has
|
|
// its own ceiling (an ADC limit less that pixel's dark), the pile-up is a band rather than one value,
|
|
// and its lower edge is where clipping starts. A file's own statement of the limit is often missing
|
|
// or wrong for detectors outside the facility that wrote it.
|
|
namespace saturation_ceiling {
|
|
|
|
// Values are binned on a log scale, BINS_PER_OCTAVE to a factor of two, from FLOOR up: a bin of the
|
|
// tail is then about 1% wide, narrow enough to place the edge, while below FLOOR a bin is narrower
|
|
// than one integer and the counts jump between neighbouring bins for no reason in the data.
|
|
constexpr int BINS_PER_OCTAVE = 64;
|
|
constexpr int64_t FLOOR = 256;
|
|
constexpr int N_BINS = BINS_PER_OCTAVE * 23; // up to 2^31
|
|
// A pile-up bin holds more than RISE times the most any bin in the WINDOW below it held - a tail that
|
|
// only falls never does that - and at least MIN_PIXELS pixel values.
|
|
constexpr double RISE = 2.0;
|
|
constexpr int WINDOW = 8;
|
|
constexpr uint64_t MIN_PIXELS = 50;
|
|
|
|
using Histogram = std::array<uint64_t, N_BINS>;
|
|
|
|
void Add(Histogram &h, const std::vector<int32_t> &values, const std::vector<uint32_t> &mask);
|
|
void Add(Histogram &h, int64_t value);
|
|
|
|
// The lower edge of the lowest bin that rises above the tail below it, if any does.
|
|
std::optional<int64_t> Ceiling(const Histogram &h);
|
|
|
|
} // namespace saturation_ceiling
|