File writer and spot finding improvements

This commit is contained in:
2024-04-08 11:18:50 +02:00
parent 15d99c6162
commit c6d2b5eedf
72 changed files with 690 additions and 893 deletions

View File

@@ -6,12 +6,17 @@
int main() {
Logger logger("SpotFindingPerformanceTest");
size_t nstrong_pixel = 2048;
size_t nstrong_pixel = 4000;
std::vector<uint8_t> strong_pixel(RAW_MODULE_SIZE, 0);
std::mt19937 g1(67678);
std::uniform_int_distribution<size_t> distribution(0, RAW_MODULE_SIZE - 1);
DeviceOutput dev_output;
dev_output.spot_finding_result.strong_pixel_count = nstrong_pixel;
for (auto &i: dev_output.spot_finding_result.strong_pixel)
i = 0;
// Can think of smarter way to select pixels
int pixels_set = 0;
@@ -19,25 +24,11 @@ int main() {
size_t pixel = distribution(g1);
if (strong_pixel[pixel] == 0) {
strong_pixel[pixel] = 1;
dev_output.spot_finding_result.strong_pixel[pixel / 8] |= (1 << (pixel % 8));
pixels_set++;
}
}
DeviceOutput dev_output;
dev_output.spot_finding_result.strong_pixel_count = nstrong_pixel;
dev_output.spot_finding_result.max_memory_index = nstrong_pixel/32;
for (auto &i: dev_output.spot_finding_result.strong_pixel_number)
i = UINT32_MAX;
size_t curr_id = 0;
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
if (strong_pixel[i]) {
dev_output.spot_finding_result.strong_pixel_number[curr_id] = i;
curr_id++;
}
}
DiffractionExperiment experiment(DetectorGeometry(18, 3, 8, 36));
experiment.DetectorDistance_mm(50.0).BeamX_pxl(1200).BeamY_pxl(1200);
@@ -48,7 +39,7 @@ int main() {
.low_resolution_limit = 100.0
};
int iterations = 2000;
int iterations = 200;
{
int tmp = 0;
auto start_time = std::chrono::system_clock::now();
@@ -56,7 +47,7 @@ int main() {
std::vector<DiffractionSpot> spots, spots_out;
for (int m = 0; m < experiment.GetModulesNum(); m++) {
StrongPixelSet strong_pixel_set;
strong_pixel_set.ReadFPGAOutput(dev_output);
strong_pixel_set.ReadFPGAOutput(experiment, dev_output);
strong_pixel_set.FindSpots(experiment, settings, spots, m);
}
FilterSpotsByCount(experiment, spots, spots_out);