FPGAIntegrationTest: Add test for spot finder based on count limit
This commit is contained in:
@@ -1140,3 +1140,45 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_integration", "[FPGA][Full
|
||||
CHECK(integration_result[54].sum == 32754 * (RAW_MODULE_SIZE - 2));
|
||||
CHECK(integration_result[54].count == RAW_MODULE_SIZE - 2);
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_internal_packet_generator_spot_finder_count_threshold", "[FPGA][Full]") {
|
||||
const uint16_t nmodules = 4;
|
||||
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
|
||||
x.Mode(DetectorMode::Raw);
|
||||
x.UseInternalPacketGenerator(true).ImagesPerTrigger(1).PedestalG0Frames(0);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
|
||||
std::vector<uint16_t> frame(RAW_MODULE_SIZE, 0);
|
||||
frame [ 0] = 11;
|
||||
frame [123*1024 + 578] = 10;
|
||||
frame [121*1024 + 800] = 12;
|
||||
frame [ 89*1024 + 300] = 8;
|
||||
frame [300*1024 + 0] = 9;
|
||||
|
||||
test.SetInternalGeneratorFrame(frame);
|
||||
|
||||
test.SetSpotFinderParameters(9, 0.0);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
|
||||
REQUIRE(test.OutputStream().size() == 1);
|
||||
|
||||
JFJochProtoBuf::AcquisitionDeviceStatistics device_statistics;
|
||||
REQUIRE_NOTHROW(test.SaveStatistics(x, device_statistics));
|
||||
REQUIRE(device_statistics.bytes_received() == 128 * nmodules * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
auto imageBuf = test.GetDeviceOutput(0, 0)->pixels;
|
||||
REQUIRE(memcmp(imageBuf, frame.data(), RAW_MODULE_SIZE * sizeof(uint16_t)) == 0);
|
||||
|
||||
auto spot_finder_result = test.GetDeviceOutput(0, 0)->spot_finding_result;
|
||||
REQUIRE (spot_finder_result.strong_pixel_count == 3);
|
||||
REQUIRE (spot_finder_result.snr_threshold == 0);
|
||||
REQUIRE (spot_finder_result.count_threshold == 9);
|
||||
REQUIRE (spot_finder_result.strong_pixel[0] == (1<<0));
|
||||
REQUIRE (spot_finder_result.strong_pixel[(123*1024 + 578) / 8] == (1<<2)); // 578 % 8 == 2
|
||||
REQUIRE (spot_finder_result.strong_pixel[(121*1024 + 800) / 8] == (1<<0)); // 800 % 8 == 0
|
||||
}
|
||||
Reference in New Issue
Block a user