From 69c090bfa4a09bda91e96061ae4645fac57daa7f Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 30 Mar 2026 14:53:11 +0200 Subject: [PATCH] HDF5NXmx: Always use _master.h5 for consistency --- tests/HDF5WritingTest.cpp | 32 ++++++++++++++++---------------- tests/xds_durin/XDS.INP | 2 +- writer/HDF5NXmx.cpp | 2 -- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/tests/HDF5WritingTest.cpp b/tests/HDF5WritingTest.cpp index 251a234f..7c910c7f 100644 --- a/tests/HDF5WritingTest.cpp +++ b/tests/HDF5WritingTest.cpp @@ -859,12 +859,12 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_Basic", "[HDF5][Full]") { } // Single integrated file, no separate master or data files - REQUIRE(std::filesystem::exists("integrated_basic.h5")); - REQUIRE(!std::filesystem::exists("integrated_basic_master.h5")); + REQUIRE(!std::filesystem::exists("integrated_basic.h5")); + REQUIRE(std::filesystem::exists("integrated_basic_master.h5")); REQUIRE(!std::filesystem::exists("integrated_basic_data_000001.h5")); { - HDF5ReadOnlyFile file("integrated_basic.h5"); + HDF5ReadOnlyFile file("integrated_basic_master.h5"); // Data should be directly in the file std::unique_ptr dataset; @@ -885,7 +885,7 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_Basic", "[HDF5][Full]") { // No leftover HDF5 objects REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0); - remove("integrated_basic.h5"); + remove("integrated_basic_master.h5"); } TEST_CASE("HDF5Writer_NXmxIntegrated_WithSpots", "[HDF5][Full]") { @@ -925,9 +925,9 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_WithSpots", "[HDF5][Full]") { REQUIRE(stats.size() == 1); } - REQUIRE(std::filesystem::exists("integrated_spots.h5")); + REQUIRE(std::filesystem::exists("integrated_spots_master.h5")); { - HDF5ReadOnlyFile file("integrated_spots.h5"); + HDF5ReadOnlyFile file("integrated_spots_master.h5"); // Detector plugin data should exist in the same file REQUIRE(file.Exists("/entry/detector")); @@ -938,7 +938,7 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_WithSpots", "[HDF5][Full]") { } REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0); - remove("integrated_spots.h5"); + remove("integrated_spots_master.h5"); } TEST_CASE("HDF5Writer_NXmxIntegrated_ZeroImages", "[HDF5][Full]") { @@ -967,16 +967,16 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_ZeroImages", "[HDF5][Full]") { } // Master file should still exist with metadata - REQUIRE(std::filesystem::exists("integrated_zero.h5")); + REQUIRE(std::filesystem::exists("integrated_zero_master.h5")); { - HDF5ReadOnlyFile file("integrated_zero.h5"); + HDF5ReadOnlyFile file("integrated_zero_master.h5"); REQUIRE(file.Exists("/entry")); // No data dataset since no images written REQUIRE_THROWS(std::make_unique(file, "/entry/data/data")); } REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0); - remove("integrated_zero.h5"); + remove("integrated_zero_master.h5"); } TEST_CASE("HDF5Writer_NXmxIntegrated_AzInt", "[HDF5][Full]") { @@ -1019,9 +1019,9 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_AzInt", "[HDF5][Full]") { REQUIRE(stats.size() == 1); } - REQUIRE(std::filesystem::exists("integrated_azint.h5")); + REQUIRE(std::filesystem::exists("integrated_azint_master.h5")); { - HDF5ReadOnlyFile file("integrated_azint.h5"); + HDF5ReadOnlyFile file("integrated_azint_master.h5"); // Azimuthal integration bin mapping should exist (written by plugin) std::unique_ptr dataset; @@ -1035,7 +1035,7 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_AzInt", "[HDF5][Full]") { } REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0); - remove("integrated_azint.h5"); + remove("integrated_azint_master.h5"); } TEST_CASE("HDF5Writer_NXmxIntegrated_OutOfOrder", "[HDF5][Full]") { @@ -1073,9 +1073,9 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_OutOfOrder", "[HDF5][Full]") { REQUIRE(stats[0].total_images == 5); } - REQUIRE(std::filesystem::exists("integrated_ooo.h5")); + REQUIRE(std::filesystem::exists("integrated_ooo_master.h5")); { - HDF5ReadOnlyFile file("integrated_ooo.h5"); + HDF5ReadOnlyFile file("integrated_ooo_master.h5"); std::unique_ptr dataset; REQUIRE_NOTHROW(dataset = std::make_unique(file, "/entry/data/data")); HDF5DataSpace file_space(*dataset); @@ -1083,7 +1083,7 @@ TEST_CASE("HDF5Writer_NXmxIntegrated_OutOfOrder", "[HDF5][Full]") { } REQUIRE(H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL) == 0); - remove("integrated_ooo.h5"); + remove("integrated_ooo_master.h5"); } TEST_CASE("HDF5Writer_NoMasterFile", "[HDF5][Full]") { diff --git a/tests/xds_durin/XDS.INP b/tests/xds_durin/XDS.INP index 8137e89b..09b83794 100644 --- a/tests/xds_durin/XDS.INP +++ b/tests/xds_durin/XDS.INP @@ -12,7 +12,7 @@ ORGY= 1130 DETECTOR_DISTANCE= 75 OSCILLATION_RANGE= 0.088 X-RAY_WAVELENGTH= 1.0 -NAME_TEMPLATE_OF_DATA_FRAMES=writing_test_??????.h5 +NAME_TEMPLATE_OF_DATA_FRAMES=single.h5 DATA_RANGE= 1 25 !DATA_RANGE_FIXED_SCALE_FACTOR= 1900 6000 1.0 SPOT_RANGE= 1 25 diff --git a/writer/HDF5NXmx.cpp b/writer/HDF5NXmx.cpp index adb18840..961634b7 100644 --- a/writer/HDF5NXmx.cpp +++ b/writer/HDF5NXmx.cpp @@ -13,8 +13,6 @@ namespace { std::string GenFilename(const StartMessage &start) { - if (start.file_format == FileWriterFormat::NXmxIntegrated) - return fmt::format("{:s}.h5", start.file_prefix); return fmt::format("{:s}_master.h5", start.file_prefix); } }