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>
65 lines
2.8 KiB
C++
65 lines
2.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 <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "JFJochReader.h"
|
|
#include "XTC.h"
|
|
|
|
// Reads serial-crystallography stills straight from LCLS-I XTC files: one camera image per event,
|
|
// from a single-panel detector such as the Rayonix CCDs at MFX and XPP. A multi-panel detector
|
|
// (CSPAD, ePix, JUNGFRAU at LCLS) is stored as raw per-module data with its own calibration, and is
|
|
// not read here.
|
|
//
|
|
// What the XTC states is used: the photon energy of every event's electron-beam record (the run is
|
|
// read at their mean) and, for a Rayonix, the pixel size from its model and binning. The distance is
|
|
// not recorded, and the beam centre is not either: the panel is placed square-on with its middle on
|
|
// the beam, the run measures the centre, and the distance (and whatever the XTC did not state) is
|
|
// given on the command line.
|
|
//
|
|
// The images are stills: no goniometer. Each is decoded on demand, the camera's stated pixel offset
|
|
// taken off. A damaged or compressed image is left out, and so is an event the file ends inside.
|
|
class JFJochXTCReader : public JFJochReader {
|
|
std::vector<xtc::Frame> frames_;
|
|
std::shared_ptr<JFJochReaderDataset> dataset_;
|
|
std::optional<double> photon_energy_eV_;
|
|
std::optional<double> pixel_um_;
|
|
float adu_per_photon_ = 1.0f;
|
|
bool counts_in_photons_ = false;
|
|
|
|
bool LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset,
|
|
DataMessage &message,
|
|
std::vector<uint8_t> &buffer,
|
|
int64_t image_number,
|
|
bool update_dataset) override;
|
|
|
|
template <class Buffer>
|
|
CompressedImage DecodeInto(int64_t image_number, Buffer &buffer, std::vector<uint8_t> &scratch) const;
|
|
|
|
public:
|
|
~JFJochXTCReader() override = default;
|
|
|
|
static bool CanRead(const std::string &path);
|
|
|
|
// The event streams, read in the order given, their frames one after another.
|
|
void ReadFiles(const std::vector<std::string> &streams);
|
|
|
|
// What the XTC stated; anything it did not is the caller's to give.
|
|
[[nodiscard]] bool HasWavelength() const { return photon_energy_eV_.has_value(); }
|
|
[[nodiscard]] bool HasPixelSize() const { return pixel_um_.has_value(); }
|
|
|
|
// Converts to photons with this gain from here on (detector units per photon).
|
|
void ApplyGain(float adu_per_photon);
|
|
[[nodiscard]] bool CountsInPhotons() const { return counts_in_photons_; }
|
|
|
|
[[nodiscard]] uint64_t GetNumberOfImages() const override;
|
|
void Close() override;
|
|
|
|
bool ReadRawImage(int64_t image_number, JFJochReaderRawImage &image) override;
|
|
[[nodiscard]] std::vector<SpotToSave> ReadSpots(int64_t image) const override;
|
|
};
|