mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-07 12:18:39 +01:00
fixed imagesize ctb issue (out values not transferred, setting any dbit values was not recalculatign image size in generaldata)
This commit is contained in:
@@ -281,6 +281,6 @@ def hostname_list(args):
|
|||||||
|
|
||||||
|
|
||||||
def validate_port(value):
|
def validate_port(value):
|
||||||
if value <= 0 or value > 65535:
|
if value < 1024 or value > 65535:
|
||||||
raise ValueError("port must be in range 1 - 65535")
|
raise ValueError("port must be in range 1 - 65535")
|
||||||
|
|
||||||
|
|||||||
@@ -1299,7 +1299,7 @@ Result<uint16_t> Detector::getRxPort(Positions pos) const {
|
|||||||
|
|
||||||
void Detector::setRxPort(uint16_t port, int module_id) {
|
void Detector::setRxPort(uint16_t port, int module_id) {
|
||||||
if (module_id == -1) {
|
if (module_id == -1) {
|
||||||
validatePortRange(port, size() - 1);
|
validatePortRange(port, size());
|
||||||
|
|
||||||
std::vector<uint16_t> port_list(size());
|
std::vector<uint16_t> port_list(size());
|
||||||
std::iota(std::begin(port_list), std::end(port_list), port);
|
std::iota(std::begin(port_list), std::end(port_list), port);
|
||||||
@@ -2828,7 +2828,7 @@ std::vector<uint16_t> Detector::getValidPortNumbers(uint16_t start_port) {
|
|||||||
int num_sockets_per_detector = getNumberofUDPInterfaces({}).tsquash(
|
int num_sockets_per_detector = getNumberofUDPInterfaces({}).tsquash(
|
||||||
"Number of UDP Interfaces is not consistent among modules");
|
"Number of UDP Interfaces is not consistent among modules");
|
||||||
|
|
||||||
validatePortRange(start_port, (size() - 1) * num_sockets_per_detector);
|
validatePortRange(start_port, size() * num_sockets_per_detector);
|
||||||
|
|
||||||
std::vector<uint16_t> res;
|
std::vector<uint16_t> res;
|
||||||
res.reserve(size());
|
res.reserve(size());
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ void test_ctb_file_size_with_acquire(Detector &det, Caller &caller,
|
|||||||
int64_t num_frames,
|
int64_t num_frames,
|
||||||
const testCtbAcquireInfo &test_info,
|
const testCtbAcquireInfo &test_info,
|
||||||
bool isXilinxCtb) {
|
bool isXilinxCtb) {
|
||||||
|
|
||||||
create_files_for_acquire(det, caller, num_frames, test_info);
|
create_files_for_acquire(det, caller, num_frames, test_info);
|
||||||
|
|
||||||
// check file size (assuming local pc)
|
// check file size (assuming local pc)
|
||||||
@@ -161,14 +162,14 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
int num_frames_to_acquire = 2;
|
int num_frames_to_acquire = 2;
|
||||||
// all the test cases
|
// all the test cases
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
det, caller, num_frames_to_acquire, test_ctb_config,
|
det, caller, num_frames_to_acquire, test_ctb_config,
|
||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
@@ -176,7 +177,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
test_ctb_config.dbit_reorder = true;
|
test_ctb_config.dbit_reorder = true;
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
@@ -184,7 +185,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_reorder = true;
|
test_ctb_config.dbit_reorder = true;
|
||||||
@@ -193,7 +194,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
@@ -202,7 +203,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
@@ -212,14 +213,14 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
det, caller, num_frames_to_acquire, test_ctb_config,
|
det, caller, num_frames_to_acquire, test_ctb_config,
|
||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
@@ -227,7 +228,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
REQUIRE_NOTHROW(test_ctb_file_size_with_acquire(
|
||||||
@@ -235,7 +236,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
@@ -244,7 +245,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
@@ -254,7 +255,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::TRANSCEIVER_ONLY;
|
test_ctb_config.readout_mode = defs::TRANSCEIVER_ONLY;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
@@ -264,7 +265,7 @@ TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
|
|||||||
isXilinxCtb));
|
isXilinxCtb));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_ONLY;
|
test_ctb_config.readout_mode = defs::ANALOG_ONLY;
|
||||||
test_ctb_config.dbit_offset = 16;
|
test_ctb_config.dbit_offset = 16;
|
||||||
test_ctb_config.dbit_list.clear();
|
test_ctb_config.dbit_list.clear();
|
||||||
|
|||||||
@@ -149,8 +149,9 @@ void test_acquire_with_receiver(Caller &caller, const Detector &det) {
|
|||||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_files_for_acquire(Detector &det, Caller &caller, int64_t num_frames,
|
void create_files_for_acquire(
|
||||||
std::optional<testCtbAcquireInfo> test_info) {
|
Detector &det, Caller &caller, int64_t num_frames,
|
||||||
|
const std::optional<testCtbAcquireInfo> &test_info) {
|
||||||
|
|
||||||
// save previous state
|
// save previous state
|
||||||
testFileInfo prev_file_info = get_file_state(det);
|
testFileInfo prev_file_info = get_file_state(det);
|
||||||
@@ -248,7 +249,9 @@ std::pair<uint64_t, int>
|
|||||||
calculate_ctb_image_size(const testCtbAcquireInfo &test_info,
|
calculate_ctb_image_size(const testCtbAcquireInfo &test_info,
|
||||||
bool isXilinxCtb) {
|
bool isXilinxCtb) {
|
||||||
|
|
||||||
|
// test_info.print(); // for debugging
|
||||||
sls::CtbImageInputs inputs{};
|
sls::CtbImageInputs inputs{};
|
||||||
|
inputs.mode = test_info.readout_mode;
|
||||||
inputs.nAnalogSamples = test_info.num_adc_samples;
|
inputs.nAnalogSamples = test_info.num_adc_samples;
|
||||||
inputs.adcMask = test_info.adc_enable_10g;
|
inputs.adcMask = test_info.adc_enable_10g;
|
||||||
if (!isXilinxCtb && !test_info.ten_giga) {
|
if (!isXilinxCtb && !test_info.ten_giga) {
|
||||||
@@ -258,8 +261,8 @@ calculate_ctb_image_size(const testCtbAcquireInfo &test_info,
|
|||||||
inputs.transceiverMask = test_info.transceiver_mask;
|
inputs.transceiverMask = test_info.transceiver_mask;
|
||||||
inputs.nDigitalSamples = test_info.num_dbit_samples;
|
inputs.nDigitalSamples = test_info.num_dbit_samples;
|
||||||
inputs.dbitOffset = test_info.dbit_offset;
|
inputs.dbitOffset = test_info.dbit_offset;
|
||||||
inputs.dbitList = test_info.dbit_list;
|
|
||||||
inputs.dbitReorder = test_info.dbit_reorder;
|
inputs.dbitReorder = test_info.dbit_reorder;
|
||||||
|
inputs.dbitList = test_info.dbit_list;
|
||||||
|
|
||||||
auto out = computeCtbImageSize(inputs);
|
auto out = computeCtbImageSize(inputs);
|
||||||
uint64_t image_size =
|
uint64_t image_size =
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "Caller.h"
|
#include "Caller.h"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
|
#include "sls/ToString.h"
|
||||||
|
#include "sls/logger.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -41,6 +43,23 @@ struct testCtbAcquireInfo {
|
|||||||
std::vector<int> dbit_list{0, 12, 2, 43};
|
std::vector<int> dbit_list{0, 12, 2, 43};
|
||||||
bool dbit_reorder{false};
|
bool dbit_reorder{false};
|
||||||
uint32_t transceiver_mask{0x3};
|
uint32_t transceiver_mask{0x3};
|
||||||
|
|
||||||
|
inline void print() const {
|
||||||
|
LOG(logINFO) << "CTB Acquire Info: "
|
||||||
|
<< "\n\tReadout Mode: " << ToString(readout_mode)
|
||||||
|
<< "\n\tTen Giga: " << ten_giga
|
||||||
|
<< "\n\tADC Enable 1G: " << std::hex << adc_enable_1g
|
||||||
|
<< std::dec << "\n\tADC Enable 10G: " << std::hex
|
||||||
|
<< adc_enable_10g << std::dec
|
||||||
|
<< "\n\tNumber of Analog Samples: " << num_adc_samples
|
||||||
|
<< "\n\tNumber of Digital Samples: " << num_dbit_samples
|
||||||
|
<< "\n\tNumber of Transceiver Samples: "
|
||||||
|
<< num_trans_samples << "\n\tDBIT Offset: " << dbit_offset
|
||||||
|
<< "\n\tDBIT Reorder: " << dbit_reorder
|
||||||
|
<< "\n\tDBIT List: " << ToString(dbit_list)
|
||||||
|
<< "\n\tTransceiver Mask: " << std::hex << transceiver_mask
|
||||||
|
<< std::dec << std::endl;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_valid_port_caller(const std::string &command,
|
void test_valid_port_caller(const std::string &command,
|
||||||
@@ -64,7 +83,7 @@ void test_acquire_with_receiver(Caller &caller, const Detector &det);
|
|||||||
|
|
||||||
void create_files_for_acquire(
|
void create_files_for_acquire(
|
||||||
Detector &det, Caller &caller, int64_t num_frames = 1,
|
Detector &det, Caller &caller, int64_t num_frames = 1,
|
||||||
std::optional<testCtbAcquireInfo> test_info = std::nullopt);
|
const std::optional<testCtbAcquireInfo> &test_info = std::nullopt);
|
||||||
|
|
||||||
testCtbAcquireInfo get_ctb_config_state(const Detector &det);
|
testCtbAcquireInfo get_ctb_config_state(const Detector &det);
|
||||||
void set_ctb_config_state(Detector &det,
|
void set_ctb_config_state(Detector &det,
|
||||||
|
|||||||
@@ -355,15 +355,15 @@ void test_master_file_version(const Detector &det,
|
|||||||
void test_master_file_type(const Detector &det,
|
void test_master_file_type(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto det_type = det.getDetectorType().tsquash("Inconsistent detector type");
|
auto det_type = det.getDetectorType().tsquash("Inconsistent detector type");
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_DETECTOR_TYPE.data(), ToString(det_type));
|
doc, MasterAttributes::N_DETECTOR_TYPE.data(), ToString(det_type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_timing_mode(const Detector &det,
|
void test_master_file_timing_mode(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto timing_mode = det.getTimingMode().tsquash("Inconsistent timing mode");
|
auto timing_mode = det.getTimingMode().tsquash("Inconsistent timing mode");
|
||||||
check_master_file<std::string>(doc, MasterAttributes::N_TIMING_MODE.data(),
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
ToString(timing_mode));
|
doc, MasterAttributes::N_TIMING_MODE.data(), ToString(timing_mode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_geometry(const Detector &det,
|
void test_master_file_geometry(const Detector &det,
|
||||||
@@ -372,8 +372,8 @@ void test_master_file_geometry(const Detector &det,
|
|||||||
auto portperModGeometry = det.getPortPerModuleGeometry();
|
auto portperModGeometry = det.getPortPerModuleGeometry();
|
||||||
auto geometry = defs::xy{modGeometry.x * portperModGeometry.x,
|
auto geometry = defs::xy{modGeometry.x * portperModGeometry.x,
|
||||||
modGeometry.y * portperModGeometry.y};
|
modGeometry.y * portperModGeometry.y};
|
||||||
check_master_file<defs::xy>(doc, MasterAttributes::N_GEOMETRY.data(),
|
REQUIRE_NOTHROW(check_master_file<defs::xy>(
|
||||||
geometry);
|
doc, MasterAttributes::N_GEOMETRY.data(), geometry));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_image_size(const Detector &det,
|
void test_master_file_image_size(const Detector &det,
|
||||||
@@ -415,7 +415,7 @@ void test_master_file_image_size(const Detector &det,
|
|||||||
|
|
||||||
case defs::CHIPTESTBOARD:
|
case defs::CHIPTESTBOARD:
|
||||||
case defs::XILINX_CHIPTESTBOARD: {
|
case defs::XILINX_CHIPTESTBOARD: {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
image_size = calculate_ctb_image_size(
|
image_size = calculate_ctb_image_size(
|
||||||
test_info, (det_type == defs::XILINX_CHIPTESTBOARD))
|
test_info, (det_type == defs::XILINX_CHIPTESTBOARD))
|
||||||
.first;
|
.first;
|
||||||
@@ -425,8 +425,8 @@ void test_master_file_image_size(const Detector &det,
|
|||||||
throw sls::RuntimeError("Unsupported detector type for this test");
|
throw sls::RuntimeError("Unsupported detector type for this test");
|
||||||
}
|
}
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_IMAGE_SIZE.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
image_size);
|
doc, MasterAttributes::N_IMAGE_SIZE.data(), image_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_det_size(const Detector &det,
|
void test_master_file_det_size(const Detector &det,
|
||||||
@@ -446,15 +446,15 @@ void test_master_file_det_size(const Detector &det,
|
|||||||
portSize.x = nchan * num_counters;
|
portSize.x = nchan * num_counters;
|
||||||
} else if (det_type == defs::CHIPTESTBOARD ||
|
} else if (det_type == defs::CHIPTESTBOARD ||
|
||||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
portSize.x = calculate_ctb_image_size(
|
portSize.x = calculate_ctb_image_size(
|
||||||
test_info, det_type == defs::XILINX_CHIPTESTBOARD)
|
test_info, det_type == defs::XILINX_CHIPTESTBOARD)
|
||||||
.second;
|
.second;
|
||||||
portSize.y = 1;
|
portSize.y = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_master_file<defs::xy>(doc, MasterAttributes::N_PIXELS.data(),
|
REQUIRE_NOTHROW(check_master_file<defs::xy>(
|
||||||
portSize);
|
doc, MasterAttributes::N_PIXELS.data(), portSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_max_frames_per_file(const Detector &det,
|
void test_master_file_max_frames_per_file(const Detector &det,
|
||||||
@@ -462,8 +462,9 @@ void test_master_file_max_frames_per_file(const Detector &det,
|
|||||||
auto max_frames_per_file =
|
auto max_frames_per_file =
|
||||||
det.getFramesPerFile().tsquash("Inconsistent max frames per file");
|
det.getFramesPerFile().tsquash("Inconsistent max frames per file");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_MAX_FRAMES_PER_FILE.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
max_frames_per_file);
|
doc, MasterAttributes::N_MAX_FRAMES_PER_FILE.data(),
|
||||||
|
max_frames_per_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_frame_discard_policy(const Detector &det,
|
void test_master_file_frame_discard_policy(const Detector &det,
|
||||||
@@ -471,8 +472,9 @@ void test_master_file_frame_discard_policy(const Detector &det,
|
|||||||
auto policy = det.getRxFrameDiscardPolicy().tsquash(
|
auto policy = det.getRxFrameDiscardPolicy().tsquash(
|
||||||
"Inconsistent frame discard policy");
|
"Inconsistent frame discard policy");
|
||||||
|
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_FRAME_DISCARD_POLICY.data(), ToString(policy));
|
doc, MasterAttributes::N_FRAME_DISCARD_POLICY.data(),
|
||||||
|
ToString(policy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_frame_padding(const Detector &det,
|
void test_master_file_frame_padding(const Detector &det,
|
||||||
@@ -480,16 +482,16 @@ void test_master_file_frame_padding(const Detector &det,
|
|||||||
auto padding = static_cast<int>(
|
auto padding = static_cast<int>(
|
||||||
det.getPartialFramesPadding().tsquash("Inconsistent frame padding"));
|
det.getPartialFramesPadding().tsquash("Inconsistent frame padding"));
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_FRAME_PADDING.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
padding);
|
doc, MasterAttributes::N_FRAME_PADDING.data(), padding));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_scan_parameters(const Detector &det,
|
void test_master_file_scan_parameters(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto scan_params = det.getScan().tsquash("Inconsistent scan parameters");
|
auto scan_params = det.getScan().tsquash("Inconsistent scan parameters");
|
||||||
|
|
||||||
check_master_file<defs::scanParameters>(
|
REQUIRE_NOTHROW(check_master_file<defs::scanParameters>(
|
||||||
doc, MasterAttributes::N_SCAN_PARAMETERS.data(), scan_params);
|
doc, MasterAttributes::N_SCAN_PARAMETERS.data(), scan_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_total_frames(const Detector &det,
|
void test_master_file_total_frames(const Detector &det,
|
||||||
@@ -535,8 +537,8 @@ void test_master_file_total_frames(const Detector &det,
|
|||||||
uint64_t total_frames =
|
uint64_t total_frames =
|
||||||
numFrames * repeats * (int64_t)(numAdditionalStorageCells + 1);
|
numFrames * repeats * (int64_t)(numAdditionalStorageCells + 1);
|
||||||
|
|
||||||
check_master_file<uint64_t>(doc, MasterAttributes::N_TOTAL_FRAMES.data(),
|
REQUIRE_NOTHROW(check_master_file<uint64_t>(
|
||||||
total_frames);
|
doc, MasterAttributes::N_TOTAL_FRAMES.data(), total_frames));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_rois(const Detector &det,
|
void test_master_file_rois(const Detector &det,
|
||||||
@@ -566,24 +568,24 @@ void test_master_file_rois(const Detector &det,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_master_file<std::vector<defs::ROI>>(
|
REQUIRE_NOTHROW(check_master_file<std::vector<defs::ROI>>(
|
||||||
doc, MasterAttributes::N_RECEIVER_ROIS.data(), rois);
|
doc, MasterAttributes::N_RECEIVER_ROIS.data(), rois));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_exptime(const Detector &det,
|
void test_master_file_exptime(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto exptime = det.getExptime().tsquash("Inconsistent exposure time");
|
auto exptime = det.getExptime().tsquash("Inconsistent exposure time");
|
||||||
|
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_EXPOSURE_TIME.data(), ToString(exptime));
|
doc, MasterAttributes::N_EXPOSURE_TIME.data(), ToString(exptime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_period(const Detector &det,
|
void test_master_file_period(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto period = det.getPeriod().tsquash("Inconsistent period");
|
auto period = det.getPeriod().tsquash("Inconsistent period");
|
||||||
|
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_ACQUISITION_PERIOD.data(), ToString(period));
|
doc, MasterAttributes::N_ACQUISITION_PERIOD.data(), ToString(period)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_num_udp_interfaces(const Detector &det,
|
void test_master_file_num_udp_interfaces(const Detector &det,
|
||||||
@@ -591,16 +593,17 @@ void test_master_file_num_udp_interfaces(const Detector &det,
|
|||||||
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
"Inconsistent number of UDP interfaces");
|
"Inconsistent number of UDP interfaces");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_NUM_UDP_INTERFACES.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
num_udp_interfaces);
|
doc, MasterAttributes::N_NUM_UDP_INTERFACES.data(),
|
||||||
|
num_udp_interfaces));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_read_n_rows(const Detector &det,
|
void test_master_file_read_n_rows(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto readnrows = det.getReadNRows().tsquash("Inconsistent number of rows");
|
auto readnrows = det.getReadNRows().tsquash("Inconsistent number of rows");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_NUMBER_OF_ROWS.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
readnrows);
|
doc, MasterAttributes::N_NUMBER_OF_ROWS.data(), readnrows));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_readout_speed(const Detector &det,
|
void test_master_file_readout_speed(const Detector &det,
|
||||||
@@ -608,14 +611,15 @@ void test_master_file_readout_speed(const Detector &det,
|
|||||||
auto readout_speed =
|
auto readout_speed =
|
||||||
det.getReadoutSpeed().tsquash("Inconsistent readout speed");
|
det.getReadoutSpeed().tsquash("Inconsistent readout speed");
|
||||||
|
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_READOUT_SPEED.data(), ToString(readout_speed));
|
doc, MasterAttributes::N_READOUT_SPEED.data(),
|
||||||
|
ToString(readout_speed)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_frames_in_file(const std::optional<Document> &doc,
|
void test_master_file_frames_in_file(const std::optional<Document> &doc,
|
||||||
const int frames_in_file) {
|
const int frames_in_file) {
|
||||||
check_master_file<int>(doc, MasterAttributes::N_FRAMES_IN_FILE.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
frames_in_file);
|
doc, MasterAttributes::N_FRAMES_IN_FILE.data(), frames_in_file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_json_header(const Detector &det,
|
void test_master_file_json_header(const Detector &det,
|
||||||
@@ -623,15 +627,16 @@ void test_master_file_json_header(const Detector &det,
|
|||||||
auto json_header =
|
auto json_header =
|
||||||
det.getAdditionalJsonHeader().tsquash("Inconsistent JSON header");
|
det.getAdditionalJsonHeader().tsquash("Inconsistent JSON header");
|
||||||
|
|
||||||
check_master_file<std::map<std::string, std::string>>(
|
REQUIRE_NOTHROW(check_master_file<std::map<std::string, std::string>>(
|
||||||
doc, MasterAttributes::N_ADDITIONAL_JSON_HEADER.data(), json_header);
|
doc, MasterAttributes::N_ADDITIONAL_JSON_HEADER.data(), json_header));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_dynamic_range(const Detector &det,
|
void test_master_file_dynamic_range(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto dr = det.getDynamicRange().tsquash("Inconsistent dynamic range");
|
auto dr = det.getDynamicRange().tsquash("Inconsistent dynamic range");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_DYNAMIC_RANGE.data(), dr);
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
|
doc, MasterAttributes::N_DYNAMIC_RANGE.data(), dr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_ten_giga(const Detector &det,
|
void test_master_file_ten_giga(const Detector &det,
|
||||||
@@ -639,7 +644,8 @@ void test_master_file_ten_giga(const Detector &det,
|
|||||||
auto ten_giga =
|
auto ten_giga =
|
||||||
static_cast<int>(det.getTenGiga().tsquash("Inconsistent ten giga"));
|
static_cast<int>(det.getTenGiga().tsquash("Inconsistent ten giga"));
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_TEN_GIGA.data(), ten_giga);
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
|
doc, MasterAttributes::N_TEN_GIGA.data(), ten_giga));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_threshold_energy(const Detector &det,
|
void test_master_file_threshold_energy(const Detector &det,
|
||||||
@@ -647,8 +653,8 @@ void test_master_file_threshold_energy(const Detector &det,
|
|||||||
auto threshold =
|
auto threshold =
|
||||||
det.getThresholdEnergy().tsquash("Inconsistent threshold energy");
|
det.getThresholdEnergy().tsquash("Inconsistent threshold energy");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_THRESHOLD_ENERGY.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
threshold);
|
doc, MasterAttributes::N_THRESHOLD_ENERGY.data(), threshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_sub_exptime(const Detector &det,
|
void test_master_file_sub_exptime(const Detector &det,
|
||||||
@@ -656,9 +662,9 @@ void test_master_file_sub_exptime(const Detector &det,
|
|||||||
auto sub_exptime =
|
auto sub_exptime =
|
||||||
det.getSubExptime().tsquash("Inconsistent sub exposure time");
|
det.getSubExptime().tsquash("Inconsistent sub exposure time");
|
||||||
|
|
||||||
check_master_file<std::string>(doc,
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
MasterAttributes::N_SUB_EXPOSURE_TIME.data(),
|
doc, MasterAttributes::N_SUB_EXPOSURE_TIME.data(),
|
||||||
ToString(sub_exptime));
|
ToString(sub_exptime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_sub_period(const Detector &det,
|
void test_master_file_sub_period(const Detector &det,
|
||||||
@@ -667,16 +673,17 @@ void test_master_file_sub_period(const Detector &det,
|
|||||||
auto deadtime = det.getSubDeadTime().tsquash("Inconsistent sub deadtime");
|
auto deadtime = det.getSubDeadTime().tsquash("Inconsistent sub deadtime");
|
||||||
auto sub_period = exptime + deadtime;
|
auto sub_period = exptime + deadtime;
|
||||||
|
|
||||||
check_master_file<std::string>(
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
doc, MasterAttributes::N_SUB_ACQUISITION_PERIOD.data(),
|
doc, MasterAttributes::N_SUB_ACQUISITION_PERIOD.data(),
|
||||||
ToString(sub_period));
|
ToString(sub_period)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_quad(const Detector &det,
|
void test_master_file_quad(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto quad = static_cast<int>(det.getQuad().tsquash("Inconsistent quad"));
|
auto quad = static_cast<int>(det.getQuad().tsquash("Inconsistent quad"));
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_QUAD.data(), quad);
|
REQUIRE_NOTHROW(
|
||||||
|
check_master_file<int>(doc, MasterAttributes::N_QUAD.data(), quad));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_rate_corrections(const Detector &det,
|
void test_master_file_rate_corrections(const Detector &det,
|
||||||
@@ -685,8 +692,8 @@ void test_master_file_rate_corrections(const Detector &det,
|
|||||||
for (auto item : det.getRateCorrection())
|
for (auto item : det.getRateCorrection())
|
||||||
dead_times.push_back(item.count());
|
dead_times.push_back(item.count());
|
||||||
|
|
||||||
check_master_file<std::vector<int64_t>>(
|
REQUIRE_NOTHROW(check_master_file<std::vector<int64_t>>(
|
||||||
doc, MasterAttributes::N_RATE_CORRECTIONS.data(), dead_times);
|
doc, MasterAttributes::N_RATE_CORRECTIONS.data(), dead_times));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_counter_mask(const Detector &det,
|
void test_master_file_counter_mask(const Detector &det,
|
||||||
@@ -694,8 +701,8 @@ void test_master_file_counter_mask(const Detector &det,
|
|||||||
auto counter_mask = static_cast<int>(
|
auto counter_mask = static_cast<int>(
|
||||||
det.getCounterMask().tsquash("Inconsistent counter mask"));
|
det.getCounterMask().tsquash("Inconsistent counter mask"));
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_COUNTER_MASK.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
counter_mask);
|
doc, MasterAttributes::N_COUNTER_MASK.data(), counter_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_exptimes(const Detector &det,
|
void test_master_file_exptimes(const Detector &det,
|
||||||
@@ -703,8 +710,8 @@ void test_master_file_exptimes(const Detector &det,
|
|||||||
auto exptimes =
|
auto exptimes =
|
||||||
det.getExptimeForAllGates().tsquash("Inconsistent exposure times");
|
det.getExptimeForAllGates().tsquash("Inconsistent exposure times");
|
||||||
|
|
||||||
check_master_file<std::array<sls::ns, 3UL>>(
|
REQUIRE_NOTHROW(check_master_file<std::array<sls::ns, 3UL>>(
|
||||||
doc, MasterAttributes::N_EXPOSURE_TIMES.data(), exptimes);
|
doc, MasterAttributes::N_EXPOSURE_TIMES.data(), exptimes));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_gate_delays(const Detector &det,
|
void test_master_file_gate_delays(const Detector &det,
|
||||||
@@ -712,15 +719,16 @@ void test_master_file_gate_delays(const Detector &det,
|
|||||||
auto gate_delays =
|
auto gate_delays =
|
||||||
det.getGateDelayForAllGates().tsquash("Inconsistent GateDelay");
|
det.getGateDelayForAllGates().tsquash("Inconsistent GateDelay");
|
||||||
|
|
||||||
check_master_file<std::array<sls::ns, 3UL>>(
|
REQUIRE_NOTHROW(check_master_file<std::array<sls::ns, 3UL>>(
|
||||||
doc, MasterAttributes::N_GATE_DELAYS.data(), gate_delays);
|
doc, MasterAttributes::N_GATE_DELAYS.data(), gate_delays));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_gates(const Detector &det,
|
void test_master_file_gates(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto gates = det.getNumberOfGates().tsquash("Inconsistent number of gates");
|
auto gates = det.getNumberOfGates().tsquash("Inconsistent number of gates");
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_GATES.data(), gates);
|
REQUIRE_NOTHROW(
|
||||||
|
check_master_file<int>(doc, MasterAttributes::N_GATES.data(), gates));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_threadhold_energies(const Detector &det,
|
void test_master_file_threadhold_energies(const Detector &det,
|
||||||
@@ -728,21 +736,22 @@ void test_master_file_threadhold_energies(const Detector &det,
|
|||||||
auto threshold_energies =
|
auto threshold_energies =
|
||||||
det.getAllThresholdEnergy().tsquash("Inconsistent threshold energies");
|
det.getAllThresholdEnergy().tsquash("Inconsistent threshold energies");
|
||||||
|
|
||||||
check_master_file<std::array<int, 3UL>>(
|
REQUIRE_NOTHROW(check_master_file<std::array<int, 3UL>>(
|
||||||
doc, MasterAttributes::N_THRESHOLD_ENERGIES.data(), threshold_energies);
|
doc, MasterAttributes::N_THRESHOLD_ENERGIES.data(),
|
||||||
|
threshold_energies));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_burst_mode(const Detector &det,
|
void test_master_file_burst_mode(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto burst_mode = det.getBurstMode().tsquash("Inconsistent burst mode");
|
auto burst_mode = det.getBurstMode().tsquash("Inconsistent burst mode");
|
||||||
|
|
||||||
check_master_file<std::string>(doc, MasterAttributes::N_BURST_MODE.data(),
|
REQUIRE_NOTHROW(check_master_file<std::string>(
|
||||||
ToString(burst_mode));
|
doc, MasterAttributes::N_BURST_MODE.data(), ToString(burst_mode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_adc_mask(const Detector &det,
|
void test_master_file_adc_mask(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
auto adc_mask = test_ctb_config.adc_enable_10g;
|
auto adc_mask = test_ctb_config.adc_enable_10g;
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
@@ -751,104 +760,107 @@ void test_master_file_adc_mask(const Detector &det,
|
|||||||
adc_mask = test_ctb_config.adc_enable_1g;
|
adc_mask = test_ctb_config.adc_enable_1g;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_master_file<uint32_t>(doc, MasterAttributes::N_ADC_MASK.data(),
|
REQUIRE_NOTHROW(check_master_file<uint32_t>(
|
||||||
adc_mask);
|
doc, MasterAttributes::N_ADC_MASK.data(), adc_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_analog_flag(const Detector &det,
|
void test_master_file_analog_flag(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto romode = test_info.readout_mode;
|
auto romode = test_info.readout_mode;
|
||||||
auto analog = static_cast<int>(
|
auto analog = static_cast<int>(
|
||||||
(romode == defs::ANALOG_ONLY || romode == defs::ANALOG_AND_DIGITAL));
|
(romode == defs::ANALOG_ONLY || romode == defs::ANALOG_AND_DIGITAL));
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_ANALOG.data(), analog);
|
REQUIRE_NOTHROW(
|
||||||
|
check_master_file<int>(doc, MasterAttributes::N_ANALOG.data(), analog));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_analog_samples(const Detector &det,
|
void test_master_file_analog_samples(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto analog_samples = test_info.num_adc_samples;
|
auto analog_samples = test_info.num_adc_samples;
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_ANALOG_SAMPLES.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
analog_samples);
|
doc, MasterAttributes::N_ANALOG_SAMPLES.data(), analog_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_digital_flag(const Detector &det,
|
void test_master_file_digital_flag(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto romode = test_info.readout_mode;
|
auto romode = test_info.readout_mode;
|
||||||
auto digital = static_cast<int>(romode == defs::DIGITAL_ONLY ||
|
auto digital = static_cast<int>(romode == defs::DIGITAL_ONLY ||
|
||||||
romode == defs::ANALOG_AND_DIGITAL ||
|
romode == defs::ANALOG_AND_DIGITAL ||
|
||||||
romode == defs::DIGITAL_AND_TRANSCEIVER);
|
romode == defs::DIGITAL_AND_TRANSCEIVER);
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_DIGITAL.data(), digital);
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
|
doc, MasterAttributes::N_DIGITAL.data(), digital));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_digital_samples(const Detector &det,
|
void test_master_file_digital_samples(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto digital_samples = test_info.num_dbit_samples;
|
auto digital_samples = test_info.num_dbit_samples;
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_DIGITAL_SAMPLES.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
digital_samples);
|
doc, MasterAttributes::N_DIGITAL_SAMPLES.data(), digital_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_dbit_offset(const Detector &det,
|
void test_master_file_dbit_offset(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto dbit_offset = test_info.dbit_offset;
|
auto dbit_offset = test_info.dbit_offset;
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_DBIT_OFFSET.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
dbit_offset);
|
doc, MasterAttributes::N_DBIT_OFFSET.data(), dbit_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_dbit_reorder(const Detector &det,
|
void test_master_file_dbit_reorder(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto dbit_reorder = test_info.dbit_reorder;
|
auto dbit_reorder = test_info.dbit_reorder;
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_DBIT_REORDER.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
dbit_reorder);
|
doc, MasterAttributes::N_DBIT_REORDER.data(), dbit_reorder));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_dbit_bitset(const Detector &det,
|
void test_master_file_dbit_bitset(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
uint64_t dbit_bitset = 0;
|
uint64_t dbit_bitset = 0;
|
||||||
for (auto &i : test_info.dbit_list) {
|
for (auto &i : test_info.dbit_list) {
|
||||||
dbit_bitset |= (static_cast<uint64_t>(1) << i);
|
dbit_bitset |= (static_cast<uint64_t>(1) << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_master_file<uint64_t>(doc, MasterAttributes::N_DBIT_BITSET.data(),
|
REQUIRE_NOTHROW(check_master_file<uint64_t>(
|
||||||
dbit_bitset);
|
doc, MasterAttributes::N_DBIT_BITSET.data(), dbit_bitset));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_transceiver_mask(const Detector &det,
|
void test_master_file_transceiver_mask(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto trans_mask = test_info.transceiver_mask;
|
auto trans_mask = test_info.transceiver_mask;
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_TRANSCEIVER_MASK.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
trans_mask);
|
doc, MasterAttributes::N_TRANSCEIVER_MASK.data(), trans_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_transceiver_flag(const Detector &det,
|
void test_master_file_transceiver_flag(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto romode = test_info.readout_mode;
|
auto romode = test_info.readout_mode;
|
||||||
auto trans = static_cast<int>(romode == defs::DIGITAL_AND_TRANSCEIVER ||
|
auto trans = static_cast<int>(romode == defs::DIGITAL_AND_TRANSCEIVER ||
|
||||||
romode == defs::TRANSCEIVER_ONLY);
|
romode == defs::TRANSCEIVER_ONLY);
|
||||||
|
|
||||||
check_master_file<int>(doc, MasterAttributes::N_TRANSCEIVER.data(), trans);
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
|
doc, MasterAttributes::N_TRANSCEIVER.data(), trans));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_transceiver_samples(const Detector &det,
|
void test_master_file_transceiver_samples(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
testCtbAcquireInfo test_info;
|
testCtbAcquireInfo test_info{};
|
||||||
auto trans_samples = test_info.num_trans_samples;
|
auto trans_samples = test_info.num_trans_samples;
|
||||||
check_master_file<int>(doc, MasterAttributes::N_TRANSCEIVER_SAMPLES.data(),
|
REQUIRE_NOTHROW(check_master_file<int>(
|
||||||
trans_samples);
|
doc, MasterAttributes::N_TRANSCEIVER_SAMPLES.data(), trans_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_common_metadata(const Detector &det,
|
void test_master_file_common_metadata(const Detector &det,
|
||||||
@@ -870,92 +882,92 @@ void test_master_file_common_metadata(const Detector &det,
|
|||||||
|
|
||||||
void test_master_file_jungfrau_metadata(const Detector &det,
|
void test_master_file_jungfrau_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Jungfrau specific metadata
|
// Jungfrau specific metadata
|
||||||
test_master_file_rois(det, doc);
|
REQUIRE_NOTHROW(test_master_file_rois(det, doc));
|
||||||
test_master_file_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptime(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
test_master_file_num_udp_interfaces(det, doc);
|
REQUIRE_NOTHROW(test_master_file_num_udp_interfaces(det, doc));
|
||||||
test_master_file_read_n_rows(det, doc);
|
REQUIRE_NOTHROW(test_master_file_read_n_rows(det, doc));
|
||||||
test_master_file_readout_speed(det, doc);
|
REQUIRE_NOTHROW(test_master_file_readout_speed(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_eiger_metadata(const Detector &det,
|
void test_master_file_eiger_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Eiger specific metadata
|
// Eiger specific metadata
|
||||||
test_master_file_rois(det, doc);
|
REQUIRE_NOTHROW(test_master_file_rois(det, doc));
|
||||||
test_master_file_dynamic_range(det, doc);
|
REQUIRE_NOTHROW(test_master_file_dynamic_range(det, doc));
|
||||||
test_master_file_ten_giga(det, doc);
|
REQUIRE_NOTHROW(test_master_file_ten_giga(det, doc));
|
||||||
test_master_file_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptime(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
test_master_file_threshold_energy(det, doc);
|
REQUIRE_NOTHROW(test_master_file_threshold_energy(det, doc));
|
||||||
test_master_file_sub_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_sub_exptime(det, doc));
|
||||||
test_master_file_sub_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_sub_period(det, doc));
|
||||||
test_master_file_quad(det, doc);
|
REQUIRE_NOTHROW(test_master_file_quad(det, doc));
|
||||||
test_master_file_read_n_rows(det, doc);
|
REQUIRE_NOTHROW(test_master_file_read_n_rows(det, doc));
|
||||||
test_master_file_rate_corrections(det, doc);
|
REQUIRE_NOTHROW(test_master_file_rate_corrections(det, doc));
|
||||||
test_master_file_readout_speed(det, doc);
|
REQUIRE_NOTHROW(test_master_file_readout_speed(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_moench_metadata(const Detector &det,
|
void test_master_file_moench_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Moench specific metadata
|
// Moench specific metadata
|
||||||
test_master_file_rois(det, doc);
|
REQUIRE_NOTHROW(test_master_file_rois(det, doc));
|
||||||
test_master_file_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptime(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
test_master_file_num_udp_interfaces(det, doc);
|
REQUIRE_NOTHROW(test_master_file_num_udp_interfaces(det, doc));
|
||||||
test_master_file_read_n_rows(det, doc);
|
REQUIRE_NOTHROW(test_master_file_read_n_rows(det, doc));
|
||||||
test_master_file_readout_speed(det, doc);
|
REQUIRE_NOTHROW(test_master_file_readout_speed(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_mythen3_metadata(const Detector &det,
|
void test_master_file_mythen3_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Mythen3 specific metadata
|
// Mythen3 specific metadata
|
||||||
test_master_file_rois(det, doc);
|
REQUIRE_NOTHROW(test_master_file_rois(det, doc));
|
||||||
test_master_file_dynamic_range(det, doc);
|
REQUIRE_NOTHROW(test_master_file_dynamic_range(det, doc));
|
||||||
test_master_file_ten_giga(det, doc);
|
REQUIRE_NOTHROW(test_master_file_ten_giga(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
test_master_file_counter_mask(det, doc);
|
REQUIRE_NOTHROW(test_master_file_counter_mask(det, doc));
|
||||||
test_master_file_exptimes(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptimes(det, doc));
|
||||||
test_master_file_gate_delays(det, doc);
|
REQUIRE_NOTHROW(test_master_file_gate_delays(det, doc));
|
||||||
test_master_file_gates(det, doc);
|
REQUIRE_NOTHROW(test_master_file_gates(det, doc));
|
||||||
test_master_file_threadhold_energies(det, doc);
|
REQUIRE_NOTHROW(test_master_file_threadhold_energies(det, doc));
|
||||||
test_master_file_readout_speed(det, doc);
|
REQUIRE_NOTHROW(test_master_file_readout_speed(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_gotthard2_metadata(const Detector &det,
|
void test_master_file_gotthard2_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Gotthard2 specific metadata
|
// Gotthard2 specific metadata
|
||||||
test_master_file_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptime(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
test_master_file_burst_mode(det, doc);
|
REQUIRE_NOTHROW(test_master_file_burst_mode(det, doc));
|
||||||
test_master_file_readout_speed(det, doc);
|
REQUIRE_NOTHROW(test_master_file_readout_speed(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_ctb_metadata(const Detector &det,
|
void test_master_file_ctb_metadata(const Detector &det,
|
||||||
const std::optional<Document> &doc) {
|
const std::optional<Document> &doc) {
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
test_master_file_common_metadata(det, doc);
|
REQUIRE_NOTHROW(test_master_file_common_metadata(det, doc));
|
||||||
// Ctb specific metadata
|
// Ctb specific metadata
|
||||||
test_master_file_exptime(det, doc);
|
REQUIRE_NOTHROW(test_master_file_exptime(det, doc));
|
||||||
test_master_file_period(det, doc);
|
REQUIRE_NOTHROW(test_master_file_period(det, doc));
|
||||||
if (det_type == defs::CHIPTESTBOARD)
|
if (det_type == defs::CHIPTESTBOARD)
|
||||||
test_master_file_ten_giga(det, doc);
|
REQUIRE_NOTHROW(test_master_file_ten_giga(det, doc));
|
||||||
test_master_file_adc_mask(det, doc);
|
REQUIRE_NOTHROW(test_master_file_adc_mask(det, doc));
|
||||||
test_master_file_analog_flag(det, doc);
|
REQUIRE_NOTHROW(test_master_file_analog_flag(det, doc));
|
||||||
test_master_file_analog_samples(det, doc);
|
REQUIRE_NOTHROW(test_master_file_analog_samples(det, doc));
|
||||||
test_master_file_digital_flag(det, doc);
|
REQUIRE_NOTHROW(test_master_file_digital_flag(det, doc));
|
||||||
test_master_file_digital_samples(det, doc);
|
REQUIRE_NOTHROW(test_master_file_digital_samples(det, doc));
|
||||||
test_master_file_dbit_offset(det, doc);
|
REQUIRE_NOTHROW(test_master_file_dbit_offset(det, doc));
|
||||||
test_master_file_dbit_reorder(det, doc);
|
REQUIRE_NOTHROW(test_master_file_dbit_reorder(det, doc));
|
||||||
test_master_file_dbit_bitset(det, doc);
|
REQUIRE_NOTHROW(test_master_file_dbit_bitset(det, doc));
|
||||||
test_master_file_transceiver_mask(det, doc);
|
REQUIRE_NOTHROW(test_master_file_transceiver_mask(det, doc));
|
||||||
test_master_file_transceiver_flag(det, doc);
|
REQUIRE_NOTHROW(test_master_file_transceiver_flag(det, doc));
|
||||||
test_master_file_transceiver_samples(det, doc);
|
REQUIRE_NOTHROW(test_master_file_transceiver_samples(det, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_master_file_metadata(const Detector &det,
|
void test_master_file_metadata(const Detector &det,
|
||||||
@@ -1038,7 +1050,7 @@ TEST_CASE("check_master_file_attributes", "[.cmdcall][.cmdacquire][.cmdattr]") {
|
|||||||
break;
|
break;
|
||||||
case defs::CHIPTESTBOARD:
|
case defs::CHIPTESTBOARD:
|
||||||
case defs::XILINX_CHIPTESTBOARD: {
|
case defs::XILINX_CHIPTESTBOARD: {
|
||||||
testCtbAcquireInfo test_ctb_config;
|
testCtbAcquireInfo test_ctb_config{};
|
||||||
create_files_for_acquire(det, caller, num_frames, test_ctb_config);
|
create_files_for_acquire(det, caller, num_frames, test_ctb_config);
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace sls {
|
|||||||
|
|
||||||
struct CtbImageInputs {
|
struct CtbImageInputs {
|
||||||
slsDetectorDefs::readoutMode mode{slsDetectorDefs::ANALOG_ONLY};
|
slsDetectorDefs::readoutMode mode{slsDetectorDefs::ANALOG_ONLY};
|
||||||
|
|
||||||
int nAnalogSamples{};
|
int nAnalogSamples{};
|
||||||
uint32_t adcMask{};
|
uint32_t adcMask{};
|
||||||
int nTransceiverSamples{};
|
int nTransceiverSamples{};
|
||||||
@@ -29,6 +28,21 @@ struct CtbImageInputs {
|
|||||||
int dbitOffset{};
|
int dbitOffset{};
|
||||||
bool dbitReorder{};
|
bool dbitReorder{};
|
||||||
std::vector<int> dbitList{};
|
std::vector<int> dbitList{};
|
||||||
|
|
||||||
|
inline void print() const {
|
||||||
|
LOG(logINFO) << "CTB Image Inputs: "
|
||||||
|
<< "Readout Mode:" << ToString(mode)
|
||||||
|
<< "\n\tNumber of Analog Samples:" << nAnalogSamples
|
||||||
|
<< "\n\tADC Enable 1G:" << std::hex << adcMask << std::dec
|
||||||
|
<< "\n\tNumber of Transceiver Samples:"
|
||||||
|
<< nTransceiverSamples
|
||||||
|
<< "\n\tTransceiver Mask:" << std::hex << transceiverMask
|
||||||
|
<< std::dec
|
||||||
|
<< "\n\tNumber of Digital Samples:" << nDigitalSamples
|
||||||
|
<< "\n\tDBIT Offset:" << dbitOffset
|
||||||
|
<< "\n\tDBIT Reorder:" << dbitReorder
|
||||||
|
<< "\n\tDBIT List:" << ToString(dbitList);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CtbImageOutputs {
|
struct CtbImageOutputs {
|
||||||
@@ -37,15 +51,26 @@ struct CtbImageOutputs {
|
|||||||
int nDigitalBytesReserved{}; // including dbit offset and for 64 bits
|
int nDigitalBytesReserved{}; // including dbit offset and for 64 bits
|
||||||
int nTransceiverBytes{};
|
int nTransceiverBytes{};
|
||||||
int nPixelsX{};
|
int nPixelsX{};
|
||||||
|
|
||||||
|
inline void print() const {
|
||||||
|
LOG(logINFO) << "CTB Image Outputs: "
|
||||||
|
<< "\n\tNumber of Analog Bytes:" << nAnalogBytes
|
||||||
|
<< "\n\tNumber of Actual Digital Bytes:" << nDigitalBytes
|
||||||
|
<< "\n\tNumber of Digital Bytes Reserved:"
|
||||||
|
<< nDigitalBytesReserved
|
||||||
|
<< "\n\tNumber of Transceiver Bytes:" << nTransceiverBytes
|
||||||
|
<< "\n\tNumber of Pixels in X:" << nPixelsX;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline CtbImageOutputs computeCtbImageSize(const CtbImageInputs &in) {
|
inline CtbImageOutputs computeCtbImageSize(const CtbImageInputs &in) {
|
||||||
CtbImageOutputs out{};
|
CtbImageOutputs out{};
|
||||||
|
|
||||||
constexpr int num_bytes_per_analog_channel = 2;
|
constexpr int num_bytes_per_analog_channel = 2;
|
||||||
constexpr int num_bytes_per_transceiver_channel = 8;
|
constexpr int num_bytes_per_transceiver_channel = 8;
|
||||||
constexpr int max_digital_channels = 64;
|
constexpr int max_digital_channels = 64;
|
||||||
|
|
||||||
|
// in.print(); // for debugging
|
||||||
|
|
||||||
// analog channels (normal, analog/digital readout)
|
// analog channels (normal, analog/digital readout)
|
||||||
if (in.mode == slsDetectorDefs::ANALOG_ONLY ||
|
if (in.mode == slsDetectorDefs::ANALOG_ONLY ||
|
||||||
in.mode == slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
in.mode == slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||||
@@ -536,11 +561,20 @@ class ChipTestBoardData : public GeneralData {
|
|||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetctbDbitOffset(const int value) { ctbDbitOffset = value; }
|
void SetctbDbitOffset(const int value) {
|
||||||
|
ctbDbitOffset = value;
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetctbDbitList(const std::vector<int> &value) { ctbDbitList = value; }
|
void SetctbDbitList(const std::vector<int> &value) {
|
||||||
|
ctbDbitList = std::move(value);
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetctbDbitReorder(const bool value) { ctbDbitReorder = value; }
|
void SetctbDbitReorder(const bool value) {
|
||||||
|
ctbDbitReorder = value;
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetOneGigaAdcEnableMask(int n) {
|
void SetOneGigaAdcEnableMask(int n) {
|
||||||
adcEnableMaskOneGiga = n;
|
adcEnableMaskOneGiga = n;
|
||||||
@@ -574,6 +608,7 @@ class ChipTestBoardData : public GeneralData {
|
|||||||
|
|
||||||
// calculate image size
|
// calculate image size
|
||||||
CtbImageInputs inputs{};
|
CtbImageInputs inputs{};
|
||||||
|
inputs.mode = readoutType;
|
||||||
inputs.nAnalogSamples = nAnalogSamples;
|
inputs.nAnalogSamples = nAnalogSamples;
|
||||||
inputs.adcMask =
|
inputs.adcMask =
|
||||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
||||||
@@ -583,8 +618,13 @@ class ChipTestBoardData : public GeneralData {
|
|||||||
inputs.dbitOffset = ctbDbitOffset;
|
inputs.dbitOffset = ctbDbitOffset;
|
||||||
inputs.dbitList = ctbDbitList;
|
inputs.dbitList = ctbDbitList;
|
||||||
inputs.dbitReorder = ctbDbitReorder;
|
inputs.dbitReorder = ctbDbitReorder;
|
||||||
|
|
||||||
auto out = computeCtbImageSize(inputs);
|
auto out = computeCtbImageSize(inputs);
|
||||||
|
|
||||||
nPixelsX = out.nPixelsX;
|
nPixelsX = out.nPixelsX;
|
||||||
|
nAnalogBytes = out.nAnalogBytes;
|
||||||
|
nTransceiverBytes = out.nTransceiverBytes;
|
||||||
|
|
||||||
imageSize = out.nAnalogBytes + out.nDigitalBytesReserved +
|
imageSize = out.nAnalogBytes + out.nDigitalBytesReserved +
|
||||||
out.nTransceiverBytes;
|
out.nTransceiverBytes;
|
||||||
// to write to file: after ctb offset and reorder
|
// to write to file: after ctb offset and reorder
|
||||||
@@ -651,11 +691,20 @@ class XilinxChipTestBoardData : public GeneralData {
|
|||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetctbDbitOffset(const int value) { ctbDbitOffset = value; }
|
void SetctbDbitOffset(const int value) {
|
||||||
|
ctbDbitOffset = value;
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetctbDbitList(const std::vector<int> &value) { ctbDbitList = value; }
|
void SetctbDbitList(const std::vector<int> &value) {
|
||||||
|
ctbDbitList = std::move(value);
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetctbDbitReorder(const bool value) { ctbDbitReorder = value; }
|
void SetctbDbitReorder(const bool value) {
|
||||||
|
ctbDbitReorder = value;
|
||||||
|
UpdateImageSize();
|
||||||
|
}
|
||||||
|
|
||||||
void SetTenGigaAdcEnableMask(int n) {
|
void SetTenGigaAdcEnableMask(int n) {
|
||||||
adcEnableMaskTenGiga = n;
|
adcEnableMaskTenGiga = n;
|
||||||
@@ -679,6 +728,7 @@ class XilinxChipTestBoardData : public GeneralData {
|
|||||||
|
|
||||||
// calculate image size
|
// calculate image size
|
||||||
CtbImageInputs inputs{};
|
CtbImageInputs inputs{};
|
||||||
|
inputs.mode = readoutType;
|
||||||
inputs.nAnalogSamples = nAnalogSamples;
|
inputs.nAnalogSamples = nAnalogSamples;
|
||||||
inputs.adcMask = adcEnableMaskTenGiga;
|
inputs.adcMask = adcEnableMaskTenGiga;
|
||||||
inputs.nTransceiverSamples = nTransceiverSamples;
|
inputs.nTransceiverSamples = nTransceiverSamples;
|
||||||
@@ -687,8 +737,13 @@ class XilinxChipTestBoardData : public GeneralData {
|
|||||||
inputs.dbitOffset = ctbDbitOffset;
|
inputs.dbitOffset = ctbDbitOffset;
|
||||||
inputs.dbitList = ctbDbitList;
|
inputs.dbitList = ctbDbitList;
|
||||||
inputs.dbitReorder = ctbDbitReorder;
|
inputs.dbitReorder = ctbDbitReorder;
|
||||||
|
|
||||||
auto out = computeCtbImageSize(inputs);
|
auto out = computeCtbImageSize(inputs);
|
||||||
|
|
||||||
nPixelsX = out.nPixelsX;
|
nPixelsX = out.nPixelsX;
|
||||||
|
nAnalogBytes = out.nAnalogBytes;
|
||||||
|
nTransceiverBytes = out.nTransceiverBytes;
|
||||||
|
|
||||||
imageSize = out.nAnalogBytes + out.nDigitalBytesReserved +
|
imageSize = out.nAnalogBytes + out.nDigitalBytesReserved +
|
||||||
out.nTransceiverBytes;
|
out.nTransceiverBytes;
|
||||||
// to write to file: after ctb offset and reorder
|
// to write to file: after ctb offset and reorder
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ def startCmdTestsForAll(args, fp):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = ParseArguments('Automated tests with the virtual detector servers', 1, 1)
|
args = ParseArguments(description='Automated tests with the virtual detector servers', default_num_mods=1, markers=1, general_tests_option=True)
|
||||||
if args.num_mods > 1:
|
if args.num_mods > 1:
|
||||||
raise RuntimeException(f'Cannot support multiple modules at the moment (except Eiger).')
|
raise RuntimeException(f'Cannot support multiple modules at the moment (except Eiger).')
|
||||||
|
|
||||||
@@ -81,7 +81,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
with open(MAIN_LOG_FNAME, 'w') as fp:
|
with open(MAIN_LOG_FNAME, 'w') as fp:
|
||||||
try:
|
try:
|
||||||
startGeneralTests(fp)
|
if args.general_tests:
|
||||||
|
startGeneralTests(fp)
|
||||||
startCmdTestsForAll(args, fp)
|
startCmdTestsForAll(args, fp)
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ def loadBasicSettings(name, d, fp):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
||||||
|
|
||||||
def ParseArguments(description, default_num_mods=1, markers=0):
|
def ParseArguments(description, default_num_mods=1, markers=0, general_tests_option=False):
|
||||||
parser = argparse.ArgumentParser(description)
|
parser = argparse.ArgumentParser(description)
|
||||||
|
|
||||||
parser.add_argument('rx_hostname', nargs='?', default='localhost',
|
parser.add_argument('rx_hostname', nargs='?', default='localhost',
|
||||||
@@ -269,6 +269,10 @@ def ParseArguments(description, default_num_mods=1, markers=0):
|
|||||||
parser.add_argument('-m', '--markers', nargs='?', default ='[.cmdcall]',
|
parser.add_argument('-m', '--markers', nargs='?', default ='[.cmdcall]',
|
||||||
help = 'Markers to use for cmd tests, default: [.cmdcall]')
|
help = 'Markers to use for cmd tests, default: [.cmdcall]')
|
||||||
|
|
||||||
|
if general_tests_option:
|
||||||
|
parser.add_argument('-g', '--general_tests', action='store_true',
|
||||||
|
help = 'Enable general tests (no value needed)')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set default server list if not provided
|
# Set default server list if not provided
|
||||||
@@ -293,6 +297,10 @@ def ParseArguments(description, default_num_mods=1, markers=0):
|
|||||||
)
|
)
|
||||||
if markers == 1:
|
if markers == 1:
|
||||||
msg += f"\nmarkers: '{args.markers}'"
|
msg += f"\nmarkers: '{args.markers}'"
|
||||||
|
|
||||||
|
if general_tests_option:
|
||||||
|
msg += f"\ngeneral_tests: '{args.general_tests}'"
|
||||||
|
|
||||||
Log(LogLevel.INFO, msg)
|
Log(LogLevel.INFO, msg)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user