diff --git a/image_analysis/scale_merge/SearchSpaceGroup.cpp b/image_analysis/scale_merge/SearchSpaceGroup.cpp index 69a3d661..0c0d1fd0 100644 --- a/image_analysis/scale_merge/SearchSpaceGroup.cpp +++ b/image_analysis/scale_merge/SearchSpaceGroup.cpp @@ -863,8 +863,13 @@ SearchSpaceGroupResult SearchSpaceGroup( present_n > 0 ? static_cast(present_strong) / present_n : 0.0; const double centering_violation_rate = centering_absent > 0 ? static_cast(centering_violations) / centering_absent : 0.0; + // The mean-ratio test only means anything while the present class carries signal: with a + // present mean at or below zero the bound is non-positive and the comparison turns on the sign + // of the absent mean rather than on its size, accepting or rejecting a centering by accident. + // Leave that case to the rate test below, which counts violations and cannot change sign. const bool centering_ok = centering_absent == 0 - || (present_n > 0 && centering_absent_mean <= opt.max_absent_present_ratio * present_mean) + || (present_n > 0 && present_mean > 0.0 + && centering_absent_mean <= opt.max_absent_present_ratio * present_mean) || (present_strong_rate > 0.0 && centering_violation_rate <= opt.max_absent_present_ratio * present_strong_rate); const bool screw_ok = screw_absent == 0 ||