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
+33 -14
View File
@@ -60,8 +60,8 @@ void print_usage(Logger &logger) {
std::cout << std::endl;
std::cout << " Scaling and merging" << std::endl;
std::cout << " --scale-merge Scale and merge (refine mosaicity) and write scaled.hkl + image.dat" << std::endl;
std::cout << " --partiality <txt> Partiality refinement fixed|rot|unity (default: fixed)" << std::endl;
std::cout << " -M, --scale-merge Scale and merge (refine mosaicity) and write scaled.hkl + image.dat" << std::endl;
std::cout << " -P, --partiality <txt> Partiality refinement fixed|rot|unity (default: fixed)" << std::endl;
std::cout << " -A, --anomalous Anomalous mode (don't merge Friedel pairs)" << std::endl;
std::cout << " -B, --refine-bfactor Refine per image B-factor" << std::endl;
std::cout << " -w, --wedge[=num] Refine image wedge during scaling with starting wedge value" << std::endl;
@@ -77,7 +77,6 @@ enum {
OPT_SPOT_RESOLUTION,
OPT_MAX_SPOTS,
OPT_NO_BEAM_CENTER_REFINE,
OPT_SCALE_MERGE,
OPT_MIN_PARTIALITY,
OPT_MIN_IMAGE_CC,
OPT_SCALING_ITERATIONS
@@ -99,13 +98,13 @@ static option long_options[] = {
{"anomalous", no_argument, nullptr, 'A'},
{"refine-bfactor", no_argument, nullptr, 'B'},
{"wedge", optional_argument, nullptr, 'w'},
{"scale-merge", no_argument, nullptr, 'M'},
{"spot-sigma", required_argument, nullptr, OPT_SPOT_SIGMA},
{"spot-threshold", required_argument, nullptr, OPT_SPOT_THRESHOLD},
{"spot-resolution", required_argument, nullptr, OPT_SPOT_RESOLUTION},
{"max-spots", required_argument, nullptr, OPT_MAX_SPOTS},
{"no-beam-center-refine", no_argument, nullptr, OPT_NO_BEAM_CENTER_REFINE},
{"scale-merge", no_argument, nullptr, OPT_SCALE_MERGE},
{"min-partiality", required_argument, nullptr, OPT_MIN_PARTIALITY},
{"min-image-cc", required_argument, nullptr, OPT_MIN_IMAGE_CC},
{"scaling-iterations", required_argument, nullptr, OPT_SCALING_ITERATIONS},
@@ -174,6 +173,12 @@ std::optional<UnitCell> parse_unit_cell_arg(const char *arg) {
};
int main(int argc, char **argv) {
for (int i = 0; i < argc; i++) {
std::cout << argv[i] << " ";
}
std::cout << std::endl << std::endl;
RegisterHDF5Filter();
print_license("jfjoch_analysis");
@@ -220,7 +225,7 @@ int main(int argc, char **argv) {
int opt;
int option_index = 0;
const char *short_opts = "vo:N:s:e:t:R::X:C:z:FABw::S:";
const char *short_opts = "vo:N:s:e:t:R::X:C:z:FABw::S:MP:";
while ((opt = getopt_long(argc, argv, short_opts, long_options, &option_index)) != -1) {
switch (opt) {
@@ -303,6 +308,19 @@ int main(int argc, char **argv) {
case 'S':
space_group_number = atoi(optarg);
break;
case 'P':
if (strcmp(optarg, "unity") == 0)
partiality_model = PartialityModel::Unity;
else if (strcmp(optarg, "fixed") == 0)
partiality_model = PartialityModel::Fixed;
else if (strcmp(optarg, "rot") == 0)
partiality_model = PartialityModel::Rotation;
else {
logger.Error("Invalid partiality mode: {}", optarg);
print_usage(logger);
exit(EXIT_FAILURE);
}
break;
case OPT_SPOT_SIGMA:
sigma_spot_finding = atof(optarg);
logger.Info("Noise threshold level for spot finding set to {:.2f} sigma", sigma_spot_finding);
@@ -323,7 +341,7 @@ int main(int argc, char **argv) {
case OPT_NO_BEAM_CENTER_REFINE:
refine_beam_center = false;
break;
case OPT_SCALE_MERGE:
case 'M':
run_scaling = true;
break;
case OPT_MIN_PARTIALITY:
@@ -761,7 +779,7 @@ int main(int argc, char **argv) {
} */
}
merged_statistics.Print(logger);
std::cout << merged_statistics;
if (consensus_cell && !output_prefix.empty())
WriteReflections(merged_reflections, *consensus_cell, experiment, output_prefix);
@@ -778,18 +796,18 @@ int main(int argc, char **argv) {
double throughput_MBs = static_cast<double>(total_uncompressed_bytes) / (processing_time * 1e6);
double frame_rate = static_cast<double>(images_to_process) / processing_time;
logger.Info("");
logger.Info("Processing time: {:.2f} s", processing_time);
logger.Info("Frame rate: {:.2f} Hz", frame_rate);
logger.Info("Total throughput:{:.2f} MB/s", throughput_MBs);
std::cout << fmt::format("Processing time: {:.2f} s", processing_time) << std::endl;
std::cout << fmt::format("Frame rate: {:.2f} Hz", frame_rate) << std::endl;
std::cout << fmt::format("Total throughput:{:.2f} MB/s", throughput_MBs) << std::endl;
// Print extended stats similar to Receiver
if (end_msg.indexing_rate.has_value()) {
logger.Info("Indexing rate: {:.2f}%", end_msg.indexing_rate.value() * 100.0);
std::cout << fmt::format("Indexing rate: {:.2f}%", end_msg.indexing_rate.value() * 100.0) << std::endl;
}
auto image_mean_time = plots.GetMeanProcessingTime();
logger.Info(
std::cout << fmt::format(
"Per-image time: (mean; milliseconds): decompress {:.2f} preprocess {:.2f} azint {:.2f} spot finding {:.2f} indexing {:.2f} refinement {:.2f} indexing analysis {:.2f} prediction {:.2f} integration {:.2f} scaling {:.2f} total {:.2f}",
image_mean_time.compression * 1e3,
image_mean_time.preprocessing * 1e3,
@@ -801,5 +819,6 @@ int main(int argc, char **argv) {
image_mean_time.bragg_prediction * 1e3,
image_mean_time.integration * 1e3,
image_mean_time.image_scale * 1e3,
image_mean_time.processing * 1e3);
image_mean_time.processing * 1e3)
<< std::endl;
}