Files
Jungfraujoch/reader/JFJochStartMessageReader.h
T
leonarski_f 8261b7354e
Build Packages / Create release (push) Successful in 9s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m8s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m12s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 16m43s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 20m56s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 22m4s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 26m57s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m24s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 27m58s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m29s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 18m23s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 19m55s
Build Packages / Generate python client (push) Successful in 32s
Build Packages / Build documentation (push) Successful in 1m32s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 27m20s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 29m27s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m41s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 34m46s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 37m25s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 35m56s
Build Packages / Unit tests (push) Successful in 2h8m44s
Build Packages / Validation Battery (push) Successful in 33m35s
v1.0.0-rc.176 (#86)
* jfjoch_broker: Optional live Rugnux analysis of DECTRIS rotation collections inside the broker, with merged data, maps and the placed model written beside the master file, the rotation lattice in the scan result, and a "Rugnux live" tab and dashboard row in the web frontend.
* Rugnux: Faster processing, with molecular replacement and model validation spread over several GPUs and run on the Apple GPU on macOS.
* Rugnux: The polarization stated in miniCBF and d*TREK headers is used, twinned crystals' space groups are decided more reliably, and a run that finds no lattice still reports every image.

Reviewed-on: #86
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-10-19 07:03:28 +02:00

62 lines
2.6 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <condition_variable>
#include <mutex>
#include <stdexcept>
#include <string>
#include <vector>
#include "JFJochReader.h"
#include "HDF5ImageSource.h"
// The broker that reported a collection's data files can no longer be heard from, and an image this
// reader was asked for has not been reported: it will never be read.
class LiveCollectionLost : public std::runtime_error {
public:
explicit LiveCollectionLost(const std::string &what) : std::runtime_error(what) {}
};
// The dataset as the start message describes it - the same quantities an HDF5 master states, taken
// from the message the writer wrote it from.
std::shared_ptr<JFJochReaderDataset> DatasetFromStartMessage(const StartMessage &start,
const DiffractionExperiment &defaults);
// Reads a collection while it is being written: the dataset comes from its start message, as the
// broker sends it, and the images straight from the data files - /entry/data/data in each - once the
// broker reports a file closed and renamed into place (FileClosed). A read of an image whose file has
// not been reported waits for it; after Ended it returns false for an image no file holds, and after
// Lost it throws. The master file is never read.
class JFJochStartMessageReader : public JFJochReader {
public:
// master_path: where the collection's master file will be; the data files are next to it.
void Open(const StartMessage &start, const std::string &master_path);
void FileClosed(uint64_t file_number, uint64_t image_count);
void Ended();
void Lost(const std::string &why);
[[nodiscard]] uint64_t GetNumberOfImages() const override;
void Close() override;
bool ReadRawImage(int64_t image_number, JFJochReaderRawImage &image) override;
std::vector<SpotToSave> ReadSpots(int64_t image) const override { return {}; }
private:
bool LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset, DataMessage &message,
std::vector<uint8_t> &buffer, int64_t image_number, bool update_dataset) override;
// Waits until the file of this image is reported; false when the collection ended without it.
bool WaitForImage(int64_t image_number);
HDF5ImageSource image_source_;
uint64_t number_of_images_ = 0;
uint64_t images_per_file_ = 1;
std::mutex m_;
std::condition_variable cv_;
std::vector<int64_t> file_images_; // per data file: images it holds, -1 while not reported
bool ended_ = false;
std::string lost_;
};