v1.0.0-rc.166 (#76)
Build Packages / Unit tests (push) Successful in 1h22m15s
Build Packages / build:windows:nocuda (push) Successful in 18m0s
Build Packages / build:windows:cuda (push) Successful in 20m30s
Build Packages / build:viewer-tgz:cpu (push) Successful in 10m32s
Build Packages / build:viewer-tgz:cuda (push) Successful in 11m39s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 8m55s
Build Packages / build:rugnux:windows (push) Successful in 11m25s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 20m6s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 16m27s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 20m19s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 15m34s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 20m25s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 19m36s
Build Packages / build:rpm (rocky8) (push) Successful in 17m43s
Build Packages / build:rpm (rocky9) (push) Successful in 13m34s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 21m28s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 18m19s
Build Packages / DIALS test (push) Successful in 12m36s
Build Packages / XDS test (durin plugin) (push) Successful in 6m56s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 6m48s
Build Packages / XDS test (neggia plugin) (push) Successful in 6m7s
Build Packages / Generate python client (push) Successful in 11s
Build Packages / Build documentation (push) Successful in 36s
Build Packages / Create release (push) Skipped
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 5m11s

* `rugnux --mode calibration` writes `<prefix>.json` beside the `.poni`, whose `dataset_settings` member is a `jfjoch_broker` `dataset_settings` body as it stands.
* `rugnux` and `jfjoch_viewer` read PILATUS miniCBF sweeps natively, without conversion.
* Masters written by other facilities open, including Eiger 1.x and third-party NXmx variants.
* `rugnux` measures the beam centre on every run, and indexes with it when the file's value indexes nothing.
* A detector swung out on a 2theta arm is placed where the file says it stands, and the calibration can hold the tilt fixed.
* `rugnux` writes the unmerged MTZ by default, and a P1 merge beside it, so a wrong space group can be re-merged without reprocessing.
* Significant improvements to symmetry handling in `rugnux`: the lattice, the point group, the setting and the systematic absences.
* The `rugnux` report gives the resolution the CC1/2 fit reached, beside the range the reflections were written to.
* The `rugnux` report gives the twinning statistics measured before the space group was decided, beside the ones measured after.
* The `rugnux` report gives the strong-direction diffraction limit, and warns when CC1/2 is not monotone with resolution.
* `rugnux` ranks screw axes on the evidence their absences carry, rather than on how many control reflections a candidate happens to have.
* Twinning is no longer reported when the L-test contradicts it.
* The `rugnux` report gives the detector tilt, the measured tilt and the direct beam beside the beam centre, and a post-refined beam centre is judged against the run's own measurement rather than the file's.
* `--no-refine-tilt` holds the detector tilt at the value in the file, instead of zeroing it, when the calibration starts from the spots.
* The `jfjoch_viewer` grid scan view draws the cells in the proportion of the scan steps, so the map has the shape of the scanned area.

Reviewed-on: #76
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #76.
This commit is contained in:
2026-09-02 21:17:31 +02:00
committed by leonarski_f
parent 511be0c366
commit 680c36c20d
383 changed files with 20910 additions and 3936 deletions
+41 -27
View File
@@ -108,7 +108,8 @@ JFJochImageReadingWorker::JFJochImageReadingWorker(const SpotFindingSettings &se
indexing = std::make_unique<IndexerThreadPool>(indexing_settings, IndexerConstruction::OnFirstUse);
http_reader.Experiment(experiment);
file_reader.Experiment(experiment);
hdf5_reader.Experiment(experiment);
cbf_reader.Experiment(experiment);
thumb_color_scale_.Select(ColorScaleEnum::Indigo);
autoload_timer = new QTimer(this);
@@ -209,6 +210,7 @@ void JFJochImageReadingWorker::LoadFile_i(const QString &filename, qint64 image_
if (filename.startsWith("http://") || filename.startsWith("https://")) {
http_mode = true;
cbf_mode = false;
http_reader.ReadURL(filename.toStdString());
total_images = http_reader.GetNumberOfImages();
dataset = http_reader.GetDataset();
@@ -265,9 +267,19 @@ void JFJochImageReadingWorker::LoadFile_i(const QString &filename, qint64 image_
file_open_retry_attempts++;
}
file_reader.ReadFile(filename.toStdString());
total_images = file_reader.GetNumberOfImages();
dataset = file_reader.GetDataset();
// Naming one miniCBF frame opens the sweep it belongs to; anything else is HDF5.
// Release the previously open file first, so switching format leaves nothing behind.
file_reader->Close();
cbf_mode = JFJochCBFReader::CanRead(filename.toStdString());
if (cbf_mode) {
file_reader = &cbf_reader;
cbf_reader.ReadFiles(filename.toStdString());
} else {
file_reader = &hdf5_reader;
hdf5_reader.ReadFile(filename.toStdString());
}
total_images = file_reader->GetNumberOfImages();
dataset = file_reader->GetDataset();
setAutoLoadMode_i(AutoloadMode::None);
if (retry && file_open_retry_active) {
@@ -334,7 +346,7 @@ void JFJochImageReadingWorker::CloseFile() {
if (http_mode)
http_reader.Close();
else
file_reader.Close();
file_reader->Close();
status_timer->stop();
setAutoLoadMode_i(AutoloadMode::None);
@@ -398,7 +410,7 @@ void JFJochImageReadingWorker::LoadImage_i(int64_t image_number, int64_t summati
} else {
if (image_number < 0 || image_number + summation > total_images)
return;
current_image_ptr = file_reader.LoadImage(image_number, summation);
current_image_ptr = file_reader->LoadImage(image_number, summation);
}
if (!current_image_ptr) {
@@ -469,8 +481,8 @@ void JFJochImageReadingWorker::UpdateDataset_i(const std::optional<DiffractionEx
dataset = http_reader.GetDataset();
} else {
if (experiment)
file_reader.UpdateGeomMetadata(experiment.value());
dataset = file_reader.GetDataset();
file_reader->UpdateGeomMetadata(experiment.value());
dataset = file_reader->GetDataset();
}
if (!dataset) {
logger.Error("UpdateDataset_i: dataset is null (http_mode={}) - skipping update to avoid crash", http_mode);
@@ -533,7 +545,7 @@ void JFJochImageReadingWorker::Analyze() {
EmitImageLoaded_i(current_image_ptr);
}
void JFJochImageReadingWorker::FindCenter(QVector<float> ring_q, bool guess) {
void JFJochImageReadingWorker::FindCenter(QVector<float> ring_q, bool guess, bool refine_tilt) {
QMutexLocker locker(&m);
if (!current_image_ptr)
return;
@@ -543,9 +555,9 @@ void JFJochImageReadingWorker::FindCenter(QVector<float> ring_q, bool guess) {
const std::vector<float> ring_Q(ring_q.begin(), ring_q.end());
try {
if (guess)
GuessGeometry(geom, current_image_ptr->ImageData().spots, ring_Q);
GuessGeometry(geom, current_image_ptr->ImageData().spots, ring_Q, refine_tilt);
else
OptimizeGeometry(geom, current_image_ptr->ImageData().spots, ring_Q);
OptimizeGeometry(geom, current_image_ptr->ImageData().spots, ring_Q, refine_tilt);
} catch (const JFJochException &e) {
logger.ErrorException(e);
return;
@@ -799,8 +811,8 @@ void JFJochImageReadingWorker::UpdateUserMask_i(const std::vector<uint32_t> &mas
http_reader.UpdateUserMask(mask);
dataset = http_reader.GetDataset();
} else {
file_reader.UpdateUserMask(mask);
dataset = file_reader.GetDataset();
file_reader->UpdateUserMask(mask);
dataset = file_reader->GetDataset();
}
if (!dataset) {
@@ -886,7 +898,7 @@ void JFJochImageReadingWorker::LoadCalibration(QString dataset) {
auto tmp = std::make_shared<SimpleImage>();
try {
tmp->image = file_reader.ReadCalibration(tmp->buffer, dataset.toStdString());
tmp->image = hdf5_reader.ReadCalibration(tmp->buffer, dataset.toStdString());
std::shared_ptr<const SimpleImage> ctmp = tmp;
emit simpleImageLoaded(ctmp);
@@ -1043,7 +1055,7 @@ void JFJochImageReadingWorker::LoadSpots(int64_t start_image, int64_t end_image,
if (http_mode)
result = http_reader.ReadAllSpots(start_image, end_image, stride);
else
result = file_reader.ReadAllSpots(start_image, end_image, stride);
result = file_reader->ReadAllSpots(start_image, end_image, stride);
emit spotsLoaded(result);
}
@@ -1065,8 +1077,8 @@ ReprocessingInputs JFJochImageReadingWorker::GetReprocessingInputs() const {
void JFJochImageReadingWorker::ActivateSnapshot_i(const QString &name) {
// Assumes m locked! Switch the reader's active metadata snapshot and refresh the view.
file_reader.SetActiveSnapshot(name.toStdString());
auto dataset = file_reader.GetDataset();
hdf5_reader.SetActiveSnapshot(name.toStdString());
auto dataset = hdf5_reader.GetDataset();
if (!dataset)
return;
@@ -1077,9 +1089,9 @@ void JFJochImageReadingWorker::ActivateSnapshot_i(const QString &name) {
EmitDatasetLoaded_i(dataset);
QStringList names;
for (const auto &n: file_reader.SnapshotNames())
for (const auto &n: hdf5_reader.SnapshotNames())
names << QString::fromStdString(n);
emit snapshotsChanged(names, QString::fromStdString(file_reader.ActiveSnapshot()));
emit snapshotsChanged(names, QString::fromStdString(hdf5_reader.ActiveSnapshot()));
EmitRuns_i();
if (current_image.has_value()) {
@@ -1096,13 +1108,13 @@ void JFJochImageReadingWorker::EmitRuns_i() {
// Assumes m locked! Build the run list (every snapshot dataset + its display label).
QVector<RunData> runs;
if (!http_mode) {
for (const auto &[id, dataset]: file_reader.AllSnapshotDatasets()) {
for (const auto &[id, dataset]: hdf5_reader.AllSnapshotDatasets()) {
const auto it = run_labels_.find(id);
const QString label = (it != run_labels_.end()) ? it->second : QString::fromStdString(id);
runs.push_back(RunData{QString::fromStdString(id), label, dataset});
}
}
emit runsChanged(runs, http_mode ? QString() : QString::fromStdString(file_reader.ActiveSnapshot()));
emit runsChanged(runs, http_mode ? QString() : QString::fromStdString(hdf5_reader.ActiveSnapshot()));
}
void JFJochImageReadingWorker::RenameRun(QString id, QString label) {
@@ -1115,20 +1127,22 @@ void JFJochImageReadingWorker::RemoveRun(QString id) {
QMutexLocker ul(&m);
if (http_mode || id == "Original")
return;
file_reader.RemoveSnapshot(id.toStdString());
hdf5_reader.RemoveSnapshot(id.toStdString());
run_labels_.erase(id.toStdString());
// Refresh the (possibly now-Original) active view; ActivateSnapshot_i also re-emits runsChanged.
ActivateSnapshot_i(QString::fromStdString(file_reader.ActiveSnapshot()));
ActivateSnapshot_i(QString::fromStdString(hdf5_reader.ActiveSnapshot()));
}
void JFJochImageReadingWorker::RegisterProcessingSnapshot(QString id, QString label, QString master_path) {
QMutexLocker ul(&m);
if (http_mode) {
logger.Error("Processing snapshots are only available for files");
if (http_mode || cbf_mode) {
// A snapshot is metadata read back over the SAME images the reader is serving, which only the
// HDF5 reader can do; a CBF sweep's job output is a stand-alone file, opened like any other.
logger.Error("Processing snapshots are only available for HDF5 files");
return;
}
try {
file_reader.RegisterSnapshot(id.toStdString(), master_path.toStdString());
hdf5_reader.RegisterSnapshot(id.toStdString(), master_path.toStdString());
run_labels_[id.toStdString()] = label;
ActivateSnapshot_i(id); // activates + emits datasetLoaded / snapshotsChanged / runsChanged
} catch (const std::exception &e) {
@@ -1184,7 +1198,7 @@ QImage JFJochImageReadingWorker::RenderThumbnail_i(int64_t image_number, bool sh
QMutexLocker locker(&m);
if (http_mode || image_number < 0 || image_number >= total_images)
return {};
img = file_reader.LoadImage(image_number, 1);
img = file_reader->LoadImage(image_number, 1);
}
if (!img)
return {};