fix for burst mode when not in file

This commit is contained in:
2025-06-10 10:42:43 +02:00
parent 56fa6f6bfb
commit be7f510775
2 changed files with 21 additions and 10 deletions

View File

@ -58,7 +58,7 @@ class Hdf5MasterFile {
size_t m_max_frames_per_file{}; size_t m_max_frames_per_file{};
FrameDiscardPolicy m_frame_discard_policy{}; FrameDiscardPolicy m_frame_discard_policy{};
size_t m_frame_padding{}; size_t m_frame_padding{};
ScanParameters m_scan_parameters; std::optional<ScanParameters> m_scan_parameters;
size_t m_total_frames_expected{}; size_t m_total_frames_expected{};
std::optional<ns> m_exptime{}; std::optional<ns> m_exptime{};
std::optional<ns> m_period{}; std::optional<ns> m_period{};
@ -116,7 +116,7 @@ class Hdf5MasterFile {
size_t max_frames_per_file() const; size_t max_frames_per_file() const;
const FrameDiscardPolicy &frame_discard_policy() const; const FrameDiscardPolicy &frame_discard_policy() const;
size_t frame_padding() const; size_t frame_padding() const;
ScanParameters scan_parameters() const; std::optional<ScanParameters> scan_parameters() const;
size_t total_frames_expected() const; size_t total_frames_expected() const;
std::optional<ns> exptime() const; std::optional<ns> exptime() const;
std::optional<ns> period() const; std::optional<ns> period() const;

View File

@ -100,7 +100,7 @@ const FrameDiscardPolicy &Hdf5MasterFile::frame_discard_policy() const {
return m_frame_discard_policy; return m_frame_discard_policy;
} }
size_t Hdf5MasterFile::frame_padding() const { return m_frame_padding; } size_t Hdf5MasterFile::frame_padding() const { return m_frame_padding; }
ScanParameters Hdf5MasterFile::scan_parameters() const { std::optional<ScanParameters> Hdf5MasterFile::scan_parameters() const {
return m_scan_parameters; return m_scan_parameters;
} }
size_t Hdf5MasterFile::total_frames_expected() const { size_t Hdf5MasterFile::total_frames_expected() const {
@ -273,17 +273,21 @@ void Hdf5MasterFile::parse_acquisition_metadata(
// Scan Parameters // Scan Parameters
H5::Exception::dontPrint();
try { try {
std::string scan_parameters = h5_get_scalar_dataset<std::string>( std::string scan_parameters = h5_get_scalar_dataset<std::string>(
file, std::string(metadata_group_name + "Scan Parameters")); file, std::string(metadata_group_name + "Scan Parameters"));
m_scan_parameters = ScanParameters(scan_parameters); m_scan_parameters = ScanParameters(scan_parameters);
if (dVersion < 6.61){ if (dVersion < 6.61){
m_scan_parameters.increment_stop(); //adjust for endpoint being included m_scan_parameters
->increment_stop(); // adjust for endpoint being included
} }
LOG(logDEBUG) << "Scan Parameters: " << ToString(m_scan_parameters);
} catch (H5::FileIException &e) { } catch (H5::FileIException &e) {
// keep the optional empty // keep the optional empty
} }
LOG(logDEBUG) << "Scan Parameters: " << ToString(m_scan_parameters); H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2),
stderr);
// Total Frames Expected // Total Frames Expected
m_total_frames_expected = h5_get_scalar_dataset<uint64_t>( m_total_frames_expected = h5_get_scalar_dataset<uint64_t>(
@ -295,10 +299,10 @@ void Hdf5MasterFile::parse_acquisition_metadata(
try { try {
m_exptime = StringTo<ns>(h5_get_scalar_dataset<std::string>( m_exptime = StringTo<ns>(h5_get_scalar_dataset<std::string>(
file, std::string(metadata_group_name + "Exposure Time"))); file, std::string(metadata_group_name + "Exposure Time")));
LOG(logDEBUG) << "Exptime: " << ToString(m_exptime);
} catch (H5::FileIException &e) { } catch (H5::FileIException &e) {
// keep the optional empty // keep the optional empty
} }
LOG(logDEBUG) << "Exptime: " << ToString(m_exptime);
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr); H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr);
// Period // Period
@ -313,10 +317,17 @@ void Hdf5MasterFile::parse_acquisition_metadata(
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr); H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2), stderr);
// burst mode // burst mode
m_burst_mode = StringTo<BurstMode>(h5_get_scalar_dataset<std::string>( H5::Exception::dontPrint();
file, std::string(metadata_group_name + "Burst Mode"))); try {
LOG(logDEBUG) << "Burst Mode: " << ToString(m_burst_mode); 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);
} catch (H5::FileIException &e) {
// keep the optional empty
}
H5Eset_auto(H5E_DEFAULT, reinterpret_cast<H5E_auto2_t>(H5Eprint2),
stderr);
// Number of UDP Interfaces // Number of UDP Interfaces
// Not all detectors write the Number of UDP Interfaces but in case // Not all detectors write the Number of UDP Interfaces but in case