From af79b02241dc336ec9dfd5b40714f9158a4f0303 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 15 Oct 2026 15:46:40 +0200 Subject: [PATCH] Viewer: a newly opened file starts with "Known unit cell" unticked As a bare rugnux forgets the crystal an input file stores (ClearStoredCrystal), the settings panel now shows the file's cell and space group but does not use them until the user ticks "Known unit cell". Before, a file carrying a cell was indexed and merged with it, like rugnux -C/-S. Co-Authored-By: Claude Opus 5.5 --- rugnux/RugnuxDefaults.h | 3 ++- viewer/JFJochViewerWindow.cpp | 2 ++ viewer/widgets/JFJochViewerSettingsDock.cpp | 4 ++++ viewer/widgets/JFJochViewerSettingsDock.h | 3 +++ viewer/windows/JFJochProcessingJobsWindow.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/rugnux/RugnuxDefaults.h b/rugnux/RugnuxDefaults.h index 4ea9a6fa8..84ad9e7b0 100644 --- a/rugnux/RugnuxDefaults.h +++ b/rugnux/RugnuxDefaults.h @@ -45,7 +45,8 @@ void ApplyRugnuxExperimentDefaults(DiffractionExperiment &experiment); // search start de novo. A stored cell otherwise resolves the indexing algorithm to ffbidx and drives // it to that lattice, and a stored space group skips the search outright. The CLI calls this and then // applies -C / -S (or a reference MTZ) on top; the viewer instead takes the crystal straight from its -// settings panel, which clears both fields when "Unit cell known" is unticked. +// settings panel, which clears both fields when "Unit cell known" is unticked - as it is when a file is +// opened. void ClearStoredCrystal(DiffractionExperiment &experiment); // Scaling/merging defaults for the workflow. Several differ between rotation and stills because the diff --git a/viewer/JFJochViewerWindow.cpp b/viewer/JFJochViewerWindow.cpp index 0b4cc8bf1..2f85ebd3b 100644 --- a/viewer/JFJochViewerWindow.cpp +++ b/viewer/JFJochViewerWindow.cpp @@ -627,6 +627,8 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString reading_worker, &JFJochImageReadingWorker::FindCenter); connect(this, &JFJochViewerWindow::datasetReady, settingsPanel, &JFJochViewerSettingsDock::datasetLoaded); + connect(reading_worker, &JFJochImageReadingWorker::fileOpened, + settingsPanel, &JFJochViewerSettingsDock::fileOpened); connect(this, &JFJochViewerWindow::imageReady, settingsPanel, &JFJochViewerSettingsDock::loadImage); connect(settingsPanel, &JFJochViewerSettingsDock::ringsFromCalibration, diff --git a/viewer/widgets/JFJochViewerSettingsDock.cpp b/viewer/widgets/JFJochViewerSettingsDock.cpp index 8ab69f720..1a7dc456a 100644 --- a/viewer/widgets/JFJochViewerSettingsDock.cpp +++ b/viewer/widgets/JFJochViewerSettingsDock.cpp @@ -1022,6 +1022,10 @@ void JFJochViewerSettingsDock::datasetLoaded(std::shared_ptrsetChecked(false); // a change emits the experiment without the crystal +} + void JFJochViewerSettingsDock::ApplyProcessingMode() { // Rotation is the only mode that changes how the data is processed: the rotation good-path // (rotation indexing + Ewald partiality + rot3d combine + scale-fulls). A grid scan is a raster diff --git a/viewer/widgets/JFJochViewerSettingsDock.h b/viewer/widgets/JFJochViewerSettingsDock.h index 5cd774391..f6f9faf58 100644 --- a/viewer/widgets/JFJochViewerSettingsDock.h +++ b/viewer/widgets/JFJochViewerSettingsDock.h @@ -42,6 +42,9 @@ public: public slots: void datasetLoaded(std::shared_ptr dataset); + // A new file: the crystal it stores is shown but not used until "Known unit cell" is ticked, as a + // bare `rugnux` forgets it (ClearStoredCrystal). + void fileOpened(); void loadImage(std::shared_ptr image); void referenceLoaded(ReferenceMtzInfo info); // worker reports a (un)loaded reference MTZ // Dataset re-processing reads a stored HDF5 file, so it is unavailable on a live HTTP stream: diff --git a/viewer/windows/JFJochProcessingJobsWindow.cpp b/viewer/windows/JFJochProcessingJobsWindow.cpp index 2a91d6725..d722e3010 100644 --- a/viewer/windows/JFJochProcessingJobsWindow.cpp +++ b/viewer/windows/JFJochProcessingJobsWindow.cpp @@ -432,10 +432,10 @@ void JFJochProcessingJobsWindow::newJob(ProcessMode mode, CalibrationSelection c // // The cell and space group come from the settings panel and nowhere else: with "Unit cell known" // ticked they are indexed and merged with, unticked the panel clears both and the run determines - // them from the data (-C / -S versus bare `rugnux`). The panel is filled from the file when one is - // opened, so what a run will use is always the crystal shown on screen - including after a finished - // job's _process.h5 becomes the active snapshot, where a run that ended in P1 shows P1 and can be - // cleared, rather than silently pinning every later run to it. + // them from the data (-C / -S versus bare `rugnux`). A newly opened file starts unticked - its stored + // crystal is shown but not used, as `rugnux` forgets it - so what a run uses is always the crystal + // shown on screen. A finished job's _process.h5 becoming the active snapshot does tick it with the + // run's crystal (a run that ended in P1 shows P1), which can be cleared before the next run. DiffractionExperiment experiment = inputs.experiment; const auto polarization = experiment.GetPolarizationFactor(); ApplyRugnuxExperimentDefaults(experiment);