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:
@@ -614,8 +614,11 @@ void DiffractionExperiment::CheckDataProcessingSettings(const SpotFindingSetting
|
||||
check_finite("Spot finding low resolution limit", settings.low_resolution_limit);
|
||||
|
||||
// An unset high-resolution limit means "as far as the detector reaches", so there is nothing to check.
|
||||
if (settings.high_resolution_limit.value_or(0.0f) > 0) {
|
||||
// A value that is present still has to be finite - NaN fails every comparison below, so testing it
|
||||
// inside the branch would let it through unchecked.
|
||||
if (settings.high_resolution_limit.has_value())
|
||||
check_finite("Spot finding high resolution limit", *settings.high_resolution_limit);
|
||||
if (settings.high_resolution_limit.value_or(0.0f) > 0) {
|
||||
check_min("Spot finding high resolution limit", *settings.high_resolution_limit, 0.5);
|
||||
check_max("Spot finding high resolution limit", *settings.high_resolution_limit, 50.0);
|
||||
if (settings.low_resolution_limit > 0) {
|
||||
|
||||
Reference in New Issue
Block a user