Spot finding: a zero high-resolution limit means no limit here too
Every other reader of spot_finding.high_resolution_limit spells "unset" as value_or(0) and compares, so 0 and nullopt are interchangeable - except in SpotAnalyze, which passed the 0 straight to ResolutionShells and threw "Resolution must be above zero" on every image. Reachable over the REST API, where 0 is the natural way to say "no limit" and the settings check lets it through; the rugnux CLI already maps 0 to unset before this point. While here, check that a limit that IS set is finite regardless of its sign - NaN fails the > 0 test and was skipping validation entirely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -147,8 +147,11 @@ void SpotAnalyze(const DiffractionExperiment &experiment,
|
||||
|
||||
CountSpots(output, spots_out, spot_finding_settings.cutoff_spot_count_low_res);
|
||||
|
||||
// 0 spells "no limit" everywhere else the limit is read (value_or(0) then compares against it), so it
|
||||
// has to mean the same here - passing it on as a resolution makes ResolutionShells throw per image.
|
||||
const auto &spot_d_min = spot_finding_settings.high_resolution_limit;
|
||||
GenerateSpotPlot(output, spots_out,
|
||||
spot_finding_settings.high_resolution_limit.value_or(experiment.GetDetectorMaxResolution_A()));
|
||||
spot_d_min.value_or(0.0f) > 0 ? *spot_d_min : experiment.GetDetectorMaxResolution_A());
|
||||
|
||||
output.resolution_estimate = GetResolution(spots_out);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user