Merge: More printing is done directly,

This commit is contained in:
2026-05-20 08:25:43 +02:00
parent 270e906fe7
commit 18c0d0cf6f
4 changed files with 74 additions and 49 deletions
+36 -33
View File
@@ -9,6 +9,8 @@
#include <random>
#include <unordered_map>
#include <spdlog/fmt/fmt.h>
#include <gemmi/reciproc.hpp>
#include "../../common/CorrelationCoefficient.h"
@@ -440,41 +442,42 @@ MergeStatistics MergeStats(const DiffractionExperiment &x,
return out;
}
void MergeStatistics::Print(Logger &logger) const {
logger.Info("");
logger.Info(" {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s}", "d_min", "N_obs", "N_uniq", "N_possib", "Compl","<I/sig>", "CC1/2", "CCref");
logger.Info(" {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s}", "", "", "", "", "", "", "", "");
for (const auto &sh: shells) {
std::ostream &operator<<(std::ostream &output, const MergeStatisticsShell &in) {
double completeness = in.possible_unique_reflections > 0
? static_cast<double>(in.unique_reflections) / in.possible_unique_reflections * 100.0 : 0.0;
output << fmt::format("{:8d} {:8d} {:8d} {:7.1f}% {:8.1f} {:7.1f}% {:7.1f}%",
in.total_observations,
in.unique_reflections,
in.possible_unique_reflections,
completeness,
in.mean_i_over_sigma,
in.cc_half*100.0,
in.cc_ref*100.0);
return output;
}
std::ostream &operator<<(std::ostream &output, const MergeStatistics &in) {
output << std::endl;
output << fmt::format(" {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s} {:>8s}",
"d_min", "N_obs", "N_uniq", "N_possib", "Compl","<I/sig>", "CC1/2", "CCref")
<< std::endl;;
output << fmt::format(" {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s}",
"", "", "", "", "", "", "", "") << std::endl;
for (const auto &sh: in.shells) {
if (sh.unique_reflections == 0)
continue;
double completeness = sh.possible_unique_reflections > 0
? static_cast<double>(sh.unique_reflections) / sh.possible_unique_reflections * 100.0 : 0.0;
logger.Info(" {:8.2f} {:8d} {:8d} {:8d} {:7.1f}% {:8.1f} {:7.1f}% {:7.1f}%",
sh.d_min,
sh.total_observations,
sh.unique_reflections,
sh.possible_unique_reflections,
completeness,
sh.mean_i_over_sigma,
sh.cc_half*100.0,
sh.cc_ref*100.0);
output << fmt::format(" {:8.2f} ", sh.d_min);
output << sh;
output << std::endl;
}
{
const auto &ov = overall;
double completeness = ov.possible_unique_reflections > 0
? static_cast<double>(ov.unique_reflections) / ov.possible_unique_reflections * 100.0 : 0.0;
output << fmt::format(" {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s}",
"", "", "", "", "", "", "", "") << std::endl;
logger.Info(" {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s} {:->8s}", "", "", "", "", "", "", "", "");
logger.Info(" {:>8s} {:8d} {:8d} {:8d} {:7.1f}% {:8.1f} {:7.1f}% {:7.1f}%",
"Overall",
ov.total_observations,
ov.unique_reflections,
ov.possible_unique_reflections,
completeness,
ov.mean_i_over_sigma,
ov.cc_half*100.0,
ov.cc_ref*100.0);
}
logger.Info("");
output << fmt::format(" {:>8s} ", "Overall");
output << in.overall;
output << std::endl;
output << std::endl;
return output;
}