mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-09-05 08:40:56 +02:00
Fixed bug in reading analog samples for <v8.0 (#349)
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:
+21
-8
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user