diff --git a/src/RawMasterFile.cpp b/src/RawMasterFile.cpp index d10ee1d..dd3bf55 100644 --- a/src/RawMasterFile.cpp +++ b/src/RawMasterFile.cpp @@ -71,7 +71,7 @@ ScanParameters::ScanParameters(const bool enabled, const DACIndex dac, const int start, const int stop, const int step, const int64_t settleTime) : m_enabled(enabled), m_dac(dac), m_start(start), m_stop(stop), - m_step(step), m_settleTime(settleTime){}; + m_step(step), m_settleTime(settleTime) {}; // "[enabled\ndac dac 4\nstart 500\nstop 2200\nstep 5\nsettleTime 100us\n]" ScanParameters::ScanParameters(const std::string &par) { @@ -206,11 +206,20 @@ void RawMasterFile::parse_json(const std::filesystem::path &fpath) { m_max_frames_per_file = j["Max Frames Per File"]; - m_exptime = string_to( - j["Exptime"].get()); + try { + if (v < 8.0) { + m_exptime = string_to( + j["Exptime"].get()); + } else { + m_exptime = string_to( + j["Exposure Time"].get()); + } + } catch (const json::out_of_range &e) { + // keep default 0, Mythen3 not supported yet + } - m_period = string_to( - j["Period"].get()); + m_period = + string_to(j["Period"].get()); // Not all detectors write the bitdepth but in case // its not there it is 16 @@ -437,9 +446,9 @@ void RawMasterFile::parse_raw(const std::filesystem::path &fpath) { m_pixels_x = std::stoi(value.substr(0, pos)); } else if (key == "Total Frames") { m_total_frames_expected = std::stoi(value); - } else if(key == "Exptime"){ + } else if (key == "Exptime") { m_exptime = string_to(value); - } else if(key == "Period"){ + } else if (key == "Period") { m_period = string_to(value); } else if (key == "Dynamic Range") { m_bitdepth = std::stoi(value); diff --git a/src/RawMasterFile.test.cpp b/src/RawMasterFile.test.cpp index b8b4095..7d2d75d 100644 --- a/src/RawMasterFile.test.cpp +++ b/src/RawMasterFile.test.cpp @@ -164,7 +164,7 @@ TEST_CASE("Parse a master file in .raw format", "[.integration]") { auto fpath = test_data_path() / - "moench/" + "raw/moench/" "moench04_noise_200V_sto_both_100us_no_light_thresh_900_master_0.raw"; REQUIRE(std::filesystem::exists(fpath)); RawMasterFile f(fpath); @@ -263,7 +263,7 @@ TEST_CASE("Parse a master file in new .json format", } TEST_CASE("Read eiger master file", "[.integration]") { - auto fpath = test_data_path() / "eiger" / "eiger_500k_32bit_master_0.json"; + auto fpath = test_data_path() / "raw/eiger/eiger_500k_32bit_master_0.json"; REQUIRE(std::filesystem::exists(fpath)); RawMasterFile f(fpath);