Modifications in preparation to MAX IV experiment
This commit is contained in:
@@ -31,11 +31,11 @@ TEST_CASE("JFJochReceiverTest_Raw", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.compressed_ratio == 1.0);
|
||||
REQUIRE(output.compressed_size == x.GetImageNum() * x.GetPixelDepth() * x.GetPixelsNum());
|
||||
REQUIRE(output.max_image_number_sent == x.GetImageNum() - 1);
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.compressed_ratio == 1.0);
|
||||
REQUIRE(output.status.compressed_size == x.GetImageNum() * x.GetPixelDepth() * x.GetPixelsNum());
|
||||
REQUIRE(output.status.max_image_number_sent == x.GetImageNum());
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion", "[JFJochReceiver]") {
|
||||
@@ -60,9 +60,67 @@ TEST_CASE("JFJochReceiverTest_Conversion", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_FixedGainG1", "[JFJochReceiver]") {
|
||||
Logger logger("JFJochReceiverTest_Conversion");
|
||||
|
||||
DiffractionExperiment x(DetectorGeometry(2));
|
||||
const uint16_t nthreads = 4;
|
||||
|
||||
x.Mode(DetectorMode::Conversion);
|
||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||
.ImagesPerTrigger(32).DataFileCount(16).PhotonEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||
.FixedGainG1(true);
|
||||
|
||||
AcquisitionDeviceGroup aq_devices;
|
||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
||||
test->SetInternalGeneratorFrame();
|
||||
aq_devices.Add(std::move(test));
|
||||
}
|
||||
|
||||
JFJochReceiverOutput output;
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_FixedGainG1_onlyG1", "[JFJochReceiver]") {
|
||||
Logger logger("JFJochReceiverTest_Conversion");
|
||||
|
||||
DiffractionExperiment x(DetectorGeometry(2));
|
||||
const uint16_t nthreads = 4;
|
||||
|
||||
x.Mode(DetectorMode::Conversion);
|
||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||
.ImagesPerTrigger(32).DataFileCount(16).PhotonEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||
.FixedGainG1(true);
|
||||
|
||||
std::vector<uint16_t> input(RAW_MODULE_SIZE, 0x4000 + 3000);
|
||||
AcquisitionDeviceGroup aq_devices;
|
||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
||||
test->SetInternalGeneratorFrameForAllModules(input);
|
||||
aq_devices.Add(std::move(test));
|
||||
}
|
||||
|
||||
JFJochReceiverOutput output;
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_U16", "[JFJochReceiver]") {
|
||||
@@ -88,9 +146,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_U16", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_I32", "[JFJochReceiver]") {
|
||||
@@ -115,9 +173,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_I32", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_Summation2", "[JFJochReceiver]") {
|
||||
@@ -142,9 +200,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Summation2", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Conversion_StorageCell", "[JFJochReceiver]") {
|
||||
@@ -172,9 +230,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_StorageCell", "[JFJochReceiver]") {
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_PedestalG1", "[JFJochReceiver]") {
|
||||
@@ -221,7 +279,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG1", "[JFJochReceiver]") {
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
|
||||
JFModulePedestal ref_pedestal;
|
||||
@@ -229,7 +287,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG1", "[JFJochReceiver]") {
|
||||
JFModulePedestal out_pedestal = output.pedestal_result.at(0);
|
||||
REQUIRE(abs(ref_pedestal.Mean() - out_pedestal.Mean()) < 0.65);
|
||||
REQUIRE(out_pedestal.CountMaskedPixels() == 0);
|
||||
REQUIRE(!output.cancelled);
|
||||
REQUIRE(!output.status.cancelled);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_PedestalG2_storage_cell", "[JFJochReceiver]") {
|
||||
@@ -280,13 +338,13 @@ TEST_CASE("JFJochReceiverTest_PedestalG2_storage_cell", "[JFJochReceiver]") {
|
||||
for (int i = 0; i < nframes; i++)
|
||||
pc.AnalyzeImage(pedestal_in.data() + i * RAW_MODULE_SIZE);
|
||||
|
||||
Logger logger("JFJochReceiverTest_PedestalG1");
|
||||
Logger logger("JFJochReceiverTest_PedestalG2_storage_cell");
|
||||
|
||||
JFJochReceiverOutput output;
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
|
||||
JFModulePedestal ref_pedestal;
|
||||
@@ -338,7 +396,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG0", "[JFJochReceiver]") {
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads,false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
|
||||
JFModulePedestal ref_pedestal;
|
||||
@@ -384,7 +442,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG0_StorageCell", "[JFJochReceiver]") {
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||
REQUIRE(output.efficiency == 1.0);
|
||||
REQUIRE(output.pedestal_result.size() == 4);
|
||||
JFModulePedestal out_pedestal_0 = output.pedestal_result[0];
|
||||
@@ -423,7 +481,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG1_NoFrames", "[JFJochReceiver]") {
|
||||
bool ret;
|
||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, nthreads, false));
|
||||
REQUIRE(ret);
|
||||
REQUIRE(output.images_sent == 0);
|
||||
REQUIRE(output.status.images_sent == 0);
|
||||
REQUIRE(output.efficiency < 1.0);
|
||||
|
||||
JFModulePedestal out_pedestal = output.pedestal_result.at(0);
|
||||
@@ -482,7 +540,7 @@ TEST_CASE("JFJochReceiverTest_PacketLost_Raw", "[JFJochReceiver]") {
|
||||
CHECK(raw[2*RAW_MODULE_SIZE-1] == 776);
|
||||
|
||||
REQUIRE(receiver_out.efficiency < 1.0);
|
||||
REQUIRE(receiver_out.images_sent == x.GetImageNum());
|
||||
REQUIRE(receiver_out.status.images_sent == x.GetImageNum());
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochReceiverTest_Cancel", "[JFJochReceiver]") {
|
||||
@@ -513,5 +571,5 @@ TEST_CASE("JFJochReceiverTest_Cancel", "[JFJochReceiver]") {
|
||||
|
||||
TestImagePusher pusher(x.GetImageNum() - 1);
|
||||
auto receiver_out = RunJFJochReceiverTest(aq_devices, pusher, x, logger, calib, nthreads, true);
|
||||
REQUIRE(receiver_out.cancelled);
|
||||
REQUIRE(receiver_out.status.cancelled);
|
||||
}
|
||||
Reference in New Issue
Block a user