From dceda21496c7d75beec12c342f9053bd4d29763a Mon Sep 17 00:00:00 2001 From: froejdh_e Date: Mon, 19 Jan 2026 15:20:37 +0100 Subject: [PATCH] fixed parsing of dynamic range --- src/RawFile.test.cpp | 2 +- src/RawMasterFile.cpp | 4 ++-- src/RawMasterFile.test.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/RawFile.test.cpp b/src/RawFile.test.cpp index 90daef4..4dd5bd7 100644 --- a/src/RawFile.test.cpp +++ b/src/RawFile.test.cpp @@ -292,7 +292,7 @@ TEST_CASE("check find_geometry", "[.with-data]") { TEST_CASE("Open multi module file with ROI", "[.with-data]") { - auto fpath = test_data_path() / "raw/SingleChipROI/Data_master_0.json"; + auto fpath = test_data_path() / "raw/ROITestData/SingleChipROI/Data_master_0.json"; REQUIRE(std::filesystem::exists(fpath)); RawFile f(fpath, "r"); diff --git a/src/RawMasterFile.cpp b/src/RawMasterFile.cpp index 04334c9..afc9b09 100644 --- a/src/RawMasterFile.cpp +++ b/src/RawMasterFile.cpp @@ -244,8 +244,8 @@ void RawMasterFile::parse_json(std::istream &is) { // TODO! Not valid for CTB but not changing api right now! // Not all detectors write the bitdepth but in case // its not there it is 16 - if(j.contains("Bit Depth") && j["Bit Depth"].is_number()){ - m_bitdepth = j["Bit Depth"]; + if(j.contains("Dynamic Range") && j["Dynamic Range"].is_number()){ + m_bitdepth = j["Dynamic Range"]; } else { m_bitdepth = 16; } diff --git a/src/RawMasterFile.test.cpp b/src/RawMasterFile.test.cpp index 640f0de..8715e96 100644 --- a/src/RawMasterFile.test.cpp +++ b/src/RawMasterFile.test.cpp @@ -398,6 +398,7 @@ TEST_CASE("Parse EIGER 7.2 master from string stream") { REQUIRE(f.timing_mode() == TimingMode::Auto); REQUIRE(f.geometry().col == 2); REQUIRE(f.geometry().row == 2); + REQUIRE(f.image_size_in_bytes() == 524288); REQUIRE(f.pixels_x() == 512); REQUIRE(f.pixels_y() == 256); @@ -405,6 +406,10 @@ TEST_CASE("Parse EIGER 7.2 master from string stream") { REQUIRE(f.frame_discard_policy() == FrameDiscardPolicy::NoDiscard); REQUIRE(f.frame_padding() == 1); REQUIRE(f.total_frames_expected() == 3); + + REQUIRE(f.bitdepth() == 32); + REQUIRE(f.frames_in_file() == 3); + REQUIRE(f.exptime() == std::chrono::seconds(5)); REQUIRE(f.period() == std::chrono::seconds(1)); } @@ -471,6 +476,7 @@ TEST_CASE("Parse JUNGFRAU 7.2 master from string stream") { REQUIRE(f.pixels_x() == 1024); REQUIRE(f.pixels_y() == 256); REQUIRE(f.max_frames_per_file() == 3); + REQUIRE(f.bitdepth() == 16); REQUIRE(f.frame_discard_policy() == FrameDiscardPolicy::NoDiscard); REQUIRE(f.frame_padding() == 1); REQUIRE(f.total_frames_expected() == 10); @@ -633,6 +639,7 @@ TEST_CASE("Parse v8.0 MYTHEN3 from stream"){ REQUIRE(f.frame_padding() == 1); REQUIRE(f.total_frames_expected() == 1); //This is Total Frames in the master file REQUIRE(f.counter_mask() == 4); + REQUIRE(f.bitdepth() == 32); // Mythen3 has three exposure times, but for the moment we don't handle them REQUIRE(f.exptime() == std::nullopt); @@ -716,6 +723,7 @@ TEST_CASE("Parse a v7.1 Mythen3 from stream"){ REQUIRE(f.frame_padding() == 1); REQUIRE(f.total_frames_expected() == 1); //This is Total Frames in the master file REQUIRE(f.counter_mask() == 0x7); + REQUIRE(f.bitdepth() == 32); // Mythen3 has three exposure times, but for the moment we don't handle them REQUIRE(f.exptime() == std::nullopt);