Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 30m21s
Build Packages / Build documentation (push) Successful in 45s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 30m22s
Build Packages / Validation Battery (push) Successful in 44m53s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 31m42s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 38m51s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 26m6s
Build Packages / Unit tests (push) Successful in 2h20m32s
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m41s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m37s
Build Packages / Generate python client (push) Successful in 1m3s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m41s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 17m13s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 26m16s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 32m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 30m12s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 30m19s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 33m53s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 33m7s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 35m27s
* jfjoch_broker (experimental): Serial data are merged live, with intermediate results during the collection. * Rugnux: More robust processing of serial data, including CCD detectors. * Rugnux: Parts of a rotation sweep that spoil the merge are removed automatically. * Rugnux: Clearer maps, and anomalous peaks not explained by the model are reported. * Rugnux: SHELX files work with SHELXL; XFEL pulse IDs are kept in `_process.h5`. * Web frontend: Spot-finding settings change only when the user changes them. * Rugnux: Faster processing. Reviewed-on: #94 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
67 lines
2.8 KiB
C++
67 lines
2.8 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "StillsPrePass.h"
|
|
|
|
#include "../common/JFJochException.h"
|
|
#include "../reader/JFJochReader.h"
|
|
#include "../reader/JFJochStartMessageReader.h"
|
|
#include "../rugnux/RugnuxLive.h"
|
|
|
|
namespace {
|
|
// The held images as a collection of their own, numbered from 0 as the collection numbers them.
|
|
class HeldImageReader : public JFJochReader {
|
|
const std::map<int64_t, std::shared_ptr<HeldImage>> &images;
|
|
uint64_t number_of_images;
|
|
|
|
bool LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset, DataMessage &message,
|
|
std::vector<uint8_t> &, int64_t image_number, bool) override {
|
|
const auto it = images.find(image_number);
|
|
if (!dataset || it == images.end())
|
|
return false;
|
|
message = it->second->message;
|
|
return true;
|
|
}
|
|
public:
|
|
HeldImageReader(const StartMessage &start, const std::map<int64_t, std::shared_ptr<HeldImage>> &in_images)
|
|
: images(in_images), number_of_images(in_images.empty() ? 0 : in_images.rbegin()->first + 1) {
|
|
SetStartMessage(DatasetFromStartMessage(start, default_experiment));
|
|
}
|
|
|
|
[[nodiscard]] uint64_t GetNumberOfImages() const override { return number_of_images; }
|
|
void Close() override {}
|
|
|
|
bool ReadRawImage(int64_t image_number, JFJochReaderRawImage &ret) override {
|
|
const auto it = images.find(image_number);
|
|
if (it == images.end())
|
|
return false;
|
|
ret.image = it->second->message.image;
|
|
return true;
|
|
}
|
|
|
|
std::vector<SpotToSave> ReadSpots(int64_t) const override { return {}; }
|
|
};
|
|
}
|
|
|
|
StillsPrePassResult RunStillsPrePass(const StartMessage &start, const std::map<int64_t, std::shared_ptr<HeldImage>> &images,
|
|
int nthreads) {
|
|
HeldImageReader reader(start, images);
|
|
const auto dataset = reader.GetDataset();
|
|
const RugnuxLiveSetup setup = MakeRugnuxStillsPrePassSetup(*dataset, nthreads);
|
|
|
|
Rugnux rugnux(reader, setup.experiment, *dataset->pixel_mask, setup.config);
|
|
const ProcessResult result = rugnux.Run();
|
|
Rugnux::ReleasePinnedPool();
|
|
|
|
return StillsPrePassResult{
|
|
// Where the beam lands: the receiver analyses with the detector square to it, as stated, and a tilt
|
|
// the run refined moves its PONI, not this.
|
|
.beam_x_pxl = static_cast<float>(result.used_direct_beam_x_pxl),
|
|
.beam_y_pxl = static_cast<float>(result.used_direct_beam_y_pxl),
|
|
.distance_mm = result.used_distance_mm,
|
|
.mask = rugnux.GetPixelMask(),
|
|
.images = images.size(),
|
|
.geometry_frames = result.stills_geometry_frames
|
|
};
|
|
}
|