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>
78 lines
3.1 KiB
C++
78 lines
3.1 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 <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Where the panels of a stills detector lie and what their pixels are worth, as the XFEL readers
|
|
// gather it from a file's own metadata (or, while it is still read, a CrystFEL geometry file): the
|
|
// panels with their pixel ranges in the stored frame, fast/slow-scan directions and corners, the camera
|
|
// length, the pixel size, the gain and the regions to leave out. The conventions are CrystFEL's - a
|
|
// corner is the very corner of the panel's first pixel, x and y in pixels in the detector plane.
|
|
//
|
|
// Lengths are in pixels, except the camera length, which is held in metres. A value taken from the
|
|
// image files (a camera length or photon energy stated per shot) is kept as its path, with the factor
|
|
// that turns the stored number into the unit held here.
|
|
namespace xfel {
|
|
|
|
// A number stated in the layout, or a path to it in the image file, times scale.
|
|
struct Value {
|
|
std::string path; // empty: value holds the number
|
|
double value = 0;
|
|
double scale = 1; // what one stored unit at path is worth
|
|
};
|
|
|
|
struct Panel {
|
|
std::string name;
|
|
int64_t min_fs = 0, max_fs = 0, min_ss = 0, max_ss = 0; // inclusive, in the stored frame
|
|
double fs_x = 1, fs_y = 0, ss_x = 0, ss_y = 1;
|
|
double corner_x = 0, corner_y = 0;
|
|
double res = 0; // pixels per metre
|
|
std::optional<Value> clen; // metres
|
|
double coffset = 0; // metres
|
|
std::optional<double> adu_per_eV;
|
|
std::optional<double> adu_per_photon;
|
|
std::optional<double> max_adu;
|
|
int64_t mask_edge_pixels = 0;
|
|
bool no_index = false;
|
|
};
|
|
|
|
// A region to leave out: either a pixel range on one panel (or, in the old syntax, on the whole
|
|
// frame), or a box in the laboratory plane, in pixels.
|
|
struct BadRegion {
|
|
std::string panel; // empty: fs/ss are whole-frame coordinates
|
|
bool in_lab = false;
|
|
double min_x = 0, max_x = 0, min_y = 0, max_y = 0;
|
|
int64_t min_fs = 0, max_fs = 0, min_ss = 0, max_ss = 0;
|
|
};
|
|
|
|
// A mask array: a pixel is bad where it has any of bad's bits set, or lacks any of good's - or, with
|
|
// nonzero_good, where the array is zero.
|
|
struct Mask {
|
|
std::string data; // HDF5 path
|
|
std::string file; // file holding it, or empty for the image file itself
|
|
uint32_t good = 0, bad = 0;
|
|
bool nonzero_good = false;
|
|
|
|
[[nodiscard]] bool Bad(uint32_t v) const {
|
|
return (bad != 0 && (v & bad) != 0) || (good != 0 && (v & good) != good) || (nonzero_good && v == 0);
|
|
}
|
|
};
|
|
|
|
struct Layout {
|
|
std::vector<Panel> panels;
|
|
std::vector<BadRegion> bad;
|
|
std::vector<Mask> masks;
|
|
std::string data = "/data/data";
|
|
std::optional<Value> photon_energy; // eV
|
|
std::optional<Value> wavelength; // Angstrom; used where no photon_energy is stated
|
|
// A stored value below, above or at these marks a pixel unusable in that frame.
|
|
std::optional<double> flag_lessthan, flag_morethan, flag_equal;
|
|
};
|
|
|
|
} // namespace xfel
|