diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 9342d875..370858b7 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -1709,6 +1709,19 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b } } + // When merging is on, the _process.h5 is skipped because the merged reflections are the wanted + // output and the per-image file is large. If nothing indexed there are no merged reflections, so + // the run would finish successfully having written no file at all. Write one now: the per-image + // messages went past while there was no writer, but the end message still carries the per-image + // scalars (spot counts, background, resolution estimate) and the dataset metadata - which is what + // anyone asking "why did nothing index" needs, and it is small precisely because nothing indexed. + if (!writer && full && write_files && !cancelled_ && result.indexing_rate.value_or(0.0f) <= 0.0f) { + logger.Warning("No image indexed, so there are no merged reflections to write - writing " + "{}_process.h5 with the per-image analysis instead", config_.output_prefix); + writer = std::make_unique(start_message, /*check_overwrite_at_start=*/true, + /*trusted_path=*/true); + } + if (writer) { writer->WriteHDF5(end_msg); writer->Finalize();