From f9c8ab4552c110cf5adb47f8bd790fc62b7743f5 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 30 Jul 2026 11:20:32 +0200 Subject: [PATCH] rugnux: a run that indexes nothing still writes a process file With merging on, the _process.h5 is skipped because the merged reflections are the wanted output and that file is large (113 MB for 200 images here). But if nothing indexes there are no merged reflections either, so the run finished successfully having written no file at all - the one case where the user most needs something to look at. Write it in that case. The per-image messages have already gone past unwritten, so this carries the dataset metadata, the mask, the azimuthal profile and the summary scalars rather than the full per-image tables - and it is small for the same reason it is needed (124 kB on a zero-index run). A run that does index is untouched. Co-Authored-By: Claude Opus 5 (1M context) --- rugnux/Rugnux.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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();