MXAnalysisAfterFPGA indexes each image (IndexAndRefine::IndexFrameOnly) and
no longer predicts or integrates; its Bragg prediction and CPU integration
engine go. Per-image reflections, integrated-reflection counts and B factors
are now left unset on this path - integration is rugnux's. jfjoch_fpga_test
loses -Q and the receiver-test helper its quick_integrate parameter. The two
processing tests that integrated now check that indexing happens and
integration does not (on rc184 they keep the HLS-simulated card they had).
(ported from rc184-2 68ec8a7f9)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
53 lines
2.0 KiB
C++
53 lines
2.0 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include "../common/DiffractionExperiment.h"
|
|
#include "indexing/IndexerThreadPool.h"
|
|
#include "spot_finding/StrongPixelSet.h"
|
|
#include "azint/AzIntEngineCPU.h"
|
|
#include "IndexAndRefine.h"
|
|
|
|
class MXAnalysisAfterFPGA {
|
|
mutable std::mutex read_from_cpu_mutex;
|
|
const DiffractionExperiment &experiment;
|
|
const AzimuthalIntegrationMapping &integration;
|
|
IndexAndRefine &indexer;
|
|
std::unique_ptr<AzIntEngineCPU> cpu_azint;
|
|
|
|
bool find_spots = false;
|
|
std::vector<DiffractionSpot> spots;
|
|
constexpr static const float spot_distance_threshold_pxl = 2.0f;
|
|
|
|
std::vector<float> arr_mean;
|
|
std::vector<float> arr_sttdev;
|
|
std::vector<uint32_t> arr_valid_count;
|
|
std::vector<uint32_t> arr_strong_pixel;
|
|
|
|
enum class State {Idle, Disabled, Enabled} state = State::Idle;
|
|
|
|
std::chrono::duration<double, std::micro> spot_finding_time_total{0.0};
|
|
bool spot_finding_timing_active = false;
|
|
public:
|
|
|
|
MXAnalysisAfterFPGA(const DiffractionExperiment& experiment,
|
|
const AzimuthalIntegrationMapping &integration,
|
|
IndexAndRefine &indexer);
|
|
|
|
void ReadFromFPGA(const DeviceOutput* output,
|
|
const SpotFindingSettings& settings,
|
|
size_t module_number);
|
|
|
|
void ReadFromCPU(DeviceOutput *output,
|
|
const SpotFindingSettings &settings,
|
|
size_t module_number);
|
|
|
|
// Computes the azimuthal integration profile on the CPU from the assembled image.
|
|
// Only active when the settings force the CPU backend; otherwise a no-op (the FPGA
|
|
// fills the profile). image points to the uncompressed image of GetByteDepthImage() pixels.
|
|
void RunAzimuthalIntegration(const void *image, AzimuthalIntegrationProfile &profile);
|
|
|
|
void Process(DataMessage &message, const SpotFindingSettings& settings);
|
|
};
|