Tests: receiver, puller, state machine and writer tests on MockAcquisitionDevice
Every test whose subject is not the card's pixel arithmetic now runs on the mock of the card, with what the card writes given by the test, precalculated on the CPU (tests/MockCardOutput.h): - JUNGFRAU conversion, threshold, Poisson, summation, storage cells, applied pixel mask, EIGER: the reference conversion of CheckImageOutput.h, rounded into the card's pixel format; - a signed 16-bit image passed through (the crystal tests): the image itself, INT16_MIN error and INT16_MAX saturated as the card reads them, the strong pixels from the CPU version of the card's spot finder (DetModuleSpotFinder_cpu.h); - pixel statistics and ROI sums from the same values, masked pixels left out; - pedestal runs and lost packets: the raw frames, the missing packet as UINT16_MAX. Integration bins and the ADU histogram are left at zero: no test asserts on their values. Moved: JFJochReceiverIntegrationTest.cpp (30 cases), JFJochReceiverProcessingTest.cpp (23), FPGAImagePullerTest.cpp (20), JFJochReceiverRugnuxTest.cpp (1), JFJochStateMachineTest.cpp (5), StreamWriterTest.cpp (4). JFJochReceiverTest_Raw_TwoDevices comes from MockAcquisitionDeviceTest.cpp, whose other ported receiver tests duplicated the originals now on the mock and are removed. What changes in meaning: the conversion tests check that the receiver carries the card's pixels into the image (geometry, multipixels, pixel format, compression), no longer that the card converts correctly; JFJochIntegrationTest_ZMQ_ROI checks the receiver's ROI and pixel counts against the hand sums with the card's sums calculated on the CPU. The card itself is compared with the mock in MockAcquisitionDeviceTest.cpp. The pedestal tests repeat 25-32 distinct frames instead of all distinct ones, the reference pedestal taken from the same frames. Waits sized for the HLS simulation are shortened: cancel after 1 s instead of 60 s / 5 s, the puller cancel after 2 s instead of 30 s, the dead-module puller gives up after 5 s without an image instead of 60 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
This commit is contained in:
1 parent
497073dc9f
commit
ce89180627
10 files changed
+573
-683
No files matched your search
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#define STORAGE_CELL_FOR_TEST 11
|
#define STORAGE_CELL_FOR_TEST 11
|
||||||
|
|
||||||
static JFCalibration GeneratePedestalCalibration(const DiffractionExperiment &x) {
|
JFCalibration GeneratePedestalCalibration(const DiffractionExperiment &x) {
|
||||||
JFCalibration ret(x);
|
JFCalibration ret(x);
|
||||||
|
|
||||||
std::vector<float> pedestal_g0( RAW_MODULE_SIZE), pedestal_g1(RAW_MODULE_SIZE), pedestal_g2(RAW_MODULE_SIZE);
|
std::vector<float> pedestal_g0( RAW_MODULE_SIZE), pedestal_g1(RAW_MODULE_SIZE), pedestal_g2(RAW_MODULE_SIZE);
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// The calibration JFJochReceiverTest() converts with
|
||||||
|
JFCalibration GeneratePedestalCalibration(const DiffractionExperiment &x);
|
||||||
|
|
||||||
bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
bool JFJochReceiverTest(JFJochReceiverOutput &output, Logger &logger,
|
||||||
AcquisitionDeviceGroup &aq_devices,
|
AcquisitionDeviceGroup &aq_devices,
|
||||||
const DiffractionExperiment &x,
|
const DiffractionExperiment &x,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
// The same frames through JFJochReceiverFPGA and through FPGAImagePuller + JFJochReceiverLite, on the HLS
|
// The same frames through JFJochReceiverFPGA and through FPGAImagePuller + JFJochReceiverLite, on the mock of the
|
||||||
// simulation of the card. The pixels must be the same; the analysis differs by design, and its numbers are printed.
|
// card. The pixels must be the same; the analysis differs by design, and its numbers are printed.
|
||||||
|
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
|
||||||
#include "../compression/JFJochDecompress.h"
|
#include "../compression/JFJochDecompress.h"
|
||||||
#include "../frame_serialize/CBORStream2Deserializer.h"
|
#include "../frame_serialize/CBORStream2Deserializer.h"
|
||||||
#include "../image_pusher/HDF5FilePusher.h"
|
#include "../image_pusher/HDF5FilePusher.h"
|
||||||
@@ -24,6 +23,7 @@
|
|||||||
#include "../receiver/JFJochReceiverRugnuxRotation.h"
|
#include "../receiver/JFJochReceiverRugnuxRotation.h"
|
||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
#include "../rugnux/RugnuxDefaults.h"
|
#include "../rugnux/RugnuxDefaults.h"
|
||||||
|
#include "MockCardOutput.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@@ -128,13 +128,28 @@ namespace {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
AcquisitionDeviceGroup Devices(const DiffractionExperiment &x, size_t buffers = 64) {
|
// What the card writes for the first frames: their conversion
|
||||||
AcquisitionDeviceGroup ret;
|
std::vector<CardImage> CardImages(const DiffractionExperiment &x, int64_t distinct_frames) {
|
||||||
for (int d = 0; d < x.GetDataStreamsNum(); d++)
|
const bool jungfrau = x.GetDetectorType() == DetectorType::JUNGFRAU;
|
||||||
ret.Add(std::make_unique<HLSSimulatedDevice>(d, buffers));
|
PixelMask mask(x);
|
||||||
|
const JFCalibration calib = Calibration(x);
|
||||||
|
std::vector<CardImage> ret;
|
||||||
|
for (int64_t f = 0; f < distinct_frames; f++) {
|
||||||
|
std::vector<uint16_t> raw;
|
||||||
|
for (int m = 0; m < x.GetModulesNum(); m++) {
|
||||||
|
const auto frame = Frame(f, m, jungfrau);
|
||||||
|
raw.insert(raw.end(), frame.begin(), frame.end());
|
||||||
|
}
|
||||||
|
ret.push_back(ConvertedImage(x, calib, mask, raw));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The card writing zeros
|
||||||
|
AcquisitionDeviceGroup Devices(const DiffractionExperiment &x) {
|
||||||
|
return MockDevices(x, {});
|
||||||
|
}
|
||||||
|
|
||||||
struct PathResult {
|
struct PathResult {
|
||||||
std::map<int64_t, Received> images;
|
std::map<int64_t, Received> images;
|
||||||
std::vector<int64_t> arrival;
|
std::vector<int64_t> arrival;
|
||||||
@@ -144,7 +159,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PathResult Run(const DiffractionExperiment &x, bool puller, int64_t distinct_frames, bool rugnux = false) {
|
PathResult Run(const DiffractionExperiment &x, bool puller, int64_t distinct_frames, bool rugnux = false) {
|
||||||
auto devices = Devices(x);
|
auto devices = MockDevices(x, CardImages(x, distinct_frames));
|
||||||
Logger logger("FPGAImagePullerTest");
|
Logger logger("FPGAImagePullerTest");
|
||||||
CollectingPusher pusher;
|
CollectingPusher pusher;
|
||||||
JFJochReceiverService service(devices, logger, pusher, 256);
|
JFJochReceiverService service(devices, logger, pusher, 256);
|
||||||
@@ -153,16 +168,6 @@ namespace {
|
|||||||
service.UseFPGAImagePuller(puller);
|
service.UseFPGAImagePuller(puller);
|
||||||
service.RugnuxLive(rugnux, nullptr, 2, 30);
|
service.RugnuxLive(rugnux, nullptr, 2, 30);
|
||||||
|
|
||||||
const bool jungfrau = x.GetDetectorType() == DetectorType::JUNGFRAU;
|
|
||||||
for (int64_t f = 0; f < distinct_frames; f++) {
|
|
||||||
std::vector<uint16_t> raw;
|
|
||||||
for (int m = 0; m < x.GetModulesNum(); m++) {
|
|
||||||
const auto frame = Frame(f, m, jungfrau);
|
|
||||||
raw.insert(raw.end(), frame.begin(), frame.end());
|
|
||||||
}
|
|
||||||
service.LoadInternalGeneratorImage(x, raw, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
const JFCalibration calib = Calibration(x);
|
const JFCalibration calib = Calibration(x);
|
||||||
service.Start(x, mask, &calib);
|
service.Start(x, mask, &calib);
|
||||||
@@ -407,7 +412,7 @@ TEST_CASE("FPGAImagePuller_SameAsFPGA_EIGER_32bit", "[FPGAImagePuller]") {
|
|||||||
auto x = Base(DetEIGER(2), 3, 1);
|
auto x = Base(DetEIGER(2), 3, 1);
|
||||||
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
||||||
x.EigerBitDepth(32);
|
x.EigerBitDepth(32);
|
||||||
// Pattern from the generator's memory, as the 16-bit raw frames do not map onto a 32-bit stream
|
// The 16-bit raw frames do not map onto a 32-bit stream: the card writes zeros
|
||||||
auto devices = Devices(x);
|
auto devices = Devices(x);
|
||||||
Logger logger("FPGAImagePuller_EIGER32");
|
Logger logger("FPGAImagePuller_EIGER32");
|
||||||
for (const bool puller: {false, true}) {
|
for (const bool puller: {false, true}) {
|
||||||
@@ -497,14 +502,13 @@ TEST_CASE("FPGAImagePuller_MissingModule", "[FPGAImagePuller]") {
|
|||||||
x.UseInternalPacketGenerator(false).Conversion();
|
x.UseInternalPacketGenerator(false).Conversion();
|
||||||
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
||||||
|
|
||||||
auto device = std::make_unique<HLSSimulatedDevice>(0, 64);
|
auto device = std::make_unique<MockAcquisitionDevice>(0, 64);
|
||||||
|
SetOutputs(*device, x, 0, CardImages(x, 1));
|
||||||
for (int64_t f = 0; f < images; f++)
|
for (int64_t f = 0; f < images; f++)
|
||||||
for (int m = 0; m < 2; m++) {
|
for (int m = 0; m < 2; m++) {
|
||||||
if ((m == 1) && (f == 1 || f >= dies_at))
|
if ((m == 1) && (f == 1 || f >= dies_at))
|
||||||
continue;
|
continue;
|
||||||
const auto frame = Frame(f, m, true);
|
device->CreateJFPackets(x, f + 1, 1, m, nullptr);
|
||||||
for (int p = 0; p < 128; p++)
|
|
||||||
device->CreateJFPacket(x, f + 1, p, m, frame.data() + p * 4096);
|
|
||||||
}
|
}
|
||||||
AcquisitionDeviceGroup devices;
|
AcquisitionDeviceGroup devices;
|
||||||
devices.Add(std::move(device));
|
devices.Add(std::move(device));
|
||||||
@@ -524,7 +528,7 @@ TEST_CASE("FPGAImagePuller_MissingModule", "[FPGAImagePuller]") {
|
|||||||
while (!end && std::chrono::steady_clock::now() - t0 < 900s) {
|
while (!end && std::chrono::steady_clock::now() - t0 < 900s) {
|
||||||
const auto m = puller.PollImage(10ms);
|
const auto m = puller.PollImage(10ms);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
if (!stop_requested && std::chrono::steady_clock::now() - last > 60s) {
|
if (!stop_requested && std::chrono::steady_clock::now() - last > 5s) {
|
||||||
stop_requested = true;
|
stop_requested = true;
|
||||||
std::cout << "dead module, before cancel: fastest " << devices[0].Counters().GetFastestFrameNumber()
|
std::cout << "dead module, before cancel: fastest " << devices[0].Counters().GetFastestFrameNumber()
|
||||||
<< " module 0 at " << devices[0].Counters().GetCurrFrameNumber(0)
|
<< " module 0 at " << devices[0].Counters().GetCurrFrameNumber(0)
|
||||||
@@ -575,13 +579,11 @@ TEST_CASE("FPGAImagePuller_Cancel", "[FPGAImagePuller]") {
|
|||||||
x.UseInternalPacketGenerator(false).Conversion();
|
x.UseInternalPacketGenerator(false).Conversion();
|
||||||
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
x.Compression(CompressionAlgorithm::BSHUF_LZ4);
|
||||||
|
|
||||||
auto device = std::make_unique<HLSSimulatedDevice>(0, 64);
|
auto device = std::make_unique<MockAcquisitionDevice>(0, 64);
|
||||||
|
SetOutputs(*device, x, 0, CardImages(x, 3));
|
||||||
for (int64_t f = 0; f < 3; f++)
|
for (int64_t f = 0; f < 3; f++)
|
||||||
for (int m = 0; m < 2; m++) {
|
for (int m = 0; m < 2; m++)
|
||||||
const auto frame = Frame(f, m, true);
|
device->CreateJFPackets(x, f + 1, 1, m, nullptr);
|
||||||
for (int p = 0; p < 128; p++)
|
|
||||||
device->CreateJFPacket(x, f + 1, p, m, frame.data() + p * 4096);
|
|
||||||
}
|
|
||||||
AcquisitionDeviceGroup devices;
|
AcquisitionDeviceGroup devices;
|
||||||
devices.Add(std::move(device));
|
devices.Add(std::move(device));
|
||||||
|
|
||||||
@@ -594,7 +596,7 @@ TEST_CASE("FPGAImagePuller_Cancel", "[FPGAImagePuller]") {
|
|||||||
const JFCalibration calib = Calibration(x);
|
const JFCalibration calib = Calibration(x);
|
||||||
service.Start(x, mask, &calib);
|
service.Start(x, mask, &calib);
|
||||||
|
|
||||||
std::this_thread::sleep_for(30s);
|
std::this_thread::sleep_for(2s);
|
||||||
service.Cancel(silent);
|
service.Cancel(silent);
|
||||||
const auto out = service.Stop();
|
const auto out = service.Stop();
|
||||||
|
|
||||||
@@ -643,7 +645,7 @@ TEST_CASE("FPGAImagePuller_RugnuxReceiver", "[FPGAImagePuller]") {
|
|||||||
x.FilePrefix("fpga_puller_rugnux");
|
x.FilePrefix("fpga_puller_rugnux");
|
||||||
REQUIRE(RugnuxRotationData(x));
|
REQUIRE(RugnuxRotationData(x));
|
||||||
|
|
||||||
auto devices = Devices(x);
|
auto devices = MockDevices(x, CardImages(x, 3));
|
||||||
Logger logger("FPGAImagePuller_Rugnux");
|
Logger logger("FPGAImagePuller_Rugnux");
|
||||||
CollectingPusher pusher;
|
CollectingPusher pusher;
|
||||||
JFJochReceiverService service(devices, logger, pusher, 256);
|
JFJochReceiverService service(devices, logger, pusher, 256);
|
||||||
@@ -651,15 +653,6 @@ TEST_CASE("FPGAImagePuller_RugnuxReceiver", "[FPGAImagePuller]") {
|
|||||||
service.UseFPGAImagePuller(true);
|
service.UseFPGAImagePuller(true);
|
||||||
service.RugnuxLive(true, nullptr, 2, 30);
|
service.RugnuxLive(true, nullptr, 2, 30);
|
||||||
|
|
||||||
for (int64_t f = 0; f < 3; f++) {
|
|
||||||
std::vector<uint16_t> raw;
|
|
||||||
for (int m = 0; m < 2; m++) {
|
|
||||||
const auto frame = Frame(f, m, true);
|
|
||||||
raw.insert(raw.end(), frame.begin(), frame.end());
|
|
||||||
}
|
|
||||||
service.LoadInternalGeneratorImage(x, raw, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
const JFCalibration calib = Calibration(x);
|
const JFCalibration calib = Calibration(x);
|
||||||
service.Start(x, mask, &calib);
|
service.Start(x, mask, &calib);
|
||||||
@@ -675,7 +668,7 @@ TEST_CASE("FPGAImagePuller_RugnuxReceiver", "[FPGAImagePuller]") {
|
|||||||
CHECK_FALSE(pusher.sequence[1].starts_with("calibration")); // the writer gets calibration only from the FPGA receiver
|
CHECK_FALSE(pusher.sequence[1].starts_with("calibration")); // the writer gets calibration only from the FPGA receiver
|
||||||
const auto a = Pixels(pusher.images.at(0).message.image);
|
const auto a = Pixels(pusher.images.at(0).message.image);
|
||||||
const auto b = Pixels(pusher.images.at(3).message.image);
|
const auto b = Pixels(pusher.images.at(3).message.image);
|
||||||
CHECK(a == b); // the third frame in the generator's memory repeats
|
CHECK(a == b); // the card output repeats after the third frame
|
||||||
}
|
}
|
||||||
|
|
||||||
// In an unsigned image the card gives saturated and error pixels one value: the counts are the card's, on every receiver.
|
// In an unsigned image the card gives saturated and error pixels one value: the counts are the card's, on every receiver.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
#include "../receiver/JFJochReceiverTest.h"
|
#include "../receiver/JFJochReceiverTest.h"
|
||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
#include "MockCardOutput.h"
|
||||||
#include "../jungfrau/JFPedestalCalc.h"
|
#include "../jungfrau/JFPedestalCalc.h"
|
||||||
#include "../image_pusher/TestImagePusher.h"
|
#include "../image_pusher/TestImagePusher.h"
|
||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
@@ -19,15 +19,11 @@ TEST_CASE("JFJochReceiverTest_Raw", "[JFJochReceiver]") {
|
|||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
.ImagesPerTrigger(100).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::NO_COMPRESSION);
|
.ImagesPerTrigger(100).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::NO_COMPRESSION);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger logger("JFJochReceiverTest_Raw");
|
Logger logger("JFJochReceiverTest_Raw");
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -41,6 +37,31 @@ TEST_CASE("JFJochReceiverTest_Raw", "[JFJochReceiver]") {
|
|||||||
REQUIRE(!output.status.cancelled);
|
REQUIRE(!output.status.cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Two cards running at the same time - not possible with the HLS simulation
|
||||||
|
TEST_CASE("JFJochReceiverTest_Raw_TwoDevices", "[JFJochReceiver]") {
|
||||||
|
DiffractionExperiment x(DetJF(4));
|
||||||
|
const uint16_t nthreads = 4;
|
||||||
|
|
||||||
|
x.Raw();
|
||||||
|
x.DataStreams(2);
|
||||||
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
|
.ImagesPerTrigger(100).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::NO_COMPRESSION);
|
||||||
|
REQUIRE(x.GetDataStreamsNum() == 2);
|
||||||
|
|
||||||
|
Logger logger("JFJochReceiverTest_Raw_TwoDevices");
|
||||||
|
|
||||||
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
|
JFJochReceiverOutput output;
|
||||||
|
bool ret;
|
||||||
|
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, mask, nthreads));
|
||||||
|
REQUIRE(ret);
|
||||||
|
REQUIRE(output.efficiency == 1.0);
|
||||||
|
REQUIRE(output.status.images_sent == x.GetImageNum());
|
||||||
|
REQUIRE(!output.status.cancelled);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("JFJochReceiverTest_Conversion", "[JFJochReceiver]") {
|
TEST_CASE("JFJochReceiverTest_Conversion", "[JFJochReceiver]") {
|
||||||
Logger logger("JFJochReceiverTest_Conversion");
|
Logger logger("JFJochReceiverTest_Conversion");
|
||||||
|
|
||||||
@@ -51,15 +72,11 @@ TEST_CASE("JFJochReceiverTest_Conversion", "[JFJochReceiver]") {
|
|||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
REQUIRE(x.IsGeometryTransformed());
|
REQUIRE(x.IsGeometryTransformed());
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -94,12 +111,12 @@ TEST_CASE("JFJochReceiverTest_ForceCPUAzInt", "[JFJochReceiver]") {
|
|||||||
for (int i = 0; i < raw_image.size(); i++)
|
for (int i = 0; i < raw_image.size(); i++)
|
||||||
raw_image[i] = 1000 + i % 1000;
|
raw_image[i] = 1000 + i % 1000;
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(ConvertedImage(x, JFCalibration(x), mask, raw_image));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(x, images);
|
||||||
|
|
||||||
TestImagePusher pusher(x.GetImageNum() - 1);
|
TestImagePusher pusher(x.GetImageNum() - 1);
|
||||||
JFJochReceiverService service(aq_devices, logger, pusher);
|
JFJochReceiverService service(aq_devices, logger, pusher);
|
||||||
service.NumThreads(nthreads);
|
service.NumThreads(nthreads);
|
||||||
@@ -136,7 +153,7 @@ TEST_CASE("JFJochReceiverTest_AzIntBinsExceedFPGA", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
TestImagePusher pusher(0);
|
TestImagePusher pusher(0);
|
||||||
@@ -157,13 +174,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_NoGeomTransform", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||||
.GeometryTransformation(false);
|
.GeometryTransformation(false);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -187,13 +200,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Poisson", "[JFJochReceiver]") {
|
|||||||
CompressionAlgorithm::BSHUF_ZSTD);
|
CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.LossyCompressionPoisson(1);
|
x.LossyCompressionPoisson(1);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -217,13 +226,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Threshold", "[JFJochReceiver]") {
|
|||||||
CompressionAlgorithm::BSHUF_ZSTD);
|
CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.PixelValueLowThreshold(50);
|
x.PixelValueLowThreshold(50);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -246,13 +251,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_ApplyMask", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.ApplyPixelMask(true).MaskChipEdges(true).MaskModuleEdges(true);
|
x.ApplyPixelMask(true).MaskChipEdges(true).MaskModuleEdges(true);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -276,13 +277,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Threshold_Summation", "[JFJochReceiver]
|
|||||||
CompressionAlgorithm::BSHUF_ZSTD);
|
CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.PixelValueLowThreshold(10);
|
x.PixelValueLowThreshold(10);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -305,13 +302,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_FixedGainG1", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||||
.FixedGainG1(true);
|
.FixedGainG1(true);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -336,13 +329,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_FixedGainG1_onlyG1", "[JFJochReceiver]"
|
|||||||
.FixedGainG1(true);
|
.FixedGainG1(true);
|
||||||
|
|
||||||
std::vector<uint16_t> input(RAW_MODULE_SIZE*2, 0x4000 + 3000);
|
std::vector<uint16_t> input(RAW_MODULE_SIZE*2, 0x4000 + 3000);
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask, input);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -366,13 +355,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_U16", "[JFJochReceiver]") {
|
|||||||
.BitDepthImage(16).PixelSigned(false);
|
.BitDepthImage(16).PixelSigned(false);
|
||||||
|
|
||||||
REQUIRE(!x.IsPixelSigned());
|
REQUIRE(!x.IsPixelSigned());
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -398,13 +383,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_U8", "[JFJochReceiver]") {
|
|||||||
REQUIRE(!x.IsPixelSigned());
|
REQUIRE(!x.IsPixelSigned());
|
||||||
REQUIRE(x.GetByteDepthImage() == 1);
|
REQUIRE(x.GetByteDepthImage() == 1);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -427,13 +408,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_I32", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||||
.PixelSigned(true).BitDepthImage(32);
|
.PixelSigned(true).BitDepthImage(32);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -455,13 +432,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Summation2", "[JFJochReceiver]") {
|
|||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD).Summation(2);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD).Summation(2);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -484,13 +457,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_Summation7_CPU", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(8).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
.ImagesPerTrigger(8).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD)
|
||||||
.Summation(7).CPUSummation(true);
|
.Summation(7).CPUSummation(true);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -515,13 +484,9 @@ TEST_CASE("JFJochReceiverTest_Conversion_StorageCell", "[JFJochReceiver]") {
|
|||||||
REQUIRE(x.GetImageNum() == 16);
|
REQUIRE(x.GetImageNum() == 16);
|
||||||
REQUIRE(x.GetStorageCellNumber() == 16);
|
REQUIRE(x.GetStorageCellNumber() == 16);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -537,10 +502,10 @@ TEST_CASE("JFJochReceiverTest_PedestalG1", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
const uint16_t nthreads = 4;
|
const uint16_t nthreads = 4;
|
||||||
size_t nframes = 256;
|
size_t nframes = 256;
|
||||||
|
// The card output repeats every distinct_frames frames
|
||||||
|
size_t distinct_frames = 32;
|
||||||
|
|
||||||
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE*nframes);
|
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE * distinct_frames);
|
||||||
|
|
||||||
for (auto &i: pedestal_in) i = 16384 | 14000;
|
|
||||||
|
|
||||||
// Predictable random number generator
|
// Predictable random number generator
|
||||||
std::mt19937 g1(1900);
|
std::mt19937 g1(1900);
|
||||||
@@ -560,15 +525,17 @@ TEST_CASE("JFJochReceiverTest_PedestalG1", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
||||||
test->CreateJFPackets(x, 1, nframes, 0, pedestal_in.data());
|
for (int f = 0; f < distinct_frames; f++)
|
||||||
|
test->SetOutput(f, 0, *OutputWithPixels(pedestal_in.data() + f * RAW_MODULE_SIZE));
|
||||||
|
test->CreateJFPackets(x, 1, nframes, 0, nullptr);
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
}
|
}
|
||||||
|
|
||||||
JFPedestalCalc pc(x);
|
JFPedestalCalc pc(x);
|
||||||
for (int i = 0; i < nframes; i++)
|
for (int i = 0; i < nframes; i++)
|
||||||
pc.AnalyzeImage(pedestal_in.data() + i * RAW_MODULE_SIZE);
|
pc.AnalyzeImage(pedestal_in.data() + (i % distinct_frames) * RAW_MODULE_SIZE);
|
||||||
|
|
||||||
Logger logger("JFJochReceiverTest_PedestalG1");
|
Logger logger("JFJochReceiverTest_PedestalG1");
|
||||||
|
|
||||||
@@ -594,8 +561,10 @@ TEST_CASE("JFJochReceiverTest_PedestalG2_storage_cell", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
const uint16_t nthreads = 4;
|
const uint16_t nthreads = 4;
|
||||||
size_t nframes = 150;
|
size_t nframes = 150;
|
||||||
|
// The card output repeats every 2 * distinct_frames frames
|
||||||
|
size_t distinct_frames = 25;
|
||||||
|
|
||||||
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE*nframes), pedestal_in2(RAW_MODULE_SIZE*nframes);;
|
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE * distinct_frames), pedestal_in2(RAW_MODULE_SIZE * distinct_frames);
|
||||||
|
|
||||||
// Predictable random number generator
|
// Predictable random number generator
|
||||||
std::mt19937 g2(1900);
|
std::mt19937 g2(1900);
|
||||||
@@ -625,10 +594,14 @@ TEST_CASE("JFJochReceiverTest_PedestalG2_storage_cell", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(i, nframes * 2);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, nframes * 2);
|
||||||
|
for (int j = 0; j < distinct_frames; j++) {
|
||||||
|
test->SetOutput(2 * j, 0, *OutputWithPixels(pedestal_in2.data() + j * RAW_MODULE_SIZE));
|
||||||
|
test->SetOutput(2 * j + 1, 0, *OutputWithPixels(pedestal_in.data() + j * RAW_MODULE_SIZE));
|
||||||
|
}
|
||||||
for (int j = 0; j < nframes; j++) {
|
for (int j = 0; j < nframes; j++) {
|
||||||
test->CreateJFPackets(x, 2 * j + 1, 1, 0, pedestal_in2.data() + j * RAW_MODULE_SIZE);
|
test->CreateJFPackets(x, 2 * j + 1, 1, 0, nullptr);
|
||||||
test->CreateJFPackets(x, 2 * j + 2, 1, 0, pedestal_in.data() + j * RAW_MODULE_SIZE);
|
test->CreateJFPackets(x, 2 * j + 2, 1, 0, nullptr);
|
||||||
}
|
}
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
@@ -636,7 +609,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG2_storage_cell", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
JFPedestalCalc pc(x);
|
JFPedestalCalc pc(x);
|
||||||
for (int i = 0; i < nframes; i++)
|
for (int i = 0; i < nframes; i++)
|
||||||
pc.AnalyzeImage(pedestal_in.data() + i * RAW_MODULE_SIZE);
|
pc.AnalyzeImage(pedestal_in.data() + (i % distinct_frames) * RAW_MODULE_SIZE);
|
||||||
|
|
||||||
Logger logger("JFJochReceiverTest_PedestalG2_storage_cell");
|
Logger logger("JFJochReceiverTest_PedestalG2_storage_cell");
|
||||||
|
|
||||||
@@ -660,10 +633,10 @@ TEST_CASE("JFJochReceiverTest_PedestalG0", "[JFJochReceiver]") {
|
|||||||
DiffractionExperiment x(DetJF(1));
|
DiffractionExperiment x(DetJF(1));
|
||||||
const uint16_t nthreads = 4;
|
const uint16_t nthreads = 4;
|
||||||
size_t nframes = 500;
|
size_t nframes = 500;
|
||||||
|
// The card output repeats every distinct_frames frames
|
||||||
|
size_t distinct_frames = 25;
|
||||||
|
|
||||||
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE*nframes);
|
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE * distinct_frames);
|
||||||
|
|
||||||
for (auto &i: pedestal_in) i = 16384 | 14000;
|
|
||||||
|
|
||||||
// Predictable random number generator
|
// Predictable random number generator
|
||||||
std::mt19937 g1(1900);
|
std::mt19937 g1(1900);
|
||||||
@@ -683,15 +656,17 @@ TEST_CASE("JFJochReceiverTest_PedestalG0", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(i,64);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
||||||
test->CreateJFPackets(x, 1, nframes, 0, pedestal_in.data());
|
for (int f = 0; f < distinct_frames; f++)
|
||||||
|
test->SetOutput(f, 0, *OutputWithPixels(pedestal_in.data() + f * RAW_MODULE_SIZE));
|
||||||
|
test->CreateJFPackets(x, 1, nframes, 0, nullptr);
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
}
|
}
|
||||||
|
|
||||||
JFPedestalCalc pc(x);
|
JFPedestalCalc pc(x);
|
||||||
for (int i = 0; i < nframes; i++)
|
for (int i = 0; i < nframes; i++)
|
||||||
pc.AnalyzeImage(pedestal_in.data() + i * RAW_MODULE_SIZE);
|
pc.AnalyzeImage(pedestal_in.data() + (i % distinct_frames) * RAW_MODULE_SIZE);
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
|
||||||
@@ -732,13 +707,12 @@ TEST_CASE("JFJochReceiverTest_PedestalG0_StorageCell", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(0).IncidentEnergy_keV(12.4);
|
.ImagesPerTrigger(0).IncidentEnergy_keV(12.4);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
auto test = std::make_unique<MockAcquisitionDevice>(0, 64);
|
||||||
for (int i = 0; i < nframes; i++) {
|
test->SetOutput(0, 0, *OutputWithPixels(pedestal_in_0.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 1, 1, 0, pedestal_in_0.data());
|
test->SetOutput(1, 0, *OutputWithPixels(pedestal_in_1.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 2, 1, 0, pedestal_in_1.data());
|
test->SetOutput(2, 0, *OutputWithPixels(pedestal_in_2.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 3, 1, 0, pedestal_in_2.data());
|
test->SetOutput(3, 0, *OutputWithPixels(pedestal_in_3.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 4, 1, 0, pedestal_in_3.data());
|
test->CreateJFPackets(x, 1, nframes * 4, 0, nullptr);
|
||||||
}
|
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
|
|
||||||
@@ -790,13 +764,12 @@ TEST_CASE("JFJochReceiverTest_PedestalFixedG1_StorageCell", "[JFJochReceiver]")
|
|||||||
REQUIRE(x.GetStorageCellNumber() == 4);
|
REQUIRE(x.GetStorageCellNumber() == 4);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
auto test = std::make_unique<MockAcquisitionDevice>(0, 64);
|
||||||
for (int i = 0; i < nframes; i++) {
|
test->SetOutput(0, 0, *OutputWithPixels(pedestal_in_0.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 1, 1, 0, pedestal_in_0.data());
|
test->SetOutput(1, 0, *OutputWithPixels(pedestal_in_1.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 2, 1, 0, pedestal_in_1.data());
|
test->SetOutput(2, 0, *OutputWithPixels(pedestal_in_2.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 3, 1, 0, pedestal_in_2.data());
|
test->SetOutput(3, 0, *OutputWithPixels(pedestal_in_3.data()));
|
||||||
test->CreateJFPackets(x, i * 4 + 4, 1, 0, pedestal_in_3.data());
|
test->CreateJFPackets(x, 1, nframes * 4, 0, nullptr);
|
||||||
}
|
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
|
|
||||||
@@ -840,7 +813,7 @@ TEST_CASE("JFJochReceiverTest_PedestalG1_NoFrames", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(i, nframes + 8);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, nframes + 8);
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
}
|
}
|
||||||
@@ -875,19 +848,28 @@ TEST_CASE("JFJochReceiverTest_PacketLost_Raw", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
PixelMask pixel_mask(x);
|
PixelMask pixel_mask(x);
|
||||||
|
|
||||||
|
// The card writes the missing packet as UINT16_MAX
|
||||||
|
std::vector<uint16_t> frame_lost = frame_in;
|
||||||
|
for (int i = 127 * 4096; i < RAW_MODULE_SIZE; i++)
|
||||||
|
frame_lost[i] = UINT16_MAX;
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
||||||
test->CreateJFPackets(x, 1, 1, 0, frame_in.data());
|
for (int image = 0; image < 4; image++) {
|
||||||
test->CreateJFPackets(x, 1, 1, 1, frame_in.data());
|
test->SetOutput(image, 0, *OutputWithPixels((image == 3) ? frame_lost.data() : frame_in.data()));
|
||||||
test->CreateJFPackets(x, 2, 1, 0, frame_in.data());
|
test->SetOutput(image, 1, *OutputWithPixels(frame_in.data()));
|
||||||
test->CreateJFPackets(x, 2, 1, 1, frame_in.data());
|
}
|
||||||
test->CreateJFPackets(x, 3, 1, 0, frame_in.data());
|
test->CreateJFPackets(x, 1, 1, 0, nullptr);
|
||||||
test->CreateJFPackets(x, 3, 1, 1, frame_in.data());
|
test->CreateJFPackets(x, 1, 1, 1, nullptr);
|
||||||
|
test->CreateJFPackets(x, 2, 1, 0, nullptr);
|
||||||
|
test->CreateJFPackets(x, 2, 1, 1, nullptr);
|
||||||
|
test->CreateJFPackets(x, 3, 1, 0, nullptr);
|
||||||
|
test->CreateJFPackets(x, 3, 1, 1, nullptr);
|
||||||
|
|
||||||
for (int j = 0; j < 127; j++)
|
for (int j = 0; j < 127; j++)
|
||||||
test->CreateJFPacket(x, 4, j, 0, frame_in.data() + (i * 128 + j) * 4096);
|
test->CreateJFPacket(x, 4, j, 0, nullptr);
|
||||||
test->CreateJFPackets(x, 4, 1, 1, frame_in.data());
|
test->CreateJFPackets(x, 4, 1, 1, nullptr);
|
||||||
test->CreateFinalPacket(x);
|
test->CreateFinalPacket(x);
|
||||||
|
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
@@ -939,13 +921,15 @@ TEST_CASE("JFJochReceiverTest_Cancel", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(i, 64);
|
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
||||||
test->CreateJFPackets(x, 1, 1, 0, frame_in.data());
|
test->SetOutput(0, 0, *OutputWithPixels(frame_in.data()));
|
||||||
test->CreateJFPackets(x, 1, 1, 1, frame_in.data());
|
test->SetOutput(0, 1, *OutputWithPixels(frame_in.data()));
|
||||||
test->CreateJFPackets(x, 2, 1, 0, frame_in.data());
|
test->CreateJFPackets(x, 1, 1, 0, nullptr);
|
||||||
test->CreateJFPackets(x, 2, 1, 1, frame_in.data());
|
test->CreateJFPackets(x, 1, 1, 1, nullptr);
|
||||||
test->CreateJFPackets(x, 3, 1, 0, frame_in.data());
|
test->CreateJFPackets(x, 2, 1, 0, nullptr);
|
||||||
test->CreateJFPackets(x, 3, 1, 1, frame_in.data());
|
test->CreateJFPackets(x, 2, 1, 1, nullptr);
|
||||||
|
test->CreateJFPackets(x, 3, 1, 0, nullptr);
|
||||||
|
test->CreateJFPackets(x, 3, 1, 1, nullptr);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
}
|
}
|
||||||
Logger logger("JFJochReceiverTest_Cancel");
|
Logger logger("JFJochReceiverTest_Cancel");
|
||||||
@@ -958,7 +942,7 @@ TEST_CASE("JFJochReceiverTest_Cancel", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
service.Start(x, pixel_mask, &calib);
|
service.Start(x, pixel_mask, &calib);
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(60));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
service.Cancel(false);
|
service.Cancel(false);
|
||||||
|
|
||||||
auto receiver_out = service.Stop();
|
auto receiver_out = service.Stop();
|
||||||
@@ -972,12 +956,13 @@ TEST_CASE("JFJochReceiverTest_Pedestal_Cancel", "[JFJochReceiver]") {
|
|||||||
x.Mode(DetectorMode::PedestalG0);
|
x.Mode(DetectorMode::PedestalG0);
|
||||||
x.PedestalG0Frames(100).NumTriggers(1).UseInternalPacketGenerator(false).IncidentEnergy_keV(12.4);
|
x.PedestalG0Frames(100).NumTriggers(1).UseInternalPacketGenerator(false).IncidentEnergy_keV(12.4);
|
||||||
|
|
||||||
std::vector<uint16_t> frame_in(RAW_MODULE_SIZE * 10, 1000);
|
std::vector<uint16_t> frame_in(RAW_MODULE_SIZE, 1000);
|
||||||
|
|
||||||
// Only the first frames of the 100 arrive, and no final packet: the run waits until it is cancelled.
|
// Only the first frames of the 100 arrive, and no final packet: the run waits until it is cancelled.
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
auto test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
auto test = std::make_unique<MockAcquisitionDevice>(0, 64);
|
||||||
test->CreateJFPackets(x, 1, 10, 0, frame_in.data());
|
test->SetOutput(0, 0, *OutputWithPixels(frame_in.data()));
|
||||||
|
test->CreateJFPackets(x, 1, 10, 0, nullptr);
|
||||||
aq_devices.Add(std::move(test));
|
aq_devices.Add(std::move(test));
|
||||||
|
|
||||||
PixelMask pixel_mask(x);
|
PixelMask pixel_mask(x);
|
||||||
@@ -986,7 +971,7 @@ TEST_CASE("JFJochReceiverTest_Pedestal_Cancel", "[JFJochReceiver]") {
|
|||||||
service.NumThreads(4);
|
service.NumThreads(4);
|
||||||
|
|
||||||
service.Start(x, pixel_mask, nullptr);
|
service.Start(x, pixel_mask, nullptr);
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
service.Cancel(false);
|
service.Cancel(false);
|
||||||
|
|
||||||
auto output = service.Stop();
|
auto output = service.Stop();
|
||||||
@@ -1010,13 +995,9 @@ TEST_CASE("JFJochReceiverTest_EIGER", "[JFJochReceiver]") {
|
|||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -1038,13 +1019,9 @@ TEST_CASE("JFJochReceiverTest_EIGER_8bit", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.EigerBitDepth(8);
|
x.EigerBitDepth(8);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -1066,13 +1043,9 @@ TEST_CASE("JFJochReceiverTest_EIGER_32bit", "[JFJochReceiver]") {
|
|||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
x.EigerBitDepth(32);
|
x.EigerBitDepth(32);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
@@ -1094,13 +1067,9 @@ TEST_CASE("JFJochReceiverTest_EIGER_conversion", "[JFJochReceiver]") {
|
|||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(i,64);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
AcquisitionDeviceGroup aq_devices = ConvertingMocks(x, mask);
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
JFJochReceiverOutput output;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "../receiver/JFJochReceiverTest.h"
|
#include "../receiver/JFJochReceiverTest.h"
|
||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
#include "MockCardOutput.h"
|
||||||
#include "../writer/HDF5Objects.h"
|
#include "../writer/HDF5Objects.h"
|
||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
#include "../preview/JFJochTIFF.h"
|
#include "../preview/JFJochTIFF.h"
|
||||||
@@ -50,13 +50,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index", "[JFJochReceiver]"
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -72,13 +76,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index", "[JFJochReceiver]"
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -142,13 +139,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_refinement", "[JFJoc
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -164,13 +165,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_refinement", "[JFJoc
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -235,13 +229,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_refinement_tetragona
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -257,13 +255,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_refinement_tetragona
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -323,13 +314,18 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_index_and_integrate", "[JFJoch
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
settings.quick_integration = true;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -345,14 +341,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_index_and_integrate", "[JFJoch
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
settings.quick_integration = true;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -419,13 +407,18 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_index_and_integrate_no_spots",
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 20; // make sure there are zero spots possible
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 10000;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 5;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
settings.quick_integration = true;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -441,14 +434,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_index_and_integrate_no_spots",
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 20; // make sure there are zero spots possible
|
|
||||||
settings.photon_count_threshold = 10000;
|
|
||||||
settings.min_pix_per_spot = 5;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
settings.quick_integration = true;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -501,13 +486,11 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_azint_2d", "[JFJochReceiver]") {
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
std::vector<CardImage> images;
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom,
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
DiffractionExperiment::DefaultDataProcessingSettings()));
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -574,13 +557,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT", "[JFJochReceiv
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -596,13 +583,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT", "[JFJochReceiv
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -663,13 +643,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFTW", "[JFJochRecei
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -685,13 +669,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFTW", "[JFJochRecei
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -753,13 +730,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT_reference", "[JF
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -775,13 +756,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT_reference", "[JF
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -843,13 +817,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT_wrong_reference"
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -865,13 +843,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_FFT_wrong_reference"
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -937,13 +908,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_grid", "[JFJochRecei
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -959,13 +934,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_grid", "[JFJochRecei
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -1041,13 +1009,17 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_32", "[JFJochReceive
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -1063,13 +1035,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_32", "[JFJochReceive
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -1130,12 +1095,15 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_min_pix_2", "[JFJoch
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 3;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 2;
|
||||||
aq_devices.Add(std::move(test));
|
settings.max_pix_per_spot = 200;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
ZMQImagePuller puller(pusher.GetAddress()[0]);
|
ZMQImagePuller puller(pusher.GetAddress()[0]);
|
||||||
@@ -1146,11 +1114,6 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_min_pix_2", "[JFJoch
|
|||||||
service.NumThreads(nthreads);
|
service.NumThreads(nthreads);
|
||||||
service.Indexing(experiment.GetIndexingSettings());
|
service.Indexing(experiment.GetIndexingSettings());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 3;
|
|
||||||
settings.min_pix_per_spot = 2;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -1266,13 +1229,11 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_ROI", "[JFJochReceiver]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
std::vector<CardImage> images;
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom,
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
DiffractionExperiment::DefaultDataProcessingSettings()));
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
ZMQImagePuller puller(pusher.GetAddress()[0]);
|
ZMQImagePuller puller(pusher.GetAddress()[0]);
|
||||||
@@ -1340,7 +1301,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQPreview", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
NonePusher pusher;
|
NonePusher pusher;
|
||||||
|
|
||||||
@@ -1404,7 +1365,7 @@ TEST_CASE("JFJochIntegrationTest_ZMQMetadata", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
NonePusher pusher;
|
NonePusher pusher;
|
||||||
|
|
||||||
@@ -1464,7 +1425,7 @@ TEST_CASE("JFJochIntegrationTest_HDF5FilePusher", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
HDF5FilePusher pusher;
|
HDF5FilePusher pusher;
|
||||||
|
|
||||||
@@ -1498,7 +1459,7 @@ TEST_CASE("JFJochIntegrationTest_HDF5FilePusher_republish", "[JFJochReceiver]")
|
|||||||
PixelMask pixel_mask(experiment);
|
PixelMask pixel_mask(experiment);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
HDF5FilePusher pusher(repub_addr);
|
HDF5FilePusher pusher(repub_addr);
|
||||||
|
|
||||||
@@ -1560,7 +1521,7 @@ TEST_CASE("JFJochIntegrationTest_HDF5FilePusher_Raw", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
HDF5FilePusher pusher;
|
HDF5FilePusher pusher;
|
||||||
|
|
||||||
@@ -1610,13 +1571,13 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_no_processing", "[JFJochReceiver]")
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.enable = false;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.indexing = true;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
aq_devices.Add(std::move(test));
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
||||||
TCPImagePuller puller(pusher.GetAddress()[0]);
|
TCPImagePuller puller(pusher.GetAddress()[0]);
|
||||||
@@ -1630,9 +1591,6 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_no_processing", "[JFJochReceiver]")
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.enable = false;
|
|
||||||
settings.indexing = true;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -1687,13 +1645,17 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_spot_and_index", "[JFJochReceiver]"
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
||||||
|
|
||||||
@@ -1708,13 +1670,6 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_spot_and_index", "[JFJochReceiver]"
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
@@ -1769,9 +1724,7 @@ TEST_CASE("JFJochIntegrationTest_TCP_calibration", "[JFJochReceiver]") {
|
|||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
|
|
||||||
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
||||||
|
|
||||||
@@ -1829,13 +1782,17 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_spot_and_index_single_file", "[JFJo
|
|||||||
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
|
||||||
logger.Info("Loaded image");
|
logger.Info("Loaded image");
|
||||||
|
|
||||||
// Setup acquisition device
|
// Setup acquisition device: the card writes the image, with the strong pixels of its spot finder
|
||||||
AcquisitionDeviceGroup aq_devices;
|
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
||||||
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
|
settings.signal_to_noise_threshold = 2.5;
|
||||||
for (int m = 0; m < experiment.GetModulesNum(); m++)
|
settings.photon_count_threshold = 5;
|
||||||
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
|
settings.min_pix_per_spot = 1;
|
||||||
|
settings.max_pix_per_spot = 200;
|
||||||
aq_devices.Add(std::move(test));
|
settings.high_resolution_limit = 2.0;
|
||||||
|
settings.low_resolution_limit = 50.0;
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
images.push_back(Int16Image(experiment, pixel_mask, image_raw_geom, settings));
|
||||||
|
AcquisitionDeviceGroup aq_devices = MockDevices(experiment, images);
|
||||||
|
|
||||||
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
TCPStreamPusher pusher("tcp://127.0.0.1:*", 1);
|
||||||
|
|
||||||
@@ -1850,13 +1807,6 @@ TEST_CASE("JFJochIntegrationTest_TCP_crystal_spot_and_index_single_file", "[JFJo
|
|||||||
// No progress value at the start of measurement
|
// No progress value at the start of measurement
|
||||||
REQUIRE(!service.GetProgress().has_value());
|
REQUIRE(!service.GetProgress().has_value());
|
||||||
|
|
||||||
SpotFindingSettings settings = DiffractionExperiment::DefaultDataProcessingSettings();
|
|
||||||
settings.signal_to_noise_threshold = 2.5;
|
|
||||||
settings.photon_count_threshold = 5;
|
|
||||||
settings.min_pix_per_spot = 1;
|
|
||||||
settings.max_pix_per_spot = 200;
|
|
||||||
settings.high_resolution_limit = 2.0;
|
|
||||||
settings.low_resolution_limit = 50.0;
|
|
||||||
service.SetSpotFindingSettings(settings);
|
service.SetSpotFindingSettings(settings);
|
||||||
|
|
||||||
service.Start(experiment, pixel_mask, nullptr);
|
service.Start(experiment, pixel_mask, nullptr);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
#include "../acquisition_device/MockAcquisitionDevice.h"
|
||||||
#include "../compression/JFJochCompressor.h"
|
#include "../compression/JFJochCompressor.h"
|
||||||
#include "../image_analysis/structure_refinement/RugnuxModel.h"
|
#include "../image_analysis/structure_refinement/RugnuxModel.h"
|
||||||
#include "../image_puller/TestImagePuller.h"
|
#include "../image_puller/TestImagePuller.h"
|
||||||
@@ -582,7 +582,7 @@ TEST_CASE("JFJochReceiverFPGA_RugnuxOnStaysPerImage", "[JFJochReceiverRugnux]")
|
|||||||
PixelMask mask(x);
|
PixelMask mask(x);
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(0, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(0, 64));
|
||||||
|
|
||||||
RecordingPusher pusher;
|
RecordingPusher pusher;
|
||||||
JFJochReceiverService service(aq_devices, logger, pusher);
|
JFJochReceiverService service(aq_devices, logger, pusher);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#include "../broker/JFJochStateMachine.h"
|
#include "../broker/JFJochStateMachine.h"
|
||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
#include "../acquisition_device/MockAcquisitionDevice.h"
|
||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
#include "../broker/OpenAPIConvert.h"
|
#include "../broker/OpenAPIConvert.h"
|
||||||
#include "../broker/ModulePlacementConvert.h"
|
#include "../broker/ModulePlacementConvert.h"
|
||||||
@@ -273,7 +273,7 @@ TEST_CASE("JFJochStateMachine_AsyncStartFailure") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
RefusingImagePusher pusher;
|
RefusingImagePusher pusher;
|
||||||
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
||||||
@@ -447,7 +447,7 @@ TEST_CASE("JFJochStateMachine_CancelledRunIsNotAnError") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
GatedPusher pusher;
|
GatedPusher pusher;
|
||||||
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
||||||
@@ -503,7 +503,7 @@ TEST_CASE("JFJochStateMachine_WriterFailureAtEndIsAnError") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
FinalizeFailingPusher pusher;
|
FinalizeFailingPusher pusher;
|
||||||
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
||||||
@@ -558,7 +558,7 @@ TEST_CASE("JFJochStateMachine_PreflightRefusesBeforeStarting") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
PreflightRefusingPusher pusher;
|
PreflightRefusingPusher pusher;
|
||||||
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
||||||
@@ -677,7 +677,7 @@ TEST_CASE("JFJochStateMachine_StartModulePlacement") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
for (int i = 0; i < experiment.GetDataStreamsNum(); i++)
|
||||||
aq_devices.Add(std::make_unique<HLSSimulatedDevice>(i, 64));
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
StartMessageCapture pusher;
|
StartMessageCapture pusher;
|
||||||
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService receiver_service(aq_devices, logger, pusher);
|
||||||
JFJochServices services(logger);
|
JFJochServices services(logger);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
// MockAcquisitionDevice against HLSSimulatedDevice: the same scenario runs on the HLS simulation, what the card
|
// MockAcquisitionDevice against HLSSimulatedDevice: the same scenario runs on the HLS simulation, what the card
|
||||||
// wrote is recorded and given to the mock, and the host must see the same on both - the buffers, which module
|
// wrote is recorded and given to the mock, and the host must see the same on both - the buffers, which module
|
||||||
// went to which buffer (i.e. the order of completions), counters and, for the receiver, its results.
|
// went to which buffer (i.e. the order of completions), counters and, for the receiver, its results.
|
||||||
// Then receiver tests of JFJochReceiverIntegrationTest.cpp, run on the mock.
|
|
||||||
|
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#include <random>
|
#include <random>
|
||||||
@@ -12,9 +11,7 @@
|
|||||||
#include "../acquisition_device/HLSSimulatedDevice.h"
|
#include "../acquisition_device/HLSSimulatedDevice.h"
|
||||||
#include "../acquisition_device/MockAcquisitionDevice.h"
|
#include "../acquisition_device/MockAcquisitionDevice.h"
|
||||||
#include "../image_pusher/TestImagePusher.h"
|
#include "../image_pusher/TestImagePusher.h"
|
||||||
#include "../jungfrau/JFPedestalCalc.h"
|
|
||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
#include "../receiver/JFJochReceiverTest.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// HLS simulation that can give away everything it wrote to the host - as long as no buffer was used twice
|
// HLS simulation that can give away everything it wrote to the host - as long as no buffer was used twice
|
||||||
@@ -32,12 +29,6 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<DeviceOutput> OutputWithPixels(const uint16_t *pixels) {
|
|
||||||
auto ret = std::make_unique<DeviceOutput>();
|
|
||||||
memcpy(ret->pixels, pixels, RAW_MODULE_SIZE * sizeof(uint16_t));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CompareDevices(const AcquisitionDevice &hls, const AcquisitionDevice &mock, const DiffractionExperiment &x) {
|
void CompareDevices(const AcquisitionDevice &hls, const AcquisitionDevice &mock, const DiffractionExperiment &x) {
|
||||||
CHECK(hls.GetBytesReceived() == mock.GetBytesReceived());
|
CHECK(hls.GetBytesReceived() == mock.GetBytesReceived());
|
||||||
CHECK(hls.Counters().GetSlowestFrameNumber() == mock.Counters().GetSlowestFrameNumber());
|
CHECK(hls.Counters().GetSlowestFrameNumber() == mock.Counters().GetSlowestFrameNumber());
|
||||||
@@ -275,240 +266,3 @@ TEST_CASE("MockAcquisitionDevice_SameAsHLS_Receiver", "[MockAcquisitionDevice][H
|
|||||||
CHECK(memcmp(mock_plots[i].data(), hls_plots[i].data(), hls_plots[i].size() * sizeof(float)) == 0);
|
CHECK(memcmp(mock_plots[i].data(), hls_plots[i].data(), hls_plots[i].size() * sizeof(float)) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receiver tests of JFJochReceiverIntegrationTest.cpp on the mock; the card output is given by the test
|
|
||||||
|
|
||||||
TEST_CASE("MockAcquisitionDevice_JFJochReceiverTest_Raw", "[MockAcquisitionDevice]") {
|
|
||||||
DiffractionExperiment x(DetJF(4));
|
|
||||||
const uint16_t nthreads = 4;
|
|
||||||
|
|
||||||
x.Raw();
|
|
||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
|
||||||
.ImagesPerTrigger(100).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::NO_COMPRESSION);
|
|
||||||
|
|
||||||
// In raw mode the card writes the detector frame, here the one JFJochReceiverTest() expects
|
|
||||||
std::vector<uint16_t> raw(RAW_MODULE_SIZE * x.GetModulesNum());
|
|
||||||
for (int i = 0; i < raw.size(); i++)
|
|
||||||
raw[i] = i % 65536;
|
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
|
||||||
for (int m = 0; m < x.GetModulesNum(i); m++)
|
|
||||||
test->SetOutput(0, m, *OutputWithPixels(raw.data() + (x.GetFirstModuleOfDataStream(i) + m) * RAW_MODULE_SIZE));
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger logger("MockAcquisitionDevice_JFJochReceiverTest_Raw");
|
|
||||||
PixelMask mask(x);
|
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
|
||||||
bool ret;
|
|
||||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, mask, raw, nthreads));
|
|
||||||
REQUIRE(ret);
|
|
||||||
REQUIRE(output.efficiency == 1.0);
|
|
||||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
|
||||||
REQUIRE(output.status.compressed_ratio == 1.0);
|
|
||||||
REQUIRE(output.status.compressed_size == x.GetImageNum() * x.GetByteDepthImage() * x.GetPixelsNum());
|
|
||||||
REQUIRE(output.status.max_image_number_sent == x.GetImageNum());
|
|
||||||
REQUIRE(!output.status.cancelled);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Two cards running at the same time - not possible with the HLS simulation
|
|
||||||
TEST_CASE("MockAcquisitionDevice_JFJochReceiverTest_Raw_TwoDevices", "[MockAcquisitionDevice]") {
|
|
||||||
DiffractionExperiment x(DetJF(4));
|
|
||||||
const uint16_t nthreads = 4;
|
|
||||||
|
|
||||||
x.Raw();
|
|
||||||
x.DataStreams(2);
|
|
||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
|
||||||
.ImagesPerTrigger(100).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::NO_COMPRESSION);
|
|
||||||
REQUIRE(x.GetDataStreamsNum() == 2);
|
|
||||||
|
|
||||||
std::vector<uint16_t> raw(RAW_MODULE_SIZE * x.GetModulesNum());
|
|
||||||
for (int i = 0; i < raw.size(); i++)
|
|
||||||
raw[i] = i % 65536;
|
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
|
||||||
for (int m = 0; m < x.GetModulesNum(i); m++)
|
|
||||||
test->SetOutput(0, m, *OutputWithPixels(raw.data() + (x.GetFirstModuleOfDataStream(i) + m) * RAW_MODULE_SIZE));
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger logger("MockAcquisitionDevice_JFJochReceiverTest_Raw_TwoDevices");
|
|
||||||
PixelMask mask(x);
|
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
|
||||||
bool ret;
|
|
||||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, mask, raw, nthreads));
|
|
||||||
REQUIRE(ret);
|
|
||||||
REQUIRE(output.efficiency == 1.0);
|
|
||||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
|
||||||
REQUIRE(!output.status.cancelled);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("MockAcquisitionDevice_JFJochReceiverTest_EIGER", "[MockAcquisitionDevice]") {
|
|
||||||
Logger logger("MockAcquisitionDevice_JFJochReceiverTest_EIGER");
|
|
||||||
|
|
||||||
DiffractionExperiment x(DetEIGER(2));
|
|
||||||
const uint16_t nthreads = 4;
|
|
||||||
|
|
||||||
x.Raw();
|
|
||||||
x.PedestalG0Frames(0).NumTriggers(1).UseInternalPacketGenerator(true)
|
|
||||||
.ImagesPerTrigger(32).ImagesPerFile(10).IncidentEnergy_keV(12.4).Compression(CompressionAlgorithm::BSHUF_ZSTD);
|
|
||||||
|
|
||||||
std::vector<uint16_t> raw(RAW_MODULE_SIZE * x.GetModulesNum());
|
|
||||||
for (int i = 0; i < raw.size(); i++)
|
|
||||||
raw[i] = i % 65536;
|
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
|
||||||
for (int m = 0; m < x.GetModulesNum(i); m++)
|
|
||||||
test->SetOutput(0, m, *OutputWithPixels(raw.data() + (x.GetFirstModuleOfDataStream(i) + m) * RAW_MODULE_SIZE));
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
|
||||||
|
|
||||||
JFJochReceiverOutput output;
|
|
||||||
bool ret;
|
|
||||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, mask, raw, nthreads));
|
|
||||||
REQUIRE(ret);
|
|
||||||
REQUIRE(output.efficiency == 1.0);
|
|
||||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
|
||||||
REQUIRE(!output.status.cancelled);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("MockAcquisitionDevice_JFJochReceiverTest_PacketLost_Raw", "[MockAcquisitionDevice]") {
|
|
||||||
DiffractionExperiment x(DetJF(2));
|
|
||||||
const uint16_t nthreads = 4;
|
|
||||||
|
|
||||||
std::vector<uint16_t> frame_in(RAW_MODULE_SIZE);
|
|
||||||
for (auto &i: frame_in) i = 776;
|
|
||||||
|
|
||||||
x.Raw();
|
|
||||||
x.PedestalG0Frames(0).NumTriggers(1)
|
|
||||||
.UseInternalPacketGenerator(false).ImagesPerTrigger(4).IncidentEnergy_keV(12.4)
|
|
||||||
.Compression(CompressionAlgorithm::NO_COMPRESSION);
|
|
||||||
|
|
||||||
PixelMask pixel_mask(x);
|
|
||||||
|
|
||||||
// The card writes the missing packet as UINT16_MAX
|
|
||||||
std::vector<uint16_t> frame_lost = frame_in;
|
|
||||||
for (int i = 127 * 4096; i < RAW_MODULE_SIZE; i++)
|
|
||||||
frame_lost[i] = UINT16_MAX;
|
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
|
||||||
for (int image = 0; image < 4; image++) {
|
|
||||||
test->SetOutput(image, 0, *OutputWithPixels((image == 3) ? frame_lost.data() : frame_in.data()));
|
|
||||||
test->SetOutput(image, 1, *OutputWithPixels(frame_in.data()));
|
|
||||||
}
|
|
||||||
|
|
||||||
test->CreateJFPackets(x, 1, 1, 0, frame_in.data());
|
|
||||||
test->CreateJFPackets(x, 1, 1, 1, frame_in.data());
|
|
||||||
test->CreateJFPackets(x, 2, 1, 0, frame_in.data());
|
|
||||||
test->CreateJFPackets(x, 2, 1, 1, frame_in.data());
|
|
||||||
test->CreateJFPackets(x, 3, 1, 0, frame_in.data());
|
|
||||||
test->CreateJFPackets(x, 3, 1, 1, frame_in.data());
|
|
||||||
|
|
||||||
for (int j = 0; j < 127; j++)
|
|
||||||
test->CreateJFPacket(x, 4, j, 0, nullptr);
|
|
||||||
test->CreateJFPackets(x, 4, 1, 1, frame_in.data());
|
|
||||||
test->CreateFinalPacket(x);
|
|
||||||
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
Logger logger("MockAcquisitionDevice_JFJochReceiverTest_PacketLost_Raw");
|
|
||||||
|
|
||||||
JFCalibration calib(x);
|
|
||||||
|
|
||||||
TestImagePusher pusher(x.GetImageNum() - 1);
|
|
||||||
|
|
||||||
JFJochReceiverService service(aq_devices, logger, pusher);
|
|
||||||
service.NumThreads(nthreads);
|
|
||||||
|
|
||||||
service.Start(x, pixel_mask, &calib);
|
|
||||||
auto receiver_out = service.Stop();
|
|
||||||
|
|
||||||
const auto image = pusher.GetImage();
|
|
||||||
|
|
||||||
REQUIRE(aq_devices[0].GetBytesReceived() == (8 * 128 - 1) * 8192UL);
|
|
||||||
REQUIRE(image.size() == 2 * RAW_MODULE_SIZE * sizeof(uint16_t));
|
|
||||||
REQUIRE(pusher.GetCounter() == x.GetImageNum());
|
|
||||||
|
|
||||||
auto raw = (const uint16_t *) (image.data());
|
|
||||||
CHECK(raw[0] == 776);
|
|
||||||
CHECK(raw[256 * 1024 + 315] == 776);
|
|
||||||
CHECK(raw[RAW_MODULE_SIZE - 4095] == UINT16_MAX);
|
|
||||||
CHECK(raw[RAW_MODULE_SIZE - 1] == UINT16_MAX);
|
|
||||||
|
|
||||||
CHECK(raw[RAW_MODULE_SIZE + 0] == 776);
|
|
||||||
CHECK(raw[RAW_MODULE_SIZE + 256 * 1024 + 315] == 776);
|
|
||||||
CHECK(raw[2 * RAW_MODULE_SIZE - 1] == 776);
|
|
||||||
|
|
||||||
REQUIRE(receiver_out.efficiency < 1.0);
|
|
||||||
REQUIRE(receiver_out.status.images_sent == x.GetImageNum());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("MockAcquisitionDevice_JFJochReceiverTest_PedestalG0", "[MockAcquisitionDevice]") {
|
|
||||||
DiffractionExperiment x(DetJF(1));
|
|
||||||
const uint16_t nthreads = 4;
|
|
||||||
size_t nframes = 500;
|
|
||||||
// The card output repeats every distinct_frames frames
|
|
||||||
size_t distinct_frames = 25;
|
|
||||||
|
|
||||||
std::vector<uint16_t> pedestal_in(RAW_MODULE_SIZE * distinct_frames);
|
|
||||||
|
|
||||||
// Predictable random number generator
|
|
||||||
std::mt19937 g1(1900);
|
|
||||||
std::normal_distribution<double> distribution(3000, 50);
|
|
||||||
|
|
||||||
for (auto &i: pedestal_in) {
|
|
||||||
uint16_t number = distribution(g1);
|
|
||||||
if (number < 20) number = 20;
|
|
||||||
if (number > 16300) number = 16300;
|
|
||||||
i = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
x.Mode(DetectorMode::PedestalG0);
|
|
||||||
x.PedestalG0Frames(nframes)
|
|
||||||
.NumTriggers(1).UseInternalPacketGenerator(false)
|
|
||||||
.ImagesPerTrigger(0).IncidentEnergy_keV(12.4);
|
|
||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++) {
|
|
||||||
auto test = std::make_unique<MockAcquisitionDevice>(i, 64);
|
|
||||||
for (int f = 0; f < distinct_frames; f++)
|
|
||||||
test->SetOutput(f, 0, *OutputWithPixels(pedestal_in.data() + f * RAW_MODULE_SIZE));
|
|
||||||
for (int f = 0; f < nframes; f++)
|
|
||||||
test->CreateJFPackets(x, f + 1, 1, 0, pedestal_in.data() + (f % distinct_frames) * RAW_MODULE_SIZE);
|
|
||||||
test->CreateFinalPacket(x);
|
|
||||||
aq_devices.Add(std::move(test));
|
|
||||||
}
|
|
||||||
|
|
||||||
JFPedestalCalc pc(x);
|
|
||||||
for (int i = 0; i < nframes; i++)
|
|
||||||
pc.AnalyzeImage(pedestal_in.data() + (i % distinct_frames) * RAW_MODULE_SIZE);
|
|
||||||
|
|
||||||
PixelMask mask(x);
|
|
||||||
|
|
||||||
Logger logger("MockAcquisitionDevice_JFJochReceiverTest_PedestalG0");
|
|
||||||
JFJochReceiverOutput output;
|
|
||||||
bool ret;
|
|
||||||
REQUIRE_NOTHROW(ret = JFJochReceiverTest(output, logger, aq_devices, x, mask, nthreads));
|
|
||||||
REQUIRE(ret);
|
|
||||||
REQUIRE(output.status.images_sent == x.GetImageNum());
|
|
||||||
REQUIRE(output.efficiency == 1.0);
|
|
||||||
|
|
||||||
JFModulePedestal ref_pedestal;
|
|
||||||
pc.Export(ref_pedestal, 0);
|
|
||||||
JFModulePedestal out_pedestal = output.pedestal_result.at(0);
|
|
||||||
REQUIRE(abs(ref_pedestal.Mean() - out_pedestal.Mean()) < 0.65);
|
|
||||||
REQUIRE(out_pedestal.CountMaskedPixels() == 0);
|
|
||||||
REQUIRE(out_pedestal.GetFrameCount() == nframes);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// What the FPGA card writes, precalculated on the CPU for the tests on MockAcquisitionDevice. It does not matter how
|
||||||
|
// it is calculated here: that the mock gives the host what the card gives is checked against the HLS simulation in
|
||||||
|
// MockAcquisitionDeviceTest.cpp.
|
||||||
|
|
||||||
|
#include "CheckImageOutput.h"
|
||||||
|
#include "../acquisition_device/AcquisitionDeviceGroup.h"
|
||||||
|
#include "../acquisition_device/MockAcquisitionDevice.h"
|
||||||
|
#include "../common/PixelMask.h"
|
||||||
|
#include "../image_analysis/spot_finding/DetModuleSpotFinder_cpu.h"
|
||||||
|
#include "../receiver/JFJochReceiverTest.h"
|
||||||
|
|
||||||
|
// The card output of one image, one entry per module (absolute module number)
|
||||||
|
using CardImage = std::vector<std::unique_ptr<DeviceOutput>>;
|
||||||
|
|
||||||
|
inline std::unique_ptr<DeviceOutput> OutputWithPixels(const uint16_t *pixels) {
|
||||||
|
auto ret = std::make_unique<DeviceOutput>();
|
||||||
|
memcpy(ret->pixels, pixels, RAW_MODULE_SIZE * sizeof(uint16_t));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void StorePixels(DeviceOutput &output, const std::vector<int64_t> &values) {
|
||||||
|
auto pixels = reinterpret_cast<T *>(output.pixels);
|
||||||
|
for (int i = 0; i < RAW_MODULE_SIZE; i++)
|
||||||
|
pixels[i] = static_cast<T>(values[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The values in the pixel format the card writes for the experiment
|
||||||
|
inline void StorePixels(DeviceOutput &output, const DiffractionExperiment &x, const std::vector<int64_t> &values) {
|
||||||
|
switch (x.GetByteDepthFPGA()) {
|
||||||
|
case 1:
|
||||||
|
x.IsPixelSigned() ? StorePixels<int8_t>(output, values) : StorePixels<uint8_t>(output, values);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
x.IsPixelSigned() ? StorePixels<int16_t>(output, values) : StorePixels<uint16_t>(output, values);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
x.IsPixelSigned() ? StorePixels<int32_t>(output, values) : StorePixels<uint32_t>(output, values);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error and saturated pixels counted, the others summed, masked pixels left out; and the same for each ROI of
|
||||||
|
// the experiment's ROI map (one bit per ROI)
|
||||||
|
inline void PixelStatistics(DeviceOutput &output, const DiffractionExperiment &x, const PixelMask &mask,
|
||||||
|
const std::vector<uint16_t> &experiment_roi_map, size_t module,
|
||||||
|
const std::vector<int64_t> &values, int64_t err, int64_t sat) {
|
||||||
|
std::vector<uint16_t> roi_map(RAW_MODULE_SIZE);
|
||||||
|
ConvertedToRawGeometry(x, module, roi_map.data(), experiment_roi_map.data());
|
||||||
|
const uint32_t *module_mask = mask.GetMaskRaw().data() + module * RAW_MODULE_SIZE;
|
||||||
|
|
||||||
|
auto &stats = output.module_statistics;
|
||||||
|
stats.max_value = INT24_MIN;
|
||||||
|
stats.min_value = INT24_MAX;
|
||||||
|
for (int r = 0; r < FPGA_ROI_COUNT; r++)
|
||||||
|
output.roi_counts[r].max_value = INT24_MIN;
|
||||||
|
|
||||||
|
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||||
|
const int64_t v = values[i];
|
||||||
|
if (module_mask[i] != 0) {
|
||||||
|
stats.masked_pixels++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (v == err)
|
||||||
|
stats.err_pixels++;
|
||||||
|
else if (v == sat)
|
||||||
|
stats.saturated_pixels++;
|
||||||
|
else {
|
||||||
|
stats.pixel_sum += v;
|
||||||
|
stats.max_value = std::max<int64_t>(stats.max_value, v);
|
||||||
|
stats.min_value = std::min<int64_t>(stats.min_value, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// roi_calc.cpp: the coordinates include the multipixels
|
||||||
|
const int64_t line = i / RAW_MODULE_COLS + (i / RAW_MODULE_COLS / 256) * 2;
|
||||||
|
const int64_t col = i % RAW_MODULE_COLS + (i % RAW_MODULE_COLS / 256) * 2;
|
||||||
|
for (int r = 0; r < FPGA_ROI_COUNT; r++) {
|
||||||
|
if (((roi_map[i] >> r) & 1) == 0 || v == err)
|
||||||
|
continue;
|
||||||
|
ROICount &roi = output.roi_counts[r];
|
||||||
|
if (v != sat) {
|
||||||
|
roi.sum += v;
|
||||||
|
roi.sum2 += v * v;
|
||||||
|
roi.good_pixels++;
|
||||||
|
roi.sum_x_weighted += v * col;
|
||||||
|
roi.sum_y_weighted += v * line;
|
||||||
|
}
|
||||||
|
roi.max_value = std::max<int64_t>(roi.max_value, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The strong pixels of the card's spot finder, by its CPU version, on the pixels in the output
|
||||||
|
inline void FindStrongPixels(DeviceOutput &output, const DiffractionExperiment &x, const SpotFindingSettings &settings,
|
||||||
|
size_t module) {
|
||||||
|
std::vector<float> d_map(RAW_MODULE_SIZE), mean(RAW_MODULE_SIZE), stddev(RAW_MODULE_SIZE);
|
||||||
|
std::vector<uint32_t> valid_count(RAW_MODULE_SIZE), strong_pixel(RAW_MODULE_SIZE);
|
||||||
|
x.CalcSpotFinderResolutionMap(d_map.data(), module);
|
||||||
|
switch (x.GetByteDepthFPGA()) {
|
||||||
|
case 1:
|
||||||
|
FindSpots<int8_t>(output, settings, d_map.data(), mean.data(), stddev.data(), valid_count.data(),
|
||||||
|
strong_pixel.data());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
FindSpots<int16_t>(output, settings, d_map.data(), mean.data(), stddev.data(), valid_count.data(),
|
||||||
|
strong_pixel.data());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FindSpots<int32_t>(output, settings, d_map.data(), mean.data(), stddev.data(), valid_count.data(),
|
||||||
|
strong_pixel.data());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// JUNGFRAU conversion of a raw image (all modules) as CheckImageOutput.h computes it; with host summation the card
|
||||||
|
// converts single frames to 16 bit. With conversion, error and saturated pixels are counted from the conversion into
|
||||||
|
// signed 32 bit, as the card counts them before the pixel is written in the image's format, where unsigned they have
|
||||||
|
// one value; without, the card reads UINT16_MAX from the detector as saturated.
|
||||||
|
inline CardImage ConvertedImage(const DiffractionExperiment &x, const JFCalibration &calib, const PixelMask &mask,
|
||||||
|
const std::vector<uint16_t> &raw, size_t storage_cell = 0) {
|
||||||
|
DiffractionExperiment card_x(x);
|
||||||
|
if (x.IsCPUSummation())
|
||||||
|
card_x.Summation(1).BitDepthImage(16);
|
||||||
|
DiffractionExperiment signed_x(card_x);
|
||||||
|
signed_x.PixelSigned(true).BitDepthImage(32);
|
||||||
|
|
||||||
|
const auto ref = ConversionRef(card_x, calib, raw.data(), x.GetModulesNum(), storage_cell);
|
||||||
|
const auto ref_signed = ConversionRef(signed_x, calib, raw.data(), x.GetModulesNum(), storage_cell);
|
||||||
|
const auto roi_map = x.ExportROIMap();
|
||||||
|
|
||||||
|
CardImage ret;
|
||||||
|
std::vector<int64_t> values(RAW_MODULE_SIZE), stats_values(RAW_MODULE_SIZE);
|
||||||
|
for (int m = 0; m < x.GetModulesNum(); m++) {
|
||||||
|
for (size_t i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||||
|
const size_t pxl = m * RAW_MODULE_SIZE + i;
|
||||||
|
values[i] = std::llround(ref[pxl]);
|
||||||
|
if (x.IsJungfrauConvPhotonCnt())
|
||||||
|
stats_values[i] = std::llround(ref_signed[pxl]);
|
||||||
|
else
|
||||||
|
stats_values[i] = (raw[pxl] == UINT16_MAX) ? INT32_MAX : values[i];
|
||||||
|
}
|
||||||
|
auto output = std::make_unique<DeviceOutput>();
|
||||||
|
StorePixels(*output, card_x, values);
|
||||||
|
PixelStatistics(*output, x, mask, roi_map, m, stats_values, INT32_MIN, INT32_MAX);
|
||||||
|
ret.push_back(std::move(output));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The card passing a signed 16-bit image (raw geometry, all modules) through, INT16_MIN marking an error and
|
||||||
|
// INT16_MAX a saturated pixel, with the strong pixels of its spot finder
|
||||||
|
inline CardImage Int16Image(const DiffractionExperiment &x, const PixelMask &mask, const std::vector<int16_t> &image,
|
||||||
|
const SpotFindingSettings &settings) {
|
||||||
|
const int64_t err = (x.GetByteDepthFPGA() == 4) ? INT32_MIN : INT16_MIN;
|
||||||
|
const int64_t sat = (x.GetByteDepthFPGA() == 4) ? INT32_MAX : INT16_MAX;
|
||||||
|
const auto roi_map = x.ExportROIMap();
|
||||||
|
|
||||||
|
CardImage ret;
|
||||||
|
std::vector<int64_t> values(RAW_MODULE_SIZE);
|
||||||
|
for (int m = 0; m < x.GetModulesNum(); m++) {
|
||||||
|
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||||
|
const int16_t v = image[m * RAW_MODULE_SIZE + i];
|
||||||
|
values[i] = (v == INT16_MIN) ? err : ((v == INT16_MAX) ? sat : v);
|
||||||
|
}
|
||||||
|
auto output = std::make_unique<DeviceOutput>();
|
||||||
|
StorePixels(*output, x, values);
|
||||||
|
PixelStatistics(*output, x, mask, roi_map, m, values, err, sat);
|
||||||
|
FindStrongPixels(*output, x, settings, m);
|
||||||
|
ret.push_back(std::move(output));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frame F of the mock of data stream d writes images[F % images.size()]
|
||||||
|
inline void SetOutputs(MockAcquisitionDevice &mock, const DiffractionExperiment &x, uint16_t data_stream,
|
||||||
|
const std::vector<CardImage> &images) {
|
||||||
|
for (size_t i = 0; i < images.size(); i++)
|
||||||
|
for (int m = 0; m < x.GetModulesNum(data_stream); m++)
|
||||||
|
mock.SetOutput(i, m, *images[i][x.GetFirstModuleOfDataStream(data_stream) + m]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// One mock per data stream
|
||||||
|
inline AcquisitionDeviceGroup MockDevices(const DiffractionExperiment &x, const std::vector<CardImage> &images) {
|
||||||
|
AcquisitionDeviceGroup ret;
|
||||||
|
for (int d = 0; d < x.GetDataStreamsNum(); d++) {
|
||||||
|
auto mock = std::make_unique<MockAcquisitionDevice>(d, 64);
|
||||||
|
SetOutputs(*mock, x, d, images);
|
||||||
|
ret.Add(std::move(mock));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The mocks for JFJochReceiverTest(): the conversion of its raw image with its calibration, the pixel mask applied
|
||||||
|
// if the experiment asks for it, one image per storage cell
|
||||||
|
inline AcquisitionDeviceGroup ConvertingMocks(const DiffractionExperiment &x, const PixelMask &mask,
|
||||||
|
std::vector<uint16_t> raw) {
|
||||||
|
if (x.IsApplyPixelMask()) {
|
||||||
|
for (int i = 0; i < raw.size(); i++)
|
||||||
|
if (mask.GetMaskRaw().at(i) != 0)
|
||||||
|
raw[i] = UINT16_MAX;
|
||||||
|
}
|
||||||
|
const JFCalibration calib = GeneratePedestalCalibration(x);
|
||||||
|
std::vector<CardImage> images;
|
||||||
|
for (int s = 0; s < x.GetStorageCellNumber(); s++)
|
||||||
|
images.push_back(ConvertedImage(x, calib, mask, raw, s));
|
||||||
|
return MockDevices(x, images);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The default raw image of JFJochReceiverTest()
|
||||||
|
inline AcquisitionDeviceGroup ConvertingMocks(const DiffractionExperiment &x, const PixelMask &mask) {
|
||||||
|
std::vector<uint16_t> raw(RAW_MODULE_SIZE * x.GetModulesNum());
|
||||||
|
for (int i = 0; i < raw.size(); i++)
|
||||||
|
raw[i] = i % 65536;
|
||||||
|
return ConvertingMocks(x, mask, raw);
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../receiver/JFJochReceiverService.h"
|
#include "../receiver/JFJochReceiverService.h"
|
||||||
#include "../image_pusher/ZMQWriterNotificationPuller.h"
|
#include "../image_pusher/ZMQWriterNotificationPuller.h"
|
||||||
#include "../image_puller/TestImagePuller.h"
|
#include "../image_puller/TestImagePuller.h"
|
||||||
|
#include "../acquisition_device/MockAcquisitionDevice.h"
|
||||||
|
|
||||||
TEST_CASE("StreamWriterTest_ZMQ", "[StreamWriter]") {
|
TEST_CASE("StreamWriterTest_ZMQ", "[StreamWriter]") {
|
||||||
RegisterHDF5Filter();
|
RegisterHDF5Filter();
|
||||||
@@ -27,7 +28,7 @@ TEST_CASE("StreamWriterTest_ZMQ", "[StreamWriter]") {
|
|||||||
JFModuleGainCalibration gain;
|
JFModuleGainCalibration gain;
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
||||||
aq_devices.AddHLSDevice(64);
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
JFJochReceiverService fpga_receiver_service(aq_devices, logger, pusher);
|
JFJochReceiverService fpga_receiver_service(aq_devices, logger, pusher);
|
||||||
@@ -83,7 +84,7 @@ TEST_CASE("StreamWriterTest_ZMQ_Update", "[StreamWriter]") {
|
|||||||
JFModuleGainCalibration gain;
|
JFModuleGainCalibration gain;
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
||||||
aq_devices.AddHLSDevice(64);
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -144,7 +145,7 @@ TEST_CASE("StreamWriterTest_ZMQ_Update_NoNotification", "[StreamWriter]") {
|
|||||||
JFModuleGainCalibration gain;
|
JFModuleGainCalibration gain;
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
||||||
aq_devices.AddHLSDevice(64);
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
@@ -208,7 +209,7 @@ TEST_CASE("StreamWriterTest_ZMQ_MasterAfterAllDataFiles", "[StreamWriter]") {
|
|||||||
|
|
||||||
AcquisitionDeviceGroup aq_devices;
|
AcquisitionDeviceGroup aq_devices;
|
||||||
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
for (int i = 0; i < x.GetDataStreamsNum(); i++)
|
||||||
aq_devices.AddHLSDevice(64);
|
aq_devices.Add(std::make_unique<MockAcquisitionDevice>(i, 64));
|
||||||
|
|
||||||
ZMQStream2Pusher pusher({"ipc://*", "ipc://*"});
|
ZMQStream2Pusher pusher({"ipc://*", "ipc://*"});
|
||||||
pusher.WriterNotificationSocket("ipc://*");
|
pusher.WriterNotificationSocket("ipc://*");
|
||||||
|
|||||||
Reference in new issue
Block a user