working Moench03 detector type

This commit is contained in:
Erik Fröjdh
2024-11-06 10:13:56 +01:00
parent 4bb8487e2c
commit 5b2809d6b0
2 changed files with 23 additions and 9 deletions

View File

@ -147,15 +147,27 @@ void RawMasterFile::parse_json(const std::filesystem::path &fpath) {
// keep the optional empty
}
try {
int analog_flag = j.at("Analog Flag");
if (analog_flag) {
// ----------------------------------------------------------------
// Special treatment of analog flag because of Moench03
try{
m_analog_flag = j.at("Analog Flag");
}catch (const json::out_of_range &e) {
// if it doesn't work still set it to one
// to try to decode analog samples (Old Moench03)
m_analog_flag = 1;
}
try {
if (m_analog_flag) {
m_analog_samples = j.at("Analog Samples");
}
} catch (const json::out_of_range &e) {
// keep the optional empty
// and set analog flag to 0
m_analog_flag = 0;
}
//-----------------------------------------------------------------
try {
m_quad = j.at("Quad");
@ -180,6 +192,10 @@ void RawMasterFile::parse_json(const std::filesystem::path &fpath) {
// Update detector type for Moench
// TODO! How does this work with old .raw master files?
#ifdef AARE_VERBOSE
fmt::print("Detecting Moench03: m_pixels_y: {}, m_analog_samples: {}\n",
m_pixels_y, m_analog_samples.value_or(0));
#endif
if (m_type == DetectorType::Moench && !m_analog_samples &&
m_pixels_y == 400) {
m_type = DetectorType::Moench03;