Fixed bug in reading analog samples for <v8.0 (#349)
Build on RHEL9 / build (push) Successful in 2m34s
Build on RHEL8 / build (push) Successful in 3m2s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
Build on local RHEL8 / build (push) Successful in 2m43s

Before v8.0 we should always try to read analog samples. This bug
resulted in old Mönch03 data not being reordered.

1. Added test for master file parsing
2. Fixed code 

closing #348
This commit is contained in:
Erik Fröjdh
2026-08-19 12:34:37 +02:00
committed by GitHub
parent aa39470686
commit af25aea684
3 changed files with 572 additions and 9 deletions
+21 -8
View File
@@ -303,18 +303,31 @@ void RawMasterFile::parse_json(std::istream &is) {
}
// ----------------------------------------------------------------
// Special treatment of analog flag because of Moench03
m_analog_flag = v < 8.0 && (m_type == DetectorType::Moench);
// Special treatment of analog flag because of Moench03.
// Before SW 8.0.0 (NOT json file version v8!) Moench03 had Analog Samples
// but no Analog Flag. Therefore we need to set analog flag to true and try
// to read analog samples The detector type is later set depending on analog
// samples and number of pixels.
try {
m_analog_flag = static_cast<bool>(j.at("Analog Flag").get<int>());
if (m_analog_flag) {
m_analog_samples = j.at("Analog Samples");
if (m_type == DetectorType::Moench) {
if (auto it = j.find("Analog Samples"); it != j.end()) {
m_analog_flag = true;
m_analog_samples = it->get<size_t>();
} else {
m_analog_flag = false;
}
} else {
if (auto it = j.find("Analog Flag"); it != j.end()) {
m_analog_flag = static_cast<bool>(it->get<int>());
if (m_analog_flag) {
m_analog_samples = j.at("Analog Samples");
}
} else {
m_analog_flag = false;
}
} catch (const json::out_of_range &e) {
// keep the optional empty
}
//-----------------------------------------------------------------
try {
m_quad = j.at("Quad");
} catch (const json::out_of_range &e) {