jfjoch_process: HDF5 writing is not default

This commit is contained in:
2026-03-06 12:58:51 +01:00
parent 6e1823b369
commit 2edb0b0dcd
+14 -14
View File
@@ -45,6 +45,7 @@ void print_usage(Logger &logger) {
logger.Info(" -P<txt> Partiality refinement fixed|rot|unity (default: fixed)");
logger.Info(" -A Anomalous mode (don't merge Friedel pairs)");
logger.Info(" -C<cell> Fix reference unit cell: -C\"a,b,c,alpha,beta,gamma\" (comma-separated, no spaces; quotes optional)");
logger.Info(" -W HDF5 file with analysis results is written");
}
void trim_in_place(std::string& t) {
@@ -127,6 +128,7 @@ int main(int argc, char **argv) {
bool anomalous_mode = false;
std::optional<int> space_group_number;
std::optional<UnitCell> fixed_reference_unit_cell;
bool write_output = false;
ScaleMergeOptions::PartialityModel partiality_model = ScaleMergeOptions::PartialityModel::Fixed;
@@ -139,7 +141,7 @@ int main(int argc, char **argv) {
}
int opt;
while ((opt = getopt(argc, argv, "o:N:s:e:vR::Fxd:S:MP:AD:C:")) != -1) {
while ((opt = getopt(argc, argv, "o:N:s:e:vR::Fxd:S:MP:AD:C:W")) != -1) {
switch (opt) {
case 'o':
output_prefix = optarg;
@@ -153,6 +155,9 @@ int main(int argc, char **argv) {
case 'e':
end_image = atoi(optarg);
break;
case 'W':
write_output = true;
break;
case 'v':
verbose = true;
break;
@@ -316,7 +321,8 @@ int main(int argc, char **argv) {
std::unique_ptr<FileWriter> writer;
try {
writer = std::make_unique<FileWriter>(start_message);
if (write_output)
writer = std::make_unique<FileWriter>(start_message);
} catch (const std::exception &e) {
logger.Error("Failed to initialize file writer: {}", e.what());
exit(EXIT_FAILURE);
@@ -434,7 +440,8 @@ int main(int argc, char **argv) {
std::lock_guard<std::mutex> lock(plots_mutex);
plots.Add(msg, profile);
// Write Result
writer->Write(msg);
if (writer)
writer->Write(msg);
}
// Update max sent tracking
@@ -655,8 +662,10 @@ int main(int argc, char **argv) {
}
// Write End Message
writer->WriteHDF5(end_msg);
auto stats = writer->Finalize();
if (writer) {
writer->WriteHDF5(end_msg);
auto stats = writer->Finalize();
}
// 6. Report Statistics to Console
double processing_time = std::chrono::duration<double>(end_time - start_time).count();
@@ -667,7 +676,6 @@ int main(int argc, char **argv) {
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);
logger.Info("Images written: {}", stats.size());
// Print extended stats similar to Receiver
if (!end_msg.indexing_rate.has_value()) {
@@ -691,12 +699,4 @@ int main(int argc, char **argv) {
logger.Info("Lattice: a={:.2f} b={:.2f} c={:.2f} alpha={:.2f} beta={:.2f} gamma={:.2f}",
uc.a, uc.b, uc.c, uc.alpha, uc.beta, uc.gamma);
}
if (stats.empty()) {
logger.Info("Analysis finished with warnings (no files written)");
exit(EXIT_FAILURE);
} else {
logger.Info("Analysis successfully finished");
exit(EXIT_SUCCESS);
}
}