mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-19 02:37:11 +02:00
WIP
This commit is contained in:
@ -223,6 +223,28 @@ void RawFile::parse_json_metadata() {
|
||||
} catch (const json::out_of_range &e) {
|
||||
m_bitdepth = 16;
|
||||
}
|
||||
|
||||
try {
|
||||
m_analog_samples = j.at("Analog Samples");
|
||||
}catch (const json::out_of_range &e) {
|
||||
m_analog_samples = 0;
|
||||
}
|
||||
try {
|
||||
m_digital_samples = j.at("Digital Samples");
|
||||
}catch (const json::out_of_range &e) {
|
||||
m_digital_samples = 0;
|
||||
}
|
||||
|
||||
//Update detector type for Moench
|
||||
if (m_type == DetectorType::Moench && m_analog_samples == 0 && m_rows == 400) {
|
||||
m_type = DetectorType::Moench03;
|
||||
}else if (m_type == DetectorType::Moench && m_rows == 400 && m_analog_samples == 5000) {
|
||||
m_type = DetectorType::Moench03_old;
|
||||
}else{
|
||||
throw std::runtime_error(LOCATION + "Could not determine Moench detector type");
|
||||
}
|
||||
|
||||
|
||||
// only Eiger had quad
|
||||
if (m_type == DetectorType::Eiger) {
|
||||
quad = (j["Quad"] == 1);
|
||||
@ -301,6 +323,10 @@ Frame RawFile::get_frame(size_t frame_index) {
|
||||
auto f = Frame(this->m_rows, this->m_cols, Dtype::from_bitdepth(this->m_bitdepth));
|
||||
std::byte *frame_buffer = f.data();
|
||||
get_frame_into(frame_index, frame_buffer);
|
||||
|
||||
//here would be the place to run a transform before returning the frame
|
||||
if (m_type == DetectorType::Moench03_old)
|
||||
fmt::print("Moench03_old\n");
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ template <> std::string toString(DetectorType arg) {
|
||||
return "Mythen3";
|
||||
case DetectorType::Moench:
|
||||
return "Moench";
|
||||
case DetectorType::Moench03:
|
||||
return "Moench03";
|
||||
case DetectorType::Moench03_old:
|
||||
return "Moench03_old";
|
||||
case DetectorType::ChipTestBoard:
|
||||
return "ChipTestBoard";
|
||||
default:
|
||||
@ -41,6 +45,10 @@ template <> DetectorType StringTo(const std::string &arg) {
|
||||
return DetectorType::Mythen3;
|
||||
if (arg == "Moench")
|
||||
return DetectorType::Moench;
|
||||
if (arg == "Moench03")
|
||||
return DetectorType::Moench03;
|
||||
if (arg == "Moench03_old")
|
||||
return DetectorType::Moench03_old;
|
||||
if (arg == "ChipTestBoard")
|
||||
return DetectorType::ChipTestBoard;
|
||||
throw std::runtime_error("Could not decode dector from: \"" + arg + "\"");
|
||||
|
Reference in New Issue
Block a user