mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-17 17:57:13 +02:00
fixed adc mask and roi, also the test for hdf5 for jungfrua
This commit is contained in:
@ -43,7 +43,7 @@ class Hdf5MasterFile {
|
||||
std::optional<bool> m_quad{};
|
||||
std::optional<int> m_number_of_rows{};
|
||||
std::optional<std::vector<size_t>> m_rate_corrections{};
|
||||
uint32_t m_adc_mask{};
|
||||
std::optional<uint32_t> m_adc_mask{};
|
||||
bool m_analog_flag{};
|
||||
std::optional<int> m_analog_samples{};
|
||||
bool m_digital_flag{};
|
||||
|
@ -308,8 +308,6 @@ void Hdf5MasterFile::parse_acquisition_metadata(
|
||||
LOG(logDEBUG) << "Threshold Energies: "
|
||||
<< ToString(m_threshold_energy_all);
|
||||
} catch (H5::FileIException &e) {
|
||||
std::cout << "No Threshold Energies found in file: " << fpath
|
||||
<< std::endl;
|
||||
// keep the optional empty
|
||||
}
|
||||
|
||||
@ -366,10 +364,10 @@ void Hdf5MasterFile::parse_acquisition_metadata(
|
||||
try {
|
||||
m_adc_mask = h5_get_scalar_dataset<uint32_t>(
|
||||
file, std::string(metadata_group_name + "ADC Mask"));
|
||||
LOG(logDEBUG) << "ADC Mask: " << m_adc_mask;
|
||||
} catch (H5::FileIException &e) {
|
||||
// keep the optional empty
|
||||
}
|
||||
LOG(logDEBUG) << "ADC Mask: " << m_adc_mask;
|
||||
|
||||
// Analog Flag
|
||||
// ----------------------------------------------------------------
|
||||
@ -468,19 +466,16 @@ void Hdf5MasterFile::parse_acquisition_metadata(
|
||||
file, std::string(metadata_group_name + "receiver roi ymax"));
|
||||
|
||||
// if any of the values are set update the roi
|
||||
if (tmp_roi.xmin != 4294967295 || tmp_roi.xmax != 4294967295 ||
|
||||
tmp_roi.ymin != 4294967295 || tmp_roi.ymax != 4294967295) {
|
||||
if (tmp_roi.xmin != -1 || tmp_roi.xmax != -1 ||
|
||||
tmp_roi.ymin != -1 || tmp_roi.ymax != -1) {
|
||||
// why?? TODO
|
||||
if (dVersion < 6.61) {
|
||||
//if (dVersion < 6.6) {
|
||||
tmp_roi.xmax++;
|
||||
tmp_roi.ymax++;
|
||||
}
|
||||
//}
|
||||
m_roi = tmp_roi;
|
||||
}
|
||||
// Not Done TODO
|
||||
// if we have an roi we need to update the geometry for the subfiles
|
||||
if (m_roi) {
|
||||
}
|
||||
|
||||
LOG(logDEBUG) << "ROI: " << m_roi;
|
||||
} catch (H5::FileIException &e) {
|
||||
// keep the optional empty
|
||||
|
@ -12,78 +12,50 @@ TEST_CASE("Parse a master file in .h5 format", "[.integration]") {
|
||||
REQUIRE(std::filesystem::exists(fpath));
|
||||
Hdf5MasterFile f(fpath);
|
||||
|
||||
// "Version": 7.2,
|
||||
REQUIRE(f.version() == "6.6");
|
||||
// "Timestamp": "Tue Feb 20 08:28:24 2024",
|
||||
// "Detector Type": "Jungfrau",
|
||||
REQUIRE(f.detector_type() == DetectorType::Jungfrau);
|
||||
// "Timing Mode": "auto",
|
||||
REQUIRE(f.timing_mode() == TimingMode::Auto);
|
||||
|
||||
// "Geometry": {
|
||||
// "x": 1,
|
||||
// "y": 1
|
||||
// },
|
||||
REQUIRE(f.geometry().col == 1);
|
||||
REQUIRE(f.geometry().row == 2);
|
||||
|
||||
// "Image Size in bytes": 1048576,
|
||||
REQUIRE(f.image_size_in_bytes() == 1048576);
|
||||
// "Pixels": {
|
||||
// "x": 1024,
|
||||
REQUIRE(f.pixels_x() == 1024);
|
||||
// "y": 512
|
||||
REQUIRE(f.pixels_y() == 512);
|
||||
// },
|
||||
|
||||
// "Max Frames Per File": 3,
|
||||
REQUIRE(f.max_frames_per_file() == 10000);
|
||||
|
||||
REQUIRE(f.frame_discard_policy() == FrameDiscardPolicy::NoDiscard);
|
||||
REQUIRE(f.frame_padding() == 1);
|
||||
REQUIRE(f.scan_parameters()->enabled() == false);
|
||||
REQUIRE(f.total_frames_expected() == 5);
|
||||
REQUIRE(f.exptime() == std::chrono::microseconds(10));
|
||||
REQUIRE(f.period() == std::chrono::milliseconds(2));
|
||||
REQUIRE_FALSE(f.burst_mode().has_value());
|
||||
REQUIRE(f.number_of_udp_interfaces() == 1);
|
||||
// Jungfrau doesn't write but it is 16
|
||||
REQUIRE(f.bitdepth() == 16);
|
||||
|
||||
// "Frame Discard Policy": "nodiscard",
|
||||
REQUIRE(f.frame_discard_policy() == FrameDiscardPolicy::NoDiscard);
|
||||
// "Frame Padding": 1,
|
||||
REQUIRE(f.frame_padding() == 1);
|
||||
// "Scan Parameters": "[disabled]",
|
||||
REQUIRE(!f.scan_parameters());
|
||||
// "Total Frames": 10,
|
||||
REQUIRE(f.total_frames_expected() == 5);
|
||||
// "Receiver Roi": {
|
||||
// "xmin": 4294967295,
|
||||
// "xmax": 4294967295,
|
||||
// "ymin": 4294967295,
|
||||
// "ymax": 4294967295
|
||||
// },
|
||||
// "Exptime": "10us",
|
||||
REQUIRE(ToString(f.exptime()) == "10us");
|
||||
// "Period": "1ms",
|
||||
// "Number of UDP Interfaces": 1,
|
||||
// "Number of rows": 512,
|
||||
REQUIRE_FALSE(f.ten_giga().has_value());
|
||||
REQUIRE_FALSE(f.threshold_energy().has_value());
|
||||
REQUIRE_FALSE(f.threshold_energy_all().has_value());
|
||||
REQUIRE_FALSE(f.subexptime().has_value());
|
||||
REQUIRE_FALSE(f.subperiod().has_value());
|
||||
REQUIRE_FALSE(f.quad().has_value());
|
||||
REQUIRE(f.number_of_rows() == 512);
|
||||
// "Frames in File": 10,
|
||||
REQUIRE(f.frames_in_file() == 5);
|
||||
|
||||
// TODO! Should we parse this?
|
||||
// "Frame Header Format": {
|
||||
// "Frame Number": "8 bytes",
|
||||
// "SubFrame Number/ExpLength": "4 bytes",
|
||||
// "Packet Number": "4 bytes",
|
||||
// "Bunch ID": "8 bytes",
|
||||
// "Timestamp": "8 bytes",
|
||||
// "Module Id": "2 bytes",
|
||||
// "Row": "2 bytes",
|
||||
// "Column": "2 bytes",
|
||||
// "Reserved": "2 bytes",
|
||||
// "Debug": "4 bytes",
|
||||
// "Round Robin Number": "2 bytes",
|
||||
// "Detector Type": "1 byte",
|
||||
// "Header Version": "1 byte",
|
||||
// "Packets Caught Mask": "64 bytes"
|
||||
// }
|
||||
// }
|
||||
|
||||
REQUIRE_FALSE(f.analog_samples());
|
||||
REQUIRE_FALSE(f.digital_samples());
|
||||
REQUIRE_FALSE(f.rate_corrections().has_value());
|
||||
REQUIRE_FALSE(f.adc_mask().has_value());
|
||||
REQUIRE_FALSE(f.analog_flag());
|
||||
REQUIRE_FALSE(f.analog_samples().has_value());
|
||||
REQUIRE_FALSE(f.digital_flag());
|
||||
REQUIRE_FALSE(f.digital_samples().has_value());
|
||||
REQUIRE_FALSE(f.dbit_offset().has_value());
|
||||
REQUIRE_FALSE(f.dbit_list().has_value());
|
||||
REQUIRE_FALSE(f.transceiver_mask().has_value());
|
||||
REQUIRE_FALSE(f.transceiver_flag());
|
||||
REQUIRE_FALSE(f.transceiver_samples().has_value());
|
||||
REQUIRE_FALSE(f.roi().has_value());
|
||||
REQUIRE_FALSE(f.counter_mask().has_value());
|
||||
REQUIRE_FALSE(f.exptime_array().has_value());
|
||||
REQUIRE_FALSE(f.gate_delay_array().has_value());
|
||||
REQUIRE_FALSE(f.gates().has_value());
|
||||
REQUIRE_FALSE(f.additional_json_header().has_value());
|
||||
REQUIRE(f.frames_in_file() == 5);
|
||||
REQUIRE(f.n_modules() == 2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user