mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-13 15:57:14 +02:00
added num interfaces and ten giga enable
This commit is contained in:
@ -62,10 +62,10 @@ class Hdf5MasterFile {
|
||||
size_t m_total_frames_expected{};
|
||||
std::optional<ns> m_exptime{};
|
||||
std::optional<ns> m_period{};
|
||||
// burst mode
|
||||
// num udp interfaces
|
||||
std::optional<BurstMode> m_burst_mode;
|
||||
std::optional<size_t> m_number_of_udp_interfaces;
|
||||
size_t m_bitdepth{};
|
||||
// ten giga
|
||||
std::optional<size_t> m_ten_giga;
|
||||
// thresholdenergy
|
||||
// thresholdall energy
|
||||
std::optional<ns> m_subexptime{};
|
||||
@ -120,10 +120,10 @@ class Hdf5MasterFile {
|
||||
size_t total_frames_expected() const;
|
||||
std::optional<ns> exptime() const;
|
||||
std::optional<ns> period() const;
|
||||
// burst mode
|
||||
// num udp interfaces
|
||||
std::optional<BurstMode> burst_mode() const;
|
||||
std::optional<size_t> number_of_udp_interfaces() const;
|
||||
size_t bitdepth() const;
|
||||
// ten giga
|
||||
std::optional<size_t> ten_giga() const;
|
||||
// thresholdenergy
|
||||
// thresholdall energy
|
||||
std::optional<ns> subexptime() const;
|
||||
|
@ -295,6 +295,9 @@ enum class DetectorType {
|
||||
|
||||
enum class TimingMode { Auto, Trigger };
|
||||
enum class FrameDiscardPolicy { NoDiscard, Discard, DiscardPartial };
|
||||
enum class BurstMode { Burst_Interal, Burst_External, Continuous_Internal,
|
||||
Continuous_External };
|
||||
|
||||
|
||||
std::string RemoveUnit(std::string &str);
|
||||
|
||||
@ -385,12 +388,18 @@ template <> std::string ToString(TimingMode arg);
|
||||
|
||||
template <> FrameDiscardPolicy StringTo(const std::string & /*mode*/);
|
||||
template <> std::string ToString(FrameDiscardPolicy arg);
|
||||
|
||||
template <> BurstMode StringTo(const std::string & /*mode*/);
|
||||
template <> std::string ToString(BurstMode arg);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const ScanParameters &r);
|
||||
template <> std::string ToString(ScanParameters arg);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const ROI &roi);
|
||||
template <> std::string ToString(ROI arg);
|
||||
|
||||
|
||||
using DataTypeVariants = std::variant<uint16_t, uint32_t>;
|
||||
|
||||
template <typename T>
|
||||
|
@ -112,10 +112,16 @@ std::optional<ns> Hdf5MasterFile::exptime() const {
|
||||
std::optional<ns> Hdf5MasterFile::period() const {
|
||||
return m_period;
|
||||
}
|
||||
// burst mode
|
||||
// num udp interfaces
|
||||
std::optional<BurstMode> Hdf5MasterFile::burst_mode() const {
|
||||
return m_burst_mode;
|
||||
}
|
||||
std::optional<size_t> Hdf5MasterFile::number_of_udp_interfaces() const {
|
||||
return m_number_of_udp_interfaces;
|
||||
}
|
||||
size_t Hdf5MasterFile::bitdepth() const { return m_bitdepth; }
|
||||
// ten giga
|
||||
std::optional<size_t> Hdf5MasterFile::ten_giga() const {
|
||||
return m_ten_giga;
|
||||
}
|
||||
// thresholdenergy
|
||||
// thresholdall energy
|
||||
std::optional<ns> Hdf5MasterFile::subexptime() const {
|
||||
@ -303,7 +309,24 @@ void Hdf5MasterFile::parse_acquisition_metadata(
|
||||
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr);
|
||||
|
||||
// burst mode
|
||||
// num udp interfaces
|
||||
m_burst_mode = StringTo<BurstMode>(h5_get_scalar_dataset<std::string>(
|
||||
file, std::string(metadata_group_name + "Burst Mode")));
|
||||
LOG(logDEBUG) << "Burst Mode: " << ToString(m_burst_mode);
|
||||
|
||||
|
||||
// Number of UDP Interfaces
|
||||
// Not all detectors write the Number of UDP Interfaces but in case
|
||||
H5::Exception::dontPrint();
|
||||
try {
|
||||
m_number_of_udp_interfaces = h5_get_scalar_dataset<int>(
|
||||
file, std::string(metadata_group_name + "Number of UDP Interfaces"));
|
||||
} catch (H5::FileIException &e) {
|
||||
// keep the optional empty
|
||||
}
|
||||
LOG(logDEBUG) << "Number of UDP Interfaces: " << m_number_of_udp_interfaces;
|
||||
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2),
|
||||
stderr);
|
||||
|
||||
|
||||
// Bit Depth
|
||||
// Not all detectors write the bitdepth but in case
|
||||
@ -318,7 +341,17 @@ void Hdf5MasterFile::parse_acquisition_metadata(
|
||||
LOG(logDEBUG) << "Bit Depth: " << m_bitdepth;
|
||||
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr);
|
||||
|
||||
// ten giga
|
||||
// Ten Giga
|
||||
H5::Exception::dontPrint();
|
||||
try {
|
||||
m_ten_giga = h5_get_scalar_dataset<int>(
|
||||
file, std::string(metadata_group_name + "Ten Giga"));
|
||||
} catch (H5::FileIException &e) {
|
||||
// keep the optional empty
|
||||
}
|
||||
LOG(logDEBUG) << "Ten Giga: " << ToString(m_ten_giga);
|
||||
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr);
|
||||
|
||||
// thresholdenergy
|
||||
// thresholdall energy
|
||||
|
||||
|
31
src/defs.cpp
31
src/defs.cpp
@ -154,6 +154,37 @@ template <> FrameDiscardPolicy StringTo(const std::string &arg) {
|
||||
throw std::runtime_error("Could not decode frame discard policy from: \"" + arg + "\"");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a BurstMode to a string
|
||||
* @param type BurstMode
|
||||
* @return string representation of the BurstMode
|
||||
*/
|
||||
template <> std::string ToString(BurstMode arg) {
|
||||
switch (arg) {
|
||||
case BurstMode::Burst_Interal:
|
||||
return "burst_internal";
|
||||
case BurstMode::Burst_External:
|
||||
return "burst_external";
|
||||
case BurstMode::Continuous_Internal:
|
||||
return "continuous_internal";
|
||||
case BurstMode::Continuous_External:
|
||||
return "continuous_external";
|
||||
}
|
||||
throw std::runtime_error("Could not decode burst mode to string");
|
||||
}
|
||||
|
||||
template <> BurstMode StringTo(const std::string &arg) {
|
||||
if (arg == "burst_internal")
|
||||
return BurstMode::Burst_Interal;
|
||||
if (arg == "burst_external")
|
||||
return BurstMode::Burst_External;
|
||||
if (arg == "continuous_internal")
|
||||
return BurstMode::Continuous_Internal;
|
||||
if (arg == "continuous_external")
|
||||
return BurstMode::Continuous_External;
|
||||
throw std::runtime_error("Could not decode burst mode from: \"" + arg + "\"");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a ScanParameters to a string
|
||||
* @param type ScanParameters
|
||||
|
Reference in New Issue
Block a user