fixed parsing of dynamic range (#268)
All checks were successful
Build on RHEL8 / build (push) Successful in 3m3s
Build on RHEL9 / build (push) Successful in 3m17s

1. fixed parsing of dynamic range (bug which I added during refactoring)
2. added tests for bitdepth!
3. updated path for test file
This commit is contained in:
2026-01-19 16:54:19 +01:00
committed by GitHub
3 changed files with 11 additions and 3 deletions

View File

@@ -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");

View File

@@ -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;
}

View File

@@ -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);