Tests: the stills rocking width - the window at a reflection's resolution, _process.h5 round trip

StillsPartialityRefine_MeasureRunWidth_WindowAtReflectionResolution, JFJochReader_StillsRunWidth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit dafb8d1bf996d1000741eecf019aee780dd91ebe)
This commit is contained in:
leonarski_f committed 2026-10-26 14:09:32 +01:00
1 parent 8a123e794d
commit e6b550fe42
2 files changed
+97

No files matched your search

+55
View File
@@ -2776,6 +2776,61 @@ TEST_CASE("JFJochReader_ReadReflections_Reindex", "[HDF5][Full]") {
REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0);
}
// A stills run's rocking curve (the one its partialities were computed from) goes to the master file and
// comes back whole, so --mode scale merges with it instead of measuring another; a file without it reads
// back without one.
TEST_CASE("JFJochReader_StillsRunWidth", "[HDF5][Full]") {
for (const bool with_width: {true, false}) {
DiffractionExperiment x(DetJF(1));
x.FilePrefix("read_stills_run_width")
.ImagesPerTrigger(1)
.ImagesPerFile(1)
.OverwriteExistingFiles(true)
.BitDepthImage(16)
.PixelSigned(true)
.SetFileWriterFormat(FileWriterFormat::NXmxVDS)
.Compression(CompressionAlgorithm::NO_COMPRESSION);
const StillsRunWidth w{.gamma0 = 1.25e-4, .gamma_e = 6.1e-4, .bandwidth_sigma = 1.7e-3,
.radial_scale = 1.0 + 3.3e-4,
.table_dstar = {0.1, 0.25, 0.4}, .table_s = {1.1e-4, 1.4e-4, 2.2e-4}};
RegisterHDF5Filter();
{
StartMessage start_message;
x.FillMessage(start_message);
FileWriter writer(start_message);
std::vector<int16_t> image(x.GetPixelsNum(), 0);
DataMessage message{};
message.image = CompressedImage(image, x.GetXPixelsNum(), x.GetYPixelsNum());
message.number = 0;
REQUIRE_NOTHROW(writer.WriteHDF5(message));
EndMessage end_message;
end_message.max_image_number = 1;
if (with_width)
end_message.stills_run_width = w;
writer.WriteHDF5(end_message);
writer.Finalize();
}
{
JFJochHDF5Reader reader;
REQUIRE_NOTHROW(reader.ReadFile("read_stills_run_width_master.h5"));
const auto &got = reader.GetDataset()->stills_run_width;
REQUIRE(got.has_value() == with_width);
if (with_width) {
CHECK(got->gamma0 == w.gamma0);
CHECK(got->gamma_e == w.gamma_e);
CHECK(got->bandwidth_sigma == w.bandwidth_sigma);
CHECK(got->radial_scale == w.radial_scale);
CHECK(got->table_dstar == w.table_dstar);
CHECK(got->table_s == w.table_s);
}
}
remove("read_stills_run_width_master.h5");
remove("read_stills_run_width_data_000001.h5");
}
REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0);
}
static std::vector<SpotToSave> MakeTestSpots(int i) {
return {
SpotToSave{