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

@ -18,16 +18,14 @@ from pathlib import Path
# im = ax.imshow(frame, cmap='viridis')
# fpath = Path('/Users/erik/data/Moench03old/test_034_irradiated_noise_g4_hg_exptime_2000us_master_0.json')
fpath = Path('/Users/erik/data/Moench05/moench05_multifile_master_0.json')
fpath = Path('/Users/erik/data/Moench03old/test_034_irradiated_noise_g4_hg_exptime_2000us_master_0.json')
# fpath = Path('/Users/erik/data/Moench05/moench05_multifile_master_0.json')
# f = aare.CtbRawFile(fpath, transform = transform.moench05)
# with CtbRawFile(fpath, transform = transform.moench05) as f:
# for header, image in f:
# print(f'Frame number: {header["frameNumber"]}')
f = aare.RawMasterFile(fpath)
m = aare.RawMasterFile(fpath)
f = aare.File(fpath)

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;