From 59977ae91054b2da17f3d90792c83ea17256a9ee Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 29 Jul 2026 09:35:36 +0200 Subject: [PATCH] rugnux: --spot-high-resolution 0 really means no limit on rotation data Passing 0 reset the limit to "unset" and logged "No high resolution limit for spot finding: as far as the detector reaches" - and then, 700 lines later, the rotation default put 1.5 A back, because unset carried two different requests: the user said nothing, or the user asked for none. The log said one thing and detection did another, and there was no way to lift the limit on rotation data at all. Remember whether the option was given, and apply the rotation default only when it was not. Documented in the usage message. Co-Authored-By: Claude Opus 5 (1M context) --- rugnux/rugnux_cli.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index bfdc3224..bc138536 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -69,7 +69,7 @@ void print_usage() { std::cout << " --adaptive-spots Self-calibrating detection (DEFAULT): the strong-pixel threshold comes from each image's own per-resolution-ring noise instead of the fixed --spot-threshold, so one setting adapts across datasets (no per-dataset --spot-threshold/--spot-sigma tuning)." << std::endl; std::cout << " --no-adaptive-spots Turn adaptive detection off and use the fixed --spot-threshold / --spot-sigma finder instead" << std::endl; std::cout << " --spot-false-pixels Adaptive detection operating point: expected noise pixels tolerated per frame (default: 100; implies --adaptive-spots)" << std::endl; - std::cout << " --spot-high-resolution High resolution limit for spot finding. If omitted, stills extend as far as the detector reaches (no resolution clipping) and rotation data keeps a 1.5 A limit." << std::endl; + std::cout << " --spot-high-resolution High resolution limit for spot finding. If omitted, stills extend as far as the detector reaches (no resolution clipping) and rotation data keeps a 1.5 A limit; give 0 for no limit on either." << std::endl; std::cout << " --spot-low-resolution Low resolution limit for spot finding, in A (default: 50; lower it, e.g. 24, to exclude the direct-beam halo on weakly-diffracting serial data)" << std::endl; std::cout << " --max-spots Max spot count (default: 250)" << std::endl; std::cout << " --detect-ice-rings[=on|off] Flag ice-ring spots (de-prioritised in indexing) and exclude ice-ring reflections from scaling/merging; overrides the dataset/master-file setting (default: use dataset value)" << std::endl; @@ -542,6 +542,9 @@ int main(int argc, char **argv) { GeomRefinementAlgorithmEnum refinement_algorithm = GeomRefinementAlgorithmEnum::BeamCenter; std::optional d_min_spot_finding; // unset -> as far as the detector reaches + // Whether --spot-high-resolution was given at all. Unset covers two different requests - "the user + // said nothing", where rotation applies its own default, and "the user asked for no limit". + bool d_min_spot_finding_given = false; float d_max_spot_finding = 0; // 0 = keep the SpotFindingSettings default (50 A) std::optional d_min_scale_merge; std::optional resolution_cutoff_method; // --resolution-cutoff cc-logistic|off @@ -769,6 +772,7 @@ int main(int argc, char **argv) { // optional the rest of the code understands. Passing the 0 through instead reached // ResolutionShells (via the spot plot), which rejects a zero d_min and threw away every image. const auto d_min = parse_number_arg(optarg, "--spot-high-resolution", logger, 0.0f); + d_min_spot_finding_given = true; if (d_min > 0.0f) { d_min_spot_finding = d_min; logger.Info("High resolution limit for spot finding set to {:.2f} A", d_min); @@ -1504,7 +1508,7 @@ int main(int argc, char **argv) { spot_settings.min_pix_per_spot = min_pix_per_spot; if (rotation_indexing && !spot_settings.min_pix_per_spot.has_value()) spot_settings.min_pix_per_spot = 2; - if (rotation_indexing && !d_min_spot_finding.has_value()) + if (rotation_indexing && !d_min_spot_finding.has_value() && !d_min_spot_finding_given) d_min_spot_finding = 1.5f; spot_settings.adaptive_threshold = adaptive_spots.value_or(true); spot_settings.high_resolution_limit = d_min_spot_finding;