From 76395539fdebfe8b21344276fd6582ae7ff4e7ab Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 31 Jul 2026 11:50:54 +0200 Subject: [PATCH] Viewer: the crystal in the settings panel is the crystal the run uses "Analyze dataset" cleared the stored cell and space group unless "Use the stored unit cell / space group" was ticked, and that checkbox defaulted off. But the settings panel writes the user's own cell and space group onto the experiment, so a cell typed into the panel was discarded too - while the checkbox label said "stored", implying it came from the file. It also contradicted the dialog next to it: "Refine geometry (stills)" is offered and default-ticked precisely because a cell is present, and the run then removed that cell. The default dialog state on a stills dataset with a known cell ran the bundle adjustment with nothing to anchor on and dropped indexing off ffbidx, which needs a cell, onto de-novo FFT. Drop the checkbox and take the crystal from the panel, which already has exactly the right semantics: "Unit cell known" ticked writes the cell and group, unticked clears both, and a space group of 0 means none. So ticked = -C/-S, unticked = bare rugnux, and what a run will use is always what is on screen. That also keeps the copied command line honest, since RugnuxCommandLine emits -C/-S from the same experiment. The panel is refilled from the file when one is opened, so a finished job's _process.h5 becoming the active snapshot now shows its group and can be cleared, instead of silently pinning every later run to it. Co-Authored-By: Claude Opus 5 (1M context) --- viewer/windows/JFJochProcessingJobsWindow.cpp | 32 ++++--------------- viewer/windows/JFJochProcessingJobsWindow.h | 3 -- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/viewer/windows/JFJochProcessingJobsWindow.cpp b/viewer/windows/JFJochProcessingJobsWindow.cpp index 68a07e6c..6aff0ed7 100644 --- a/viewer/windows/JFJochProcessingJobsWindow.cpp +++ b/viewer/windows/JFJochProcessingJobsWindow.cpp @@ -224,20 +224,6 @@ int JFJochProcessingJobsWindow::askJob(const ReprocessingInputs &inputs, JobSpec "axis from the whole sweep, then re-integrates at the refined geometry. The refined pass is the " "canonical output; the header-geometry pass is kept as _01. Default on; a no-op for stills."); - // De-novo by default, exactly as `rugnux` with no -C / -S: it discards any cell and space group - // stored in the input file so neither indexing nor the space-group search is biased by them. This is - // offered only when there IS something stored - most often because a previous run of this very - // dataset wrote it, which is how a run that once ended in P1 used to pin every later run to P1. - const bool has_stored_crystal = inputs.experiment.GetUnitCell().has_value() - || inputs.experiment.GetSpaceGroupNumber().has_value(); - auto *keep_crystal = new QCheckBox("Use the stored unit cell / space group", &dlg); - keep_crystal->setChecked(false); - keep_crystal->setEnabled(has_stored_crystal && !azint); - keep_crystal->setToolTip( - "Off (default): the cell and space group are determined from the data, discarding whatever the " - "file carries - the same as running rugnux with no -C / -S. On: index and merge with the stored " - "values instead, which is what you want for serial stills with a known cell."); - auto *form = new QFormLayout; form->addRow("Start image", start_image); form->addRow("End image", end_image); @@ -248,8 +234,6 @@ int JFJochProcessingJobsWindow::askJob(const ReprocessingInputs &inputs, JobSpec form->addRow(scaling); form->addRow(refineRow); form->addRow(postrefine); - if (has_stored_crystal && !azint) - form->addRow(keep_crystal); int result = 0; auto *run = new QPushButton("Run locally", &dlg); @@ -279,7 +263,6 @@ int JFJochProcessingJobsWindow::askJob(const ReprocessingInputs &inputs, JobSpec spec.save_h5 = save_h5->isChecked(); spec.save_merged = save_merged->isEnabled() && save_merged->isChecked(); spec.prefix = prefix->text(); - spec.keep_stored_crystal = keep_crystal->isEnabled() && keep_crystal->isChecked(); spec.scaling = scaling->isEnabled() && scaling->isChecked(); spec.refine_geometry = refine_geometry->isEnabled() && refine_geometry->isChecked(); spec.refine_geometry_frames = refine_frames->value(); @@ -336,17 +319,16 @@ void JFJochProcessingJobsWindow::newJob(bool azint) { // The experiment carries the panel's indexing settings — including RotationIndexing set by "Process // as stills" (needed so IndexAndRefine builds a rotation indexer). On top of that it gets exactly // the defaults `rugnux` with no options would apply, so the two front ends agree: the analysis - // policy the panel does not expose (the polarization factor), the rotation scaling defaults, and - // the de-novo starting point. + // policy the panel does not expose (the polarization factor) and the rotation scaling defaults. // - // Clearing the stored crystal is the important one. Without it the space group carried in the file - // is left on the experiment, Rugnux skips the whole search (it only searches when none is set) and - // reports that group straight back — and since a finished job's own _process.h5 becomes the active - // snapshot, a run that ended in P1 pinned every later run to P1 as well. + // 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. DiffractionExperiment experiment = inputs.experiment; ApplyRugnuxExperimentDefaults(experiment); - if (!spec.keep_stored_crystal) - ClearStoredCrystal(experiment); if (spec.mode == ProcessMode::FullAnalysis && spec.scaling) { ScalingSettings scaling = RugnuxDefaultScalingSettings(config.rotation_indexing); // Keep what the settings dock does expose; take the rest from the shared defaults. diff --git a/viewer/windows/JFJochProcessingJobsWindow.h b/viewer/windows/JFJochProcessingJobsWindow.h index cea804cb..c042bc43 100644 --- a/viewer/windows/JFJochProcessingJobsWindow.h +++ b/viewer/windows/JFJochProcessingJobsWindow.h @@ -85,9 +85,6 @@ private: bool refine_geometry = false; // stills-only global geometry bundle-adjust (needs a known cell) int refine_geometry_frames = 200; // strong indexed frames fed to that bundle adjustment bool rotation_postrefine = true; // rotation-only two-pass geometry post-refine (default on) - // Process with the unit cell / space group the input file carries, instead of determining them - // de novo. Off by default, which is what `rugnux` with no -C/-S does. - bool keep_stored_crystal = false; }; // Returns 0 = cancel, 1 = run locally, 2 = copy command line; fills spec from the dialog.