Modifications in preparation to MAX IV experiment
This commit is contained in:
+218
-44
@@ -34,7 +34,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator", "[FPGA][Full]") {
|
||||
REQUIRE(imageBuf[i] == i % 65536);
|
||||
}
|
||||
}
|
||||
REQUIRE(test.GetExpectedDescriptorsPerModule() == 5);
|
||||
REQUIRE(test.GetExpectedDescriptorsPerModule() == DMA_DESCRIPTORS_PER_MODULE);
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_internal_packet_generator_custom_frame", "[FPGA][Full]") {
|
||||
@@ -53,7 +53,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_custom_frame", "[FPGA][Ful
|
||||
x.Mode(DetectorMode::Raw);
|
||||
x.UseInternalPacketGenerator(true).ImagesPerTrigger(nframes).PedestalG0Frames(0);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
HLSSimulatedDevice test(0, 128);
|
||||
test.SetInternalGeneratorFrame(test_frame);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
@@ -237,8 +237,8 @@ TEST_CASE("HLS_C_Simulation_check_lost_frame_raw", "[FPGA][Full]") {
|
||||
REQUIRE(test.GetDeviceOutput(0,0)->pixels[0] == 0);
|
||||
REQUIRE(test.GetDeviceOutput(0,0)->pixels[1] == 1);
|
||||
REQUIRE(test.GetDeviceOutput(0,0)->pixels[4095] == 4095);
|
||||
REQUIRE(test.GetDeviceOutput(0,1)->pixels[0] == -1);
|
||||
REQUIRE(test.GetDeviceOutput(0,1)->pixels[RAW_MODULE_SIZE-1] == -1);
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(0,1));
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(0,1));
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_check_lost_frame_conversion", "[FPGA][Full]") {
|
||||
@@ -266,10 +266,10 @@ TEST_CASE("HLS_C_Simulation_check_lost_frame_conversion", "[FPGA][Full]") {
|
||||
|
||||
REQUIRE(test.GetBytesReceived() == JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
REQUIRE(test.GetDeviceOutput(0,1)->pixels[0] == PIXEL_OUT_LOST);
|
||||
REQUIRE(test.GetDeviceOutput(0,1)->pixels[RAW_MODULE_SIZE-1] == PIXEL_OUT_LOST);
|
||||
REQUIRE(test.GetDeviceOutput(1,0)->pixels[0] == PIXEL_OUT_LOST);
|
||||
REQUIRE(test.GetDeviceOutput(2,1)->pixels[556] == PIXEL_OUT_LOST);
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(0,1));
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(0,1));
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(1,0));
|
||||
REQUIRE_THROWS(test.GetDeviceOutput(2,1));
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_check_single_packet", "[FPGA][Full]") {
|
||||
@@ -360,7 +360,6 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range", "[FPGA][Full]") {
|
||||
auto gain_from_file = GainCalibrationFromTestFile();
|
||||
|
||||
for (const auto energy : energy_values) {
|
||||
logger.Info("Trying with {} keV", energy);
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy);
|
||||
|
||||
REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy));
|
||||
@@ -384,7 +383,139 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range", "[FPGA][Full]") {
|
||||
CHECK(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = CheckConversion(x, c_in, data.data(), test.GetDeviceOutput(0,0)->pixels);
|
||||
logger.Info("Error of {:.2f} for photon energy {} keV", mean_error, energy);
|
||||
REQUIRE(mean_error < 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_check_convert_full_range_HG0", "[FPGA][Full]") {
|
||||
Logger logger("HLS_C_Simulation_check_convert_full_range_HG0");
|
||||
std::vector<uint16_t> data(RAW_MODULE_SIZE);
|
||||
std::vector<double> gain(3 * RAW_MODULE_SIZE);
|
||||
|
||||
JFModulePedestal pedestal_g0(1000), pedestal_g1(14500), pedestal_g2(14500);
|
||||
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||
data[i] = i % 0x4000; // only generate gain 0
|
||||
}
|
||||
|
||||
std::vector<double> energy_values = {6.0, 12.4, 17.7, 5, 4.5, 3.7, 2.0, 1.0, 0.5, 0.1};
|
||||
|
||||
const uint16_t nmodules = 1;
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
|
||||
x.Mode(DetectorMode::Conversion).UsingGainHG0(true);
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
|
||||
auto gain_from_file = GainCalibrationFromTestFile();
|
||||
logger.Info("With HG0");
|
||||
for (const auto energy : energy_values) {
|
||||
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy);
|
||||
REQUIRE(x.IsUsingGainHG0());
|
||||
REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy));
|
||||
|
||||
JFCalibration c_in(x);
|
||||
c_in.Pedestal(0,0) = pedestal_g0;
|
||||
c_in.Pedestal(0,1) = pedestal_g1;
|
||||
c_in.Pedestal(0,2) = pedestal_g2;
|
||||
for (int i = 0; i < x.GetModulesNum(); i++)
|
||||
c_in.GainCalibration(i) = gain_from_file;
|
||||
|
||||
test.InitializeCalibration(x, c_in);
|
||||
test.CreatePackets(x, 1, 1, 0, data.data(), false);
|
||||
test.CreateFinalPacket(x);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
|
||||
REQUIRE_NOTHROW(test.OutputStream().read());
|
||||
REQUIRE(test.OutputStream().size() == 0);
|
||||
CHECK(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = CheckConversion(x, c_in, data.data(), test.GetDeviceOutput(0,0)->pixels);
|
||||
logger.Info(" std. dev. of {:.2f} for photon energy {} keV", mean_error, energy);
|
||||
REQUIRE(mean_error < 0.5);
|
||||
}
|
||||
logger.Info("Without HG0");
|
||||
x.UsingGainHG0(false);
|
||||
for (const auto energy : energy_values) {
|
||||
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy);
|
||||
REQUIRE(!x.IsUsingGainHG0());
|
||||
REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy));
|
||||
|
||||
JFCalibration c_in(x);
|
||||
c_in.Pedestal(0,0) = pedestal_g0;
|
||||
c_in.Pedestal(0,1) = pedestal_g1;
|
||||
c_in.Pedestal(0,2) = pedestal_g2;
|
||||
for (int i = 0; i < x.GetModulesNum(); i++)
|
||||
c_in.GainCalibration(i) = gain_from_file;
|
||||
|
||||
test.InitializeCalibration(x, c_in);
|
||||
test.CreatePackets(x, 1, 1, 0, data.data(), false);
|
||||
test.CreateFinalPacket(x);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
|
||||
REQUIRE_NOTHROW(test.OutputStream().read());
|
||||
REQUIRE(test.OutputStream().size() == 0);
|
||||
CHECK(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = CheckConversion(x, c_in, data.data(), test.GetDeviceOutput(0,0)->pixels);
|
||||
logger.Info(" std. dev. of {:.2f} for photon energy {} keV", mean_error, energy);
|
||||
REQUIRE(mean_error < 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_check_convert_full_range_fixedG1", "[FPGA][Full]") {
|
||||
Logger logger("HLS_C_Simulation_check_convert_full_range_fixedG1");
|
||||
std::vector<uint16_t> data(RAW_MODULE_SIZE);
|
||||
std::vector<double> gain(3 * RAW_MODULE_SIZE);
|
||||
|
||||
JFModulePedestal pedestal_g0(1000), pedestal_g1(1500), pedestal_g2(14500);
|
||||
|
||||
std::vector<double> energy_values = {6.0, 12.4, 17.7, 5, 4.5, 3.7, 2.0, 1.0};
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||
data[i] = i % UINT16_MAX;
|
||||
}
|
||||
|
||||
const uint16_t nmodules = 1;
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
|
||||
x.Mode(DetectorMode::Conversion).FixedGainG1(true);
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
|
||||
auto gain_from_file = GainCalibrationFromTestFile();
|
||||
|
||||
for (const auto energy : energy_values) {
|
||||
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy);
|
||||
REQUIRE(x.IsFixedGainG1());
|
||||
REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy));
|
||||
|
||||
JFCalibration c_in(x);
|
||||
c_in.Pedestal(0,0) = pedestal_g0;
|
||||
c_in.Pedestal(0,1) = pedestal_g1;
|
||||
c_in.Pedestal(0,2) = pedestal_g2;
|
||||
for (int i = 0; i < x.GetModulesNum(); i++)
|
||||
c_in.GainCalibration(i) = gain_from_file;
|
||||
|
||||
test.InitializeCalibration(x, c_in);
|
||||
test.CreatePackets(x, 1, 1, 0, data.data(), false);
|
||||
test.CreateFinalPacket(x);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
|
||||
REQUIRE_NOTHROW(test.OutputStream().read());
|
||||
REQUIRE(test.OutputStream().size() == 0);
|
||||
CHECK(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = CheckConversion(x, c_in, data.data(), test.GetDeviceOutput(0,0)->pixels);
|
||||
logger.Info(" std. dev. of {:.2f} for photon energy {} keV", mean_error, energy);
|
||||
REQUIRE(mean_error < 0.5);
|
||||
}
|
||||
}
|
||||
@@ -400,7 +531,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_I32", "[FPGA][Full]") {
|
||||
data[i] = i % UINT16_MAX;
|
||||
}
|
||||
|
||||
std::vector<double> energy_values = {6.0, 12.4, 17.7, 5, 4.5, 3.7};
|
||||
std::vector<double> energy_values = {6.0, 12.4, 17.7, 5, 4.5, 3.7, 3.0};
|
||||
|
||||
const uint16_t nmodules = 1;
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
@@ -411,8 +542,6 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_I32", "[FPGA][Full]") {
|
||||
auto gain_from_file = GainCalibrationFromTestFile();
|
||||
|
||||
for (const auto energy : energy_values) {
|
||||
logger.Info("Trying with {} keV", energy);
|
||||
|
||||
x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy).FPGAOutputMode(FPGAPixelOutput::Int32);
|
||||
|
||||
REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy));
|
||||
@@ -436,7 +565,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_I32", "[FPGA][Full]") {
|
||||
CHECK(test.GetBytesReceived() == 128 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
double mean_error = CheckConversion(x, c_in, data.data(), (int32_t *) test.GetDeviceOutput(0,0)->pixels);
|
||||
|
||||
logger.Info("Error of {:.2f} for photon energy {} keV", mean_error, energy);
|
||||
REQUIRE(mean_error < 0.5);
|
||||
}
|
||||
}
|
||||
@@ -870,22 +999,23 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
act_reg.mode = MODE_CONV;
|
||||
|
||||
// state = WAIT_FOR_START
|
||||
|
||||
volatile rcv_state_t state;
|
||||
data_collection_fsm(raw0, raw1,
|
||||
addr0, addr1,
|
||||
run_data_collection,
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
REQUIRE(idle_data_collection == 1);
|
||||
REQUIRE(addr1.empty());
|
||||
REQUIRE(raw1.empty());
|
||||
|
||||
REQUIRE( state == RCV_WAIT_FOR_START);
|
||||
run_data_collection = 1;
|
||||
|
||||
// state = WAIT_FOR_START
|
||||
@@ -895,15 +1025,16 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(addr1.empty());
|
||||
REQUIRE(raw1.empty());
|
||||
|
||||
REQUIRE( state == RCV_WAIT_FOR_START_LOW);
|
||||
// state = WAIT_FOR_START_LOW
|
||||
data_collection_fsm(raw0, raw1,
|
||||
addr0, addr1,
|
||||
@@ -911,15 +1042,16 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(addr1.empty());
|
||||
REQUIRE(raw1.empty());
|
||||
|
||||
REQUIRE( state == RCV_WAIT_FOR_START_LOW);
|
||||
// state = WAIT_FOR_START_LOW
|
||||
|
||||
run_data_collection = 0;
|
||||
@@ -930,15 +1062,16 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(addr1.empty());
|
||||
REQUIRE(raw1.empty());
|
||||
|
||||
REQUIRE( state == RCV_START);
|
||||
// state = START
|
||||
data_collection_fsm(raw0, raw1,
|
||||
addr0, addr1,
|
||||
@@ -946,15 +1079,17 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(raw1.size() == 1);
|
||||
|
||||
REQUIRE( state == RCV_INIT);
|
||||
// state = INIT
|
||||
|
||||
data_collection_fsm(raw0, raw1,
|
||||
@@ -963,15 +1098,16 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(raw1.size() == 1);
|
||||
|
||||
REQUIRE( state == RCV_INIT);
|
||||
// state = INIT
|
||||
|
||||
cancel_data_collection = 1;
|
||||
@@ -982,33 +1118,35 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(raw1.size() == 1);
|
||||
|
||||
// state = LAST
|
||||
|
||||
REQUIRE( state == RCV_LAST);
|
||||
data_collection_fsm(raw0, raw1,
|
||||
addr0, addr1,
|
||||
run_data_collection,
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
|
||||
REQUIRE(idle_data_collection == 0);
|
||||
REQUIRE(addr1.size() == 1);
|
||||
REQUIRE(raw1.size() == 2);
|
||||
|
||||
REQUIRE( state == RCV_WAIT_FOR_START);
|
||||
// state = WAIT_FOR_START
|
||||
|
||||
data_collection_fsm(raw0, raw1,
|
||||
@@ -1017,18 +1155,20 @@ TEST_CASE("HLS_DataCollectionFSM","[OpenCAPI]") {
|
||||
cancel_data_collection,
|
||||
idle_data_collection,
|
||||
act_reg.mode,
|
||||
act_reg.one_over_energy,
|
||||
act_reg.energy_kev,
|
||||
act_reg.nframes,
|
||||
act_reg.nmodules,
|
||||
act_reg.nstorage_cells,
|
||||
act_reg.nsummation);
|
||||
act_reg.nsummation,
|
||||
state);
|
||||
|
||||
REQUIRE( state == RCV_WAIT_FOR_START);
|
||||
REQUIRE(idle_data_collection == 1);
|
||||
REQUIRE(addr1.size() == 1);
|
||||
REQUIRE(raw1.size() == 2);
|
||||
|
||||
auto packet = raw1.read();
|
||||
REQUIRE(packet.last == 0);
|
||||
REQUIRE(packet.last == 1);
|
||||
REQUIRE(packet.dest == 0);
|
||||
|
||||
packet = raw1.read();
|
||||
@@ -1053,7 +1193,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_15_storage_cell_convert_G0
|
||||
|
||||
REQUIRE(x.GetImageNum() == ntrigger * nstoragecells);
|
||||
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells);
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells * nmodules + 32);
|
||||
|
||||
std::vector<double> tmp(3 * RAW_MODULE_SIZE, 50);
|
||||
JFModuleGainCalibration gain(tmp);
|
||||
@@ -1101,7 +1241,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_8_storage_cell_convert_G0"
|
||||
|
||||
REQUIRE(x.GetImageNum() == ntrigger * nstoragecells);
|
||||
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells);
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells * nmodules + 64);
|
||||
|
||||
std::vector<double> tmp(3 * RAW_MODULE_SIZE, 50);
|
||||
JFModuleGainCalibration gain(tmp);
|
||||
@@ -1150,7 +1290,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_16_storage_cell_convert_G0
|
||||
|
||||
REQUIRE(x.GetImageNum() == ntrigger * nstoragecells);
|
||||
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells);
|
||||
HLSSimulatedDevice test(0, ntrigger * nstoragecells * nmodules + 128);
|
||||
std::vector<double> tmp(3 * RAW_MODULE_SIZE, 50);
|
||||
JFModuleGainCalibration gain(tmp);
|
||||
|
||||
@@ -1208,6 +1348,8 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_storage_cell_convert_G1",
|
||||
}
|
||||
|
||||
std::vector<double> tmp(3 * RAW_MODULE_SIZE, -1);
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++)
|
||||
tmp[i] = DEFAULT_G0_FACTOR;
|
||||
JFModuleGainCalibration gain(tmp);
|
||||
c.GainCalibration(0) = gain;
|
||||
c.GainCalibration(1) = gain;
|
||||
@@ -1364,7 +1506,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_spot_finder_snr_threshold"
|
||||
|
||||
auto spot_finder_result = test.GetDeviceOutput(0, 0)->spot_finding_result;
|
||||
REQUIRE (spot_finder_result.strong_pixel_count == 2);
|
||||
REQUIRE (spot_finder_result.snr_threshold == 10 * 4);
|
||||
REQUIRE (spot_finder_result.snr_threshold == 10.0);
|
||||
REQUIRE (spot_finder_result.count_threshold == 0);
|
||||
REQUIRE (spot_finder_result.strong_pixel[0] == (1<<0));
|
||||
REQUIRE (spot_finder_result.strong_pixel[(89*1024 + 300) / 8] == (1<<4)); // 300 % 8 == 4
|
||||
@@ -1540,3 +1682,35 @@ TEST_CASE("HLS_C_Simulation_check_convert_pedestal", "[FPGA][Full]") {
|
||||
REQUIRE(error < 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("HLS_C_Simulation_count_sat_and_err_pixels", "[FPGA][Full]") {
|
||||
const uint16_t nmodules = 3;
|
||||
|
||||
DiffractionExperiment x((DetectorGeometry(nmodules)));
|
||||
|
||||
x.Mode(DetectorMode::Raw);
|
||||
x.UseInternalPacketGenerator(true).ImagesPerTrigger(4).PedestalG0Frames(0);
|
||||
|
||||
HLSSimulatedDevice test(0, 64);
|
||||
|
||||
std::vector<uint16_t> v(RAW_MODULE_SIZE, 0);
|
||||
v[567] = 0xc000;
|
||||
v[RAW_MODULE_COLS * 511 + 255] = 0xc000;
|
||||
v[RAW_MODULE_COLS * 250 + 233] = 0xffff;
|
||||
v[0] = 0xffff;
|
||||
v[RAW_MODULE_SIZE-1] = 0xffff;
|
||||
test.SetInternalGeneratorFrameForAllModules(v);
|
||||
|
||||
REQUIRE_NOTHROW(test.StartAction(x));
|
||||
REQUIRE_NOTHROW(test.WaitForActionComplete());
|
||||
|
||||
REQUIRE(test.OutputStream().size() == 1);
|
||||
REQUIRE(test.GetBytesReceived() == 128 * nmodules * 4 * JUNGFRAU_PACKET_SIZE_BYTES);
|
||||
|
||||
for (int image = 0; image < 4; image++) {
|
||||
for (int m = 0; m < nmodules; m++) {
|
||||
CHECK(test.GetDeviceOutput(image, m)->module_statistics.saturated_pixels == 2);
|
||||
CHECK(test.GetDeviceOutput(image, m)->module_statistics.err_pixels == 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user