mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-05 20:30:03 +02:00
fixed ctb tests, need to fix in develoepr (if digital modfe not enabled, should not take into accoutn dbitlist or dbitoffset or dbitreorder
This commit is contained in:
parent
5073769403
commit
62a5fda33f
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
#include "sls/ToString.h"
|
#include "sls/ToString.h"
|
||||||
|
#include "sls/logger.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-Caller-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
@ -30,6 +31,126 @@ struct testCtbAcquireInfo {
|
|||||||
bool dbit_reorder{false};
|
bool dbit_reorder{false};
|
||||||
uint32_t transceiver_mask{0x3};
|
uint32_t transceiver_mask{0x3};
|
||||||
};
|
};
|
||||||
|
testCtbAcquireInfo get_ctb_config_state(const Detector &det);
|
||||||
|
void set_ctb_config_state(Detector &det,
|
||||||
|
const testCtbAcquireInfo &ctb_config_info);
|
||||||
|
uint64_t calculate_ctb_image_size(const testCtbAcquireInfo &test_info);
|
||||||
|
void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
||||||
|
int64_t num_frames_to_acquire,
|
||||||
|
Detector &det, Caller &caller);
|
||||||
|
|
||||||
|
TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall]") {
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type =
|
||||||
|
det.getDetectorType().tsquash("Inconsistent detector types to test");
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD ||
|
||||||
|
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||||
|
int num_frames_to_acquire = 2;
|
||||||
|
// all the test cases
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
} /*
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::TRANSCEIVER_ONLY;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_aclogDEBUGquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
testCtbAcquireInfo test_ctb_config;
|
||||||
|
test_ctb_config.readout_mode = defs::ANALOG_ONLY;
|
||||||
|
test_ctb_config.dbit_offset = 16;
|
||||||
|
test_ctb_config.dbit_list.clear();
|
||||||
|
test_ctb_config.dbit_reorder = true;
|
||||||
|
REQUIRE_NOTHROW(test_ctb_acquire_with_receiver(
|
||||||
|
test_ctb_config, num_frames_to_acquire, det, caller));
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
testCtbAcquireInfo get_ctb_config_state(const Detector &det) {
|
testCtbAcquireInfo get_ctb_config_state(const Detector &det) {
|
||||||
return testCtbAcquireInfo{
|
return testCtbAcquireInfo{
|
||||||
@ -66,34 +187,7 @@ void set_ctb_config_state(Detector &det,
|
|||||||
det.setTransceiverEnableMask(ctb_config_info.transceiver_mask);
|
det.setTransceiverEnableMask(ctb_config_info.transceiver_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
uint64_t calculate_ctb_image_size(const testCtbAcquireInfo &test_info) {
|
||||||
int64_t num_frames_to_acquire,
|
|
||||||
Detector &det, Caller &caller) {
|
|
||||||
|
|
||||||
// save previous state
|
|
||||||
testFileInfo prev_file_info = get_file_state(det);
|
|
||||||
testCommonDetAcquireInfo prev_det_config_info =
|
|
||||||
// overwrite exptime if not using virtual ctb server
|
|
||||||
get_common_acquire_config_state(det);
|
|
||||||
testCtbAcquireInfo prev_ctb_config_info = get_ctb_config_state(det);
|
|
||||||
|
|
||||||
// defaults
|
|
||||||
testFileInfo test_file_info;
|
|
||||||
set_file_state(det, test_file_info);
|
|
||||||
testCommonDetAcquireInfo det_config;
|
|
||||||
det_config.num_frames_to_acquire = num_frames_to_acquire;
|
|
||||||
set_common_acquire_config_state(det, det_config);
|
|
||||||
|
|
||||||
// set ctb config
|
|
||||||
set_ctb_config_state(det, test_info);
|
|
||||||
|
|
||||||
// acquire
|
|
||||||
test_acquire_with_receiver(caller, std::chrono::seconds{2});
|
|
||||||
|
|
||||||
// check frames caught
|
|
||||||
test_frames_caught(det, num_frames_to_acquire);
|
|
||||||
|
|
||||||
// calculate image size
|
|
||||||
uint64_t num_analog_bytes = 0, num_digital_bytes = 0,
|
uint64_t num_analog_bytes = 0, num_digital_bytes = 0,
|
||||||
num_transceiver_bytes = 0;
|
num_transceiver_bytes = 0;
|
||||||
if (test_info.readout_mode == defs::ANALOG_ONLY ||
|
if (test_info.readout_mode == defs::ANALOG_ONLY ||
|
||||||
@ -105,6 +199,7 @@ void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
|||||||
const int num_bytes_per_sample = 2;
|
const int num_bytes_per_sample = 2;
|
||||||
num_analog_bytes =
|
num_analog_bytes =
|
||||||
num_analog_chans * num_bytes_per_sample * test_info.num_adc_samples;
|
num_analog_chans * num_bytes_per_sample * test_info.num_adc_samples;
|
||||||
|
LOG(logDEBUG1) << "[Analog Databytes: " << num_analog_bytes << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
// digital channels
|
// digital channels
|
||||||
@ -135,6 +230,7 @@ void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
|||||||
}
|
}
|
||||||
num_digital_bytes = num_digital_chans * (num_bits_per_bit / 8);
|
num_digital_bytes = num_digital_chans * (num_bits_per_bit / 8);
|
||||||
}
|
}
|
||||||
|
LOG(logDEBUG1) << "[Digital Databytes: " << num_digital_bytes << ']';
|
||||||
}
|
}
|
||||||
// transceiver channels
|
// transceiver channels
|
||||||
if (test_info.readout_mode == defs::TRANSCEIVER_ONLY ||
|
if (test_info.readout_mode == defs::TRANSCEIVER_ONLY ||
|
||||||
@ -144,10 +240,45 @@ void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
|||||||
const int num_bytes_per_channel = 8;
|
const int num_bytes_per_channel = 8;
|
||||||
num_transceiver_bytes = num_transceiver_chans * num_bytes_per_channel *
|
num_transceiver_bytes = num_transceiver_chans * num_bytes_per_channel *
|
||||||
test_info.num_trans_samples;
|
test_info.num_trans_samples;
|
||||||
|
LOG(logDEBUG1) << "[Transceiver Databytes: " << num_transceiver_bytes
|
||||||
|
<< ']';
|
||||||
}
|
}
|
||||||
// check file size (assuming local pc)
|
|
||||||
uint64_t expected_image_size =
|
uint64_t image_size =
|
||||||
num_analog_bytes + num_digital_bytes + num_transceiver_bytes;
|
num_analog_bytes + num_digital_bytes + num_transceiver_bytes;
|
||||||
|
LOG(logDEBUG1) << "Expected image size: " << image_size;
|
||||||
|
return image_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
||||||
|
int64_t num_frames_to_acquire,
|
||||||
|
Detector &det, Caller &caller) {
|
||||||
|
|
||||||
|
// save previous state
|
||||||
|
testFileInfo prev_file_info = get_file_state(det);
|
||||||
|
testCommonDetAcquireInfo prev_det_config_info =
|
||||||
|
// overwrite exptime if not using virtual ctb server
|
||||||
|
get_common_acquire_config_state(det);
|
||||||
|
testCtbAcquireInfo prev_ctb_config_info = get_ctb_config_state(det);
|
||||||
|
|
||||||
|
// defaults
|
||||||
|
testFileInfo test_file_info;
|
||||||
|
set_file_state(det, test_file_info);
|
||||||
|
testCommonDetAcquireInfo det_config;
|
||||||
|
det_config.num_frames_to_acquire = num_frames_to_acquire;
|
||||||
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
|
// set ctb config
|
||||||
|
set_ctb_config_state(det, test_info);
|
||||||
|
|
||||||
|
// acquire
|
||||||
|
test_acquire_with_receiver(caller, std::chrono::seconds{2});
|
||||||
|
|
||||||
|
// check frames caught
|
||||||
|
test_frames_caught(det, num_frames_to_acquire);
|
||||||
|
|
||||||
|
// check file size (assuming local pc)
|
||||||
|
uint64_t expected_image_size = calculate_ctb_image_size(test_info);
|
||||||
test_acquire_binary_file_size(test_file_info, num_frames_to_acquire,
|
test_acquire_binary_file_size(test_file_info, num_frames_to_acquire,
|
||||||
expected_image_size);
|
expected_image_size);
|
||||||
|
|
||||||
@ -157,132 +288,6 @@ void test_ctb_acquire_with_receiver(const testCtbAcquireInfo &test_info,
|
|||||||
set_ctb_config_state(det, prev_ctb_config_info);
|
set_ctb_config_state(det, prev_ctb_config_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall]") {
|
|
||||||
Detector det;
|
|
||||||
Caller caller(&det);
|
|
||||||
auto det_type =
|
|
||||||
det.getDetectorType().tsquash("Inconsistent detector types to test");
|
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD ||
|
|
||||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
|
||||||
int num_frames_to_acquire = 2;
|
|
||||||
// all the test cases
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_AND_DIGITAL;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::DIGITAL_AND_TRANSCEIVER;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::TRANSCEIVER_ONLY;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
testCtbAcquireInfo test_ctb_config;
|
|
||||||
test_ctb_config.readout_mode = defs::ANALOG_ONLY;
|
|
||||||
test_ctb_config.dbit_offset = 16;
|
|
||||||
test_ctb_config.dbit_list.clear();
|
|
||||||
test_ctb_config.dbit_reorder = true;
|
|
||||||
set_ctb_config_state(det, test_ctb_config);
|
|
||||||
test_ctb_acquire_with_receiver(test_ctb_config,
|
|
||||||
num_frames_to_acquire, det, caller);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("dacname", "[.cmdcall]") {
|
TEST_CASE("dacname", "[.cmdcall]") {
|
||||||
|
@ -31,6 +31,7 @@ TEST_CASE("eiger_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
get_common_acquire_config_state(det);
|
get_common_acquire_config_state(det);
|
||||||
|
|
||||||
// save previous specific det type config
|
// save previous specific det type config
|
||||||
|
auto exptime = det.getExptime().tsquash("inconsistent exptime to test");
|
||||||
auto n_rows =
|
auto n_rows =
|
||||||
det.getReadNRows().tsquash("inconsistent number of rows to test");
|
det.getReadNRows().tsquash("inconsistent number of rows to test");
|
||||||
auto dynamic_range =
|
auto dynamic_range =
|
||||||
@ -47,6 +48,7 @@ TEST_CASE("eiger_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, det_config);
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
// set default specific det type config
|
// set default specific det type config
|
||||||
|
det.setExptime(std::chrono::microseconds{200});
|
||||||
det.setReadNRows(256);
|
det.setReadNRows(256);
|
||||||
det.setDynamicRange(16);
|
det.setDynamicRange(16);
|
||||||
|
|
||||||
@ -73,6 +75,7 @@ TEST_CASE("eiger_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, prev_det_config_info);
|
set_common_acquire_config_state(det, prev_det_config_info);
|
||||||
|
|
||||||
// restore previous specific det type config
|
// restore previous specific det type config
|
||||||
|
det.setExptime(exptime);
|
||||||
det.setReadNRows(n_rows);
|
det.setReadNRows(n_rows);
|
||||||
det.setDynamicRange(dynamic_range);
|
det.setDynamicRange(dynamic_range);
|
||||||
}
|
}
|
||||||
|
@ -137,22 +137,11 @@ void test_acquire_with_receiver(Caller &caller, std::chrono::seconds timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCommonDetAcquireInfo get_common_acquire_config_state(const Detector &det) {
|
testCommonDetAcquireInfo get_common_acquire_config_state(const Detector &det) {
|
||||||
testCommonDetAcquireInfo det_config_info{
|
return testCommonDetAcquireInfo{
|
||||||
det.getTimingMode().tsquash("Inconsistent timing mode"),
|
det.getTimingMode().tsquash("Inconsistent timing mode"),
|
||||||
det.getNumberOfFrames().tsquash("Inconsistent number of frames"),
|
det.getNumberOfFrames().tsquash("Inconsistent number of frames"),
|
||||||
det.getNumberOfTriggers().tsquash("Inconsistent number of triggers"),
|
det.getNumberOfTriggers().tsquash("Inconsistent number of triggers"),
|
||||||
det.getPeriod().tsquash("Inconsistent period"),
|
det.getPeriod().tsquash("Inconsistent period")};
|
||||||
{}};
|
|
||||||
auto det_type =
|
|
||||||
det.getDetectorType().tsquash("Inconsistent detector types to test");
|
|
||||||
if (det_type != defs::MYTHEN3) {
|
|
||||||
det_config_info.exptime[0] =
|
|
||||||
det.getExptime().tsquash("inconsistent exptime to test");
|
|
||||||
} else {
|
|
||||||
det_config_info.exptime =
|
|
||||||
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
|
||||||
}
|
|
||||||
return det_config_info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_common_acquire_config_state(
|
void set_common_acquire_config_state(
|
||||||
@ -161,15 +150,6 @@ void set_common_acquire_config_state(
|
|||||||
det.setNumberOfFrames(det_config_info.num_frames_to_acquire);
|
det.setNumberOfFrames(det_config_info.num_frames_to_acquire);
|
||||||
det.setNumberOfTriggers(det_config_info.num_triggers);
|
det.setNumberOfTriggers(det_config_info.num_triggers);
|
||||||
det.setPeriod(det_config_info.period);
|
det.setPeriod(det_config_info.period);
|
||||||
auto det_type =
|
|
||||||
det.getDetectorType().tsquash("Inconsistent detector types to test");
|
|
||||||
if (det_type != defs::MYTHEN3) {
|
|
||||||
det.setExptime(det_config_info.exptime[0]);
|
|
||||||
} else {
|
|
||||||
for (int iGate = 0; iGate < 3; ++iGate) {
|
|
||||||
det.setExptime(iGate, det_config_info.exptime[iGate]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -25,9 +25,6 @@ struct testCommonDetAcquireInfo {
|
|||||||
int64_t num_frames_to_acquire{2};
|
int64_t num_frames_to_acquire{2};
|
||||||
int64_t num_triggers{1};
|
int64_t num_triggers{1};
|
||||||
std::chrono::nanoseconds period{std::chrono::milliseconds{2}};
|
std::chrono::nanoseconds period{std::chrono::milliseconds{2}};
|
||||||
std::array<std::chrono::nanoseconds, 3> exptime{
|
|
||||||
std::chrono::microseconds{200}, std::chrono::nanoseconds{0},
|
|
||||||
std::chrono::nanoseconds{0}};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_valid_port_caller(const std::string &command,
|
void test_valid_port_caller(const std::string &command,
|
||||||
|
@ -31,6 +31,7 @@ TEST_CASE("gotthard2_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
get_common_acquire_config_state(det);
|
get_common_acquire_config_state(det);
|
||||||
|
|
||||||
// save previous specific det type config
|
// save previous specific det type config
|
||||||
|
auto exptime = det.getExptime().tsquash("inconsistent exptime to test");
|
||||||
auto burst_mode =
|
auto burst_mode =
|
||||||
det.getBurstMode().tsquash("inconsistent burst mode to test");
|
det.getBurstMode().tsquash("inconsistent burst mode to test");
|
||||||
auto number_of_bursts = det.getNumberOfBursts().tsquash(
|
auto number_of_bursts = det.getNumberOfBursts().tsquash(
|
||||||
@ -47,6 +48,7 @@ TEST_CASE("gotthard2_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, det_config);
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
// set default specific det type config
|
// set default specific det type config
|
||||||
|
det.setExptime(std::chrono::microseconds{200});
|
||||||
det.setBurstMode(defs::CONTINUOUS_EXTERNAL);
|
det.setBurstMode(defs::CONTINUOUS_EXTERNAL);
|
||||||
det.setNumberOfBursts(1);
|
det.setNumberOfBursts(1);
|
||||||
det.setBurstPeriod(std::chrono::milliseconds{0});
|
det.setBurstPeriod(std::chrono::milliseconds{0});
|
||||||
@ -71,6 +73,7 @@ TEST_CASE("gotthard2_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, prev_det_config_info);
|
set_common_acquire_config_state(det, prev_det_config_info);
|
||||||
|
|
||||||
// restore previous specific det type config
|
// restore previous specific det type config
|
||||||
|
det.setExptime(exptime);
|
||||||
det.setBurstMode(burst_mode);
|
det.setBurstMode(burst_mode);
|
||||||
det.setNumberOfBursts(number_of_bursts);
|
det.setNumberOfBursts(number_of_bursts);
|
||||||
det.setBurstPeriod(burst_period);
|
det.setBurstPeriod(burst_period);
|
||||||
|
@ -29,6 +29,7 @@ TEST_CASE("jungfrau_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
get_common_acquire_config_state(det);
|
get_common_acquire_config_state(det);
|
||||||
|
|
||||||
// save previous specific det type config
|
// save previous specific det type config
|
||||||
|
auto exptime = det.getExptime().tsquash("inconsistent exptime to test");
|
||||||
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
"inconsistent number of udp interfaces");
|
"inconsistent number of udp interfaces");
|
||||||
auto n_rows =
|
auto n_rows =
|
||||||
@ -43,6 +44,7 @@ TEST_CASE("jungfrau_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, det_config);
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
// set default specific det type config
|
// set default specific det type config
|
||||||
|
det.setExptime(std::chrono::microseconds{200});
|
||||||
det.setReadNRows(512);
|
det.setReadNRows(512);
|
||||||
|
|
||||||
// acquire
|
// acquire
|
||||||
@ -67,6 +69,7 @@ TEST_CASE("jungfrau_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, prev_det_config_info);
|
set_common_acquire_config_state(det, prev_det_config_info);
|
||||||
|
|
||||||
// restore previous specific det type config
|
// restore previous specific det type config
|
||||||
|
det.setExptime(exptime);
|
||||||
det.setReadNRows(n_rows);
|
det.setReadNRows(n_rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ TEST_CASE("moench_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
get_common_acquire_config_state(det);
|
get_common_acquire_config_state(det);
|
||||||
|
|
||||||
// save previous specific det type config
|
// save previous specific det type config
|
||||||
|
auto exptime = det.getExptime().tsquash("inconsistent exptime to test");
|
||||||
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
auto num_udp_interfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
"inconsistent number of udp interfaces");
|
"inconsistent number of udp interfaces");
|
||||||
auto n_rows =
|
auto n_rows =
|
||||||
@ -43,6 +44,7 @@ TEST_CASE("moench_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, det_config);
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
// set default specific det type config
|
// set default specific det type config
|
||||||
|
det.setExptime(std::chrono::microseconds{200});
|
||||||
det.setReadNRows(400);
|
det.setReadNRows(400);
|
||||||
|
|
||||||
// acquire
|
// acquire
|
||||||
@ -68,6 +70,7 @@ TEST_CASE("moench_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, prev_det_config_info);
|
set_common_acquire_config_state(det, prev_det_config_info);
|
||||||
|
|
||||||
// restore previous specific det type config
|
// restore previous specific det type config
|
||||||
|
det.setExptime(exptime);
|
||||||
det.setReadNRows(n_rows);
|
det.setReadNRows(n_rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ TEST_CASE("mythen3_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
get_common_acquire_config_state(det);
|
get_common_acquire_config_state(det);
|
||||||
|
|
||||||
// save previous specific det type config
|
// save previous specific det type config
|
||||||
|
auto exptime =
|
||||||
|
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
|
||||||
auto dynamic_range =
|
auto dynamic_range =
|
||||||
det.getDynamicRange().tsquash("inconsistent dynamic range to test");
|
det.getDynamicRange().tsquash("inconsistent dynamic range to test");
|
||||||
uint32_t counter_mask =
|
uint32_t counter_mask =
|
||||||
@ -45,6 +47,7 @@ TEST_CASE("mythen3_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, det_config);
|
set_common_acquire_config_state(det, det_config);
|
||||||
|
|
||||||
// set default specific det type config
|
// set default specific det type config
|
||||||
|
det.setExptime(-1, std::chrono::microseconds{200});
|
||||||
int test_dynamic_range = 16;
|
int test_dynamic_range = 16;
|
||||||
det.setDynamicRange(test_dynamic_range);
|
det.setDynamicRange(test_dynamic_range);
|
||||||
int test_counter_mask = 0x3;
|
int test_counter_mask = 0x3;
|
||||||
@ -74,6 +77,9 @@ TEST_CASE("mythen3_acquire_check_file_size", "[.cmdcall]") {
|
|||||||
set_common_acquire_config_state(det, prev_det_config_info);
|
set_common_acquire_config_state(det, prev_det_config_info);
|
||||||
|
|
||||||
// restore previous specific det type config
|
// restore previous specific det type config
|
||||||
|
for (int iGate = 0; iGate < 3; ++iGate) {
|
||||||
|
det.setExptime(iGate, exptime[iGate]);
|
||||||
|
}
|
||||||
det.setDynamicRange(dynamic_range);
|
det.setDynamicRange(dynamic_range);
|
||||||
det.setCounterMask(counter_mask);
|
det.setCounterMask(counter_mask);
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,6 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
|||||||
|
|
||||||
// store each selected bit from all samples consecutively
|
// store each selected bit from all samples consecutively
|
||||||
if (ctbDbitReorder) {
|
if (ctbDbitReorder) {
|
||||||
LOG(logINFORED) << "Reordering digital data";
|
|
||||||
size_t numBitsPerDbit =
|
size_t numBitsPerDbit =
|
||||||
numDigitalSamples; // num bits per selected digital
|
numDigitalSamples; // num bits per selected digital
|
||||||
// Bit for all samples
|
// Bit for all samples
|
||||||
@ -604,8 +603,6 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
|||||||
if ((numBitsPerSample % 8) != 0)
|
if ((numBitsPerSample % 8) != 0)
|
||||||
numBitsPerSample += (8 - (numBitsPerSample % 8));
|
numBitsPerSample += (8 - (numBitsPerSample % 8));
|
||||||
totalNumBytes = (numBitsPerSample / 8) * numDigitalSamples;
|
totalNumBytes = (numBitsPerSample / 8) * numDigitalSamples;
|
||||||
LOG(logINFORED) << "total numDigital bytes without reorder:"
|
|
||||||
<< totalNumBytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> result(totalNumBytes, 0);
|
std::vector<uint8_t> result(totalNumBytes, 0);
|
||||||
@ -678,11 +675,11 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
|||||||
memcpy(data + nAnalogDataBytes, result.data(),
|
memcpy(data + nAnalogDataBytes, result.data(),
|
||||||
totalNumBytes * sizeof(uint8_t));
|
totalNumBytes * sizeof(uint8_t));
|
||||||
|
|
||||||
LOG(logINFORED) << "totalNumBytes: " << totalNumBytes
|
LOG(logDEBUG1) << "nDigitalDataBytes: " << totalNumBytes
|
||||||
<< " nAnalogDataBytes:" << nAnalogDataBytes
|
<< " nAnalogDataBytes:" << nAnalogDataBytes
|
||||||
<< " ctbDbitOffset:" << ctbDbitOffset
|
<< " ctbDbitOffset:" << ctbDbitOffset
|
||||||
<< " nTransceiverDataBytes:" << nTransceiverDataBytes
|
<< " nTransceiverDataBytes:" << nTransceiverDataBytes
|
||||||
<< " size:" << size;
|
<< " toal size:" << size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataProcessor::CropImage(size_t &size, char *data) {
|
void DataProcessor::CropImage(size_t &size, char *data) {
|
||||||
|
@ -32,8 +32,8 @@ def killProcess(name):
|
|||||||
if checkIfProcessRunning(name):
|
if checkIfProcessRunning(name):
|
||||||
Log(Fore.GREEN, 'killing ' + name)
|
Log(Fore.GREEN, 'killing ' + name)
|
||||||
p = subprocess.run(['killall', name])
|
p = subprocess.run(['killall', name])
|
||||||
if p.returncode != 0:
|
#if p.returncode != 0:
|
||||||
raise RuntimeException('killall failed for ' + name)
|
# raise RuntimeException('killall failed for ' + name)
|
||||||
else:
|
else:
|
||||||
print('process not running : ' + name)
|
print('process not running : ' + name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user