rugnux: the library returns its outputs in memory; the callers write the files
The rugnux library wrote its results itself: _process.h5 through a FileWriter, the merged/twin/_mr reflection files, the unmerged MTZs, the maps and their MTZ, the placed models, _detector.jpg and _plot.txt, and on a doubled cell it renamed files on disk. It now writes none of them. - MtzTable (common/MtzTable.h): an MTZ file's header, columns and batch headers with no file behind it. It replaces MergedReflectionsMessage and MapCoefficientsMessage in the END message, with one CBOR encoding. WriteMtz (writer/WriteRugnuxFiles.h) is the one serialiser, used by rugnux and jfjoch_writer alike; it refuses a table whose columns differ in length, name a missing dataset, carry a malformed batch header or name a space group gemmi does not know. MergedMtzTable and UnmergedMtzTable build the tables the old writers built. - ProcessResult::outputs (RugnuxOutputs) holds, for the output pass only: the answer's merge (MTZ table plus what the .cif/.hkl are written from), the twin hypothesis' and the model's choice's merges, the unmerged and unmerged-partials tables, the maps (coefficients always; the grids only with ProcessConfig::keep_map_grids), the placed models, the detector JPEG and the per-image plot table, and the start message of the no-lattice _process.h5. Map RMS is taken from the grid in memory, as the CCP4 header stated it, whether or not the map is kept. - The per-image analysis goes to a caller-supplied RugnuxImageSink; rugnux and the viewer give a FileWriter-based ProcessFileSink. The geometry pre-pass no longer makes a _01_process.h5. - The doubled cell keeps both output sets: the answer's in outputs, the other's in DoubledCell::other_outputs with its suffix; the report names files by suffix after the caller's prefix. - The output prefix, write_process_h5 and the observation dump path are gone from ProcessConfig; --dump-observations is a callback. - What used to be gated on having files to write (model validation and MR, the twin-hypothesis merges, the finalist ledger, the scaled fulls, the unmerged tables) is gated on the output pass instead, so a caller with no prefix gets the same results. - RugnuxOutputFiles (new library JFJochRugnuxOutput, linked by rugnux, the viewer and the tests) writes every file from the result with the names and formats rugnux has always used. The viewer writes its job's files the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6efc42360a
commit
5f731db81d
50 files changed
+1163
-965
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@@ -180,13 +181,14 @@ TEST_CASE("Unmerged MTZ: built on several workers, the same rows as on one", "[w
|
||||
|
||||
for (bool sum_partials : {true, false}) {
|
||||
INFO("sum_partials " << sum_partials);
|
||||
const gemmi::Mtz serial = UnmergedMtz(outcomes, TETRAGONAL_CELL, experiment, sum_partials,
|
||||
OutputProvenance{}, 1);
|
||||
const gemmi::Mtz parallel = UnmergedMtz(outcomes, TETRAGONAL_CELL, experiment, sum_partials,
|
||||
OutputProvenance{}, 8);
|
||||
REQUIRE(serial.nreflections > 100000);
|
||||
REQUIRE(parallel.nreflections == serial.nreflections);
|
||||
CHECK(std::memcmp(parallel.data.data(), serial.data.data(), serial.data.size() * sizeof(float)) == 0);
|
||||
const MtzTable serial = UnmergedMtzTable(outcomes, TETRAGONAL_CELL, experiment, sum_partials,
|
||||
OutputProvenance{}, 1);
|
||||
const MtzTable parallel = UnmergedMtzTable(outcomes, TETRAGONAL_CELL, experiment, sum_partials,
|
||||
OutputProvenance{}, 8);
|
||||
REQUIRE(serial.columns[0].values.size() > 100000);
|
||||
REQUIRE(parallel.columns.size() == serial.columns.size());
|
||||
for (size_t c = 0; c < serial.columns.size(); c++)
|
||||
CHECK(parallel.columns[c].values == serial.columns[c].values);
|
||||
REQUIRE(parallel.batches.size() == serial.batches.size());
|
||||
CHECK(parallel.batches.front().number == serial.batches.front().number);
|
||||
CHECK(parallel.batches.back().number == serial.batches.back().number);
|
||||
@@ -354,10 +356,11 @@ TEST_CASE("Unmerged MTZ: on stills, only the crystals on the run's cell", "[writ
|
||||
r.partiality = 1.0f;
|
||||
outcomes[f].reflections.push_back(r);
|
||||
}
|
||||
const gemmi::Mtz mtz = UnmergedMtz(outcomes, TETRAGONAL_CELL, experiment, false, OutputProvenance{}, 1);
|
||||
CHECK(mtz.nreflections == 5);
|
||||
const auto batch = mtz.column_with_label("BATCH");
|
||||
REQUIRE(batch != nullptr);
|
||||
for (int i = 0; i < mtz.nreflections; ++i)
|
||||
CHECK((*batch)[i] == 1.0f);
|
||||
const MtzTable mtz = UnmergedMtzTable(outcomes, TETRAGONAL_CELL, experiment, false, OutputProvenance{}, 1);
|
||||
const auto batch = std::find_if(mtz.columns.begin(), mtz.columns.end(),
|
||||
[](const MtzTable::Column &c) { return c.label == "BATCH"; });
|
||||
REQUIRE(batch != mtz.columns.end());
|
||||
CHECK(batch->values.size() == 5);
|
||||
for (const float b : batch->values)
|
||||
CHECK(b == 1.0f);
|
||||
}
|
||||
Reference in new issue
Block a user