FPGAIntegrationTest: Truncate number of test images
This commit is contained in:
@@ -87,21 +87,19 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_custom_frame", "[FPGA][Ful
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_check_raw", "[FPGA][Full]") {
|
||||
std::vector<uint16_t> raw_frames(RAW_MODULE_SIZE*20);
|
||||
std::vector<uint16_t> raw_frames(RAW_MODULE_SIZE);
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
LoadBinaryFile("../../tests/test_data/mod5_raw" + std::to_string(i)+".bin", raw_frames.data() + i * RAW_MODULE_SIZE, RAW_MODULE_SIZE);
|
||||
}
|
||||
LoadBinaryFile("../../tests/test_data/mod5_raw0.bin", raw_frames.data(), RAW_MODULE_SIZE);
|
||||
|
||||
const uint16_t nmodules = 4;
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
uint16_t data[4096];
|
||||
|
||||
x.Mode(DetectorMode::Raw);
|
||||
x.PedestalG0Frames(0).ImagesPerTrigger(5).NumTriggers(1);
|
||||
x.PedestalG0Frames(0).ImagesPerTrigger(1).NumTriggers(1);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
test.CreateJFPackets(x, 1, 5, 0, raw_frames.data());
|
||||
test.CreateJFPackets(x, 1, 1, 0, raw_frames.data());
|
||||
test.CreateFinalPacket(x);
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
@@ -111,15 +109,14 @@ TEST_CASE("HLS_C_Simulation_check_raw", "[FPGA][Full]") {
|
||||
REQUIRE_NOTHROW(test.OutputStream().read());
|
||||
REQUIRE(test.OutputStream().size() == 0);
|
||||
|
||||
REQUIRE(test.GetBytesReceived() == 5 * 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
REQUIRE(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
uint64_t diffs = 0;
|
||||
for (int image = 0; image < 5; image++) {
|
||||
for (int j = 0; j < RAW_MODULE_SIZE; j++) {
|
||||
if (raw_frames[image*RAW_MODULE_SIZE+j] != ((uint16_t *) test.GetDeviceOutput(image, 0)->pixels)[j]) {
|
||||
diffs++;
|
||||
std::cout << raw_frames[image*RAW_MODULE_SIZE+j] << " " << ((uint16_t *) test.GetDeviceOutput(image, 0)->pixels)[j] << std::endl;
|
||||
}
|
||||
|
||||
for (int j = 0; j < RAW_MODULE_SIZE; j++) {
|
||||
if (raw_frames[j] != ((uint16_t *) test.GetDeviceOutput(0, 0)->pixels)[j]) {
|
||||
diffs++;
|
||||
std::cout << raw_frames[j] << " " << ((uint16_t *) test.GetDeviceOutput(0, 0)->pixels)[j] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,13 +916,11 @@ TEST_CASE("HLS_C_Simulation_check_2_trigger_convert", "[FPGA][Full]") {
|
||||
LoadBinaryFile("../../tests/test_data/mod5_pedeG1.bin", pedestal_g1.data(), RAW_MODULE_SIZE);
|
||||
LoadBinaryFile("../../tests/test_data/mod5_pedeG2.bin", pedestal_g2.data(), RAW_MODULE_SIZE);
|
||||
|
||||
std::vector<uint16_t> raw_frames(RAW_MODULE_SIZE*20);
|
||||
std::vector<float> conv_frames(RAW_MODULE_SIZE*20);
|
||||
std::vector<uint16_t> raw_frames(RAW_MODULE_SIZE);
|
||||
std::vector<float> conv_frames(RAW_MODULE_SIZE);
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
LoadBinaryFile("../../tests/test_data/mod5_raw" + std::to_string(i)+".bin", raw_frames.data() + i * RAW_MODULE_SIZE, RAW_MODULE_SIZE);
|
||||
LoadBinaryFile("../../tests/test_data/mod5_conv" + std::to_string(i)+".bin", conv_frames.data() + i * RAW_MODULE_SIZE, RAW_MODULE_SIZE);
|
||||
}
|
||||
LoadBinaryFile("../../tests/test_data/mod5_raw0.bin", raw_frames.data(), RAW_MODULE_SIZE);
|
||||
LoadBinaryFile("../../tests/test_data/mod5_conv0.bin", conv_frames.data(), RAW_MODULE_SIZE);
|
||||
|
||||
const uint16_t nmodules = 4;
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
@@ -933,7 +928,7 @@ TEST_CASE("HLS_C_Simulation_check_2_trigger_convert", "[FPGA][Full]") {
|
||||
uint16_t data[4096];
|
||||
|
||||
x.Mode(DetectorMode::Conversion);
|
||||
x.PedestalG0Frames(0).NumTriggers(2).ImagesPerTrigger(5);
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
|
||||
@@ -946,7 +941,7 @@ TEST_CASE("HLS_C_Simulation_check_2_trigger_convert", "[FPGA][Full]") {
|
||||
REQUIRE_NOTHROW(test.InitializeCalibration(x, c));
|
||||
|
||||
// send some frames without trigger (to be ignored)
|
||||
test.CreateJFPackets(x, 1, 10, 0, raw_frames.data());
|
||||
test.CreateJFPackets(x, 1, 1, 0, raw_frames.data());
|
||||
test.CreateFinalPacket(x);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
@@ -961,25 +956,23 @@ TEST_CASE("HLS_C_Simulation_check_2_trigger_convert", "[FPGA][Full]") {
|
||||
REQUIRE((uint64_t) test.GetDeviceOutput(0,0)->pixels % 128 == 0);
|
||||
|
||||
REQUIRE(test.Counters().GetSlowestFrameNumber() == 0);
|
||||
REQUIRE(test.Counters().GetCurrFrameNumber(0) == 9);
|
||||
REQUIRE(test.Counters().GetCurrFrameNumber(0) == 0);
|
||||
|
||||
REQUIRE_NOTHROW(test.OutputStream().read());
|
||||
REQUIRE(test.OutputStream().size() == 0);
|
||||
|
||||
REQUIRE(test.GetBytesReceived()== 128 * 10 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
REQUIRE(test.GetBytesReceived()== 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = 0.0;
|
||||
for (int image = 0; image < 10; image++) {
|
||||
auto img = test.GetDeviceOutput(image, 0)->pixels;
|
||||
for (int j = 0; j < RAW_MODULE_SIZE; j++) {
|
||||
if ((img[j] < 30000) && (img[j] > -30000)) {
|
||||
float diff = (conv_frames[image * RAW_MODULE_SIZE + j] - (float) img[j]);
|
||||
mean_error += diff * diff;
|
||||
}
|
||||
auto img = test.GetDeviceOutput(0, 0)->pixels;
|
||||
for (int j = 0; j < RAW_MODULE_SIZE; j++) {
|
||||
if ((img[j] < 30000) && (img[j] > -30000)) {
|
||||
float diff = (conv_frames[j] - (float) img[j]);
|
||||
mean_error += diff * diff;
|
||||
}
|
||||
}
|
||||
|
||||
mean_error = sqrt(mean_error/ (10*RAW_MODULE_SIZE));
|
||||
mean_error = sqrt(mean_error/ (RAW_MODULE_SIZE));
|
||||
std::cout << "Mean error " << mean_error << std::endl;
|
||||
REQUIRE(mean_error < 0.30);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user