Azimuthal integration: keep the low Q limit below the maximum
Making the high limit optional removed the implicit upper bound on the low one (it used to follow from high <= maxQ and high > low), so --azim-min-q 50 with no maximum is accepted and ResolveHighQ then calls std::clamp with its lower bound above its upper bound, which is undefined. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,10 @@ AzimuthalIntegrationSettings &AzimuthalIntegrationSettings::SolidAngleCorrection
|
||||
AzimuthalIntegrationSettings &AzimuthalIntegrationSettings::QRange_recipA(float low, std::optional<float> high) {
|
||||
check_finite("Low Q for azimuthal integration", low);
|
||||
check_min("Low Q for azimuthal integration", low, minQ_recipA);
|
||||
// The low limit has to leave room for at least one bin below maxQ. This used to follow from the
|
||||
// high limit being mandatory (high <= maxQ and high > low); once "unset" became legal, ResolveHighQ
|
||||
// was left computing std::clamp(q, low + spacing, maxQ) with the lower bound above the upper one.
|
||||
check_max("Low Q for azimuthal integration", low, maxQ_recipA - q_spacing);
|
||||
if (high.has_value()) {
|
||||
check_finite("High Q for azimuthal integration", *high);
|
||||
check_max("High Q for azimuthal integration", *high, maxQ_recipA);
|
||||
|
||||
Reference in New Issue
Block a user