diff --git a/image_analysis/scale_merge/StillsPartialityRefine.cpp b/image_analysis/scale_merge/StillsPartialityRefine.cpp index 1df3787c..f01bae07 100644 --- a/image_analysis/scale_merge/StillsPartialityRefine.cpp +++ b/image_analysis/scale_merge/StillsPartialityRefine.cpp @@ -326,8 +326,11 @@ double StillsPartialityRefine::RefineOne(IntegrationOutcome &outcome, // Adopt the refined model only if it correlates with the reference at least as well as the model it // replaces. Rejecting puts the crystal back exactly as it arrived, which is the same state a - // crystal with too few reflections to fit ends in. - if (cc_before.has_value() && std::isfinite(*cc_before) && std::isfinite(cc) && cc < *cc_before) { + // crystal with too few reflections to fit ends in. A CC that cannot be measured at all counts as + // worse, not as no opinion: ImageReferenceCC returns NaN when too few reflections clear the + // partiality cut, which is precisely what a refinement that collapsed the partialities produces - + // and adopting it would leave image_scale_cc NaN, on which --min-image-cc drops the image outright. + if (cc_before.has_value() && std::isfinite(*cc_before) && !(std::isfinite(cc) && cc >= *cc_before)) { for (size_t i = 0; i < outcome.reflections.size(); ++i) { outcome.reflections[i].partiality = before[i].first; outcome.reflections[i].image_scale_corr = before[i].second;