JFJochReceiver: az_int_mapping is unique_ptr, so construction is explicit and can be profiled
This commit is contained in:
@@ -33,7 +33,6 @@ JFJochReceiver::JFJochReceiver(const DiffractionExperiment &in_experiment,
|
||||
serialmx_filter(in_experiment),
|
||||
numa_policy(in_numa_policy),
|
||||
pixel_mask(in_pixel_mask),
|
||||
az_int_mapping(experiment, pixel_mask),
|
||||
indexer(experiment, indexing_thread_pool) {
|
||||
logger.Info("Initializing receiver");
|
||||
// Ensure there is nothing running for now
|
||||
@@ -46,7 +45,13 @@ JFJochReceiver::JFJochReceiver(const DiffractionExperiment &in_experiment,
|
||||
current_status.SetEfficiency({});
|
||||
current_status.SetStatus(JFJochReceiverStatus{}); // GetStatus() is virtual function and cannot be called yet!
|
||||
|
||||
plots.Setup(experiment, az_int_mapping);
|
||||
auto start_time_point = std::chrono::steady_clock::now();
|
||||
az_int_mapping = std::make_unique<AzimuthalIntegration>(experiment, pixel_mask);
|
||||
auto end_time_point = std::chrono::steady_clock::now();
|
||||
auto duration = std::chrono::duration<float>(end_time_point - start_time_point);
|
||||
logger.Info("Azimuthal integration mapping done in {:.5f} s", duration.count());
|
||||
|
||||
plots.Setup(experiment, *az_int_mapping);
|
||||
|
||||
push_images_to_writer = (experiment.GetImageNum() > 0) && (!experiment.GetFilePrefix().empty());
|
||||
|
||||
@@ -110,12 +115,12 @@ void JFJochReceiver::SendStartMessage() {
|
||||
StartMessage message{};
|
||||
experiment.FillMessage(message);
|
||||
message.arm_date = time_UTC(std::chrono::system_clock::now());
|
||||
message.az_int_q_bin_count = az_int_mapping.GetQBinCount();
|
||||
message.az_int_bin_to_q = az_int_mapping.GetBinToQ();
|
||||
message.az_int_bin_to_two_theta = az_int_mapping.GetBinToTwoTheta();
|
||||
message.az_int_phi_bin_count = az_int_mapping.GetAzimuthalBinCount();
|
||||
if (az_int_mapping.GetAzimuthalBinCount() > 1)
|
||||
message.az_int_bin_to_phi = az_int_mapping.GetBinToPhi();
|
||||
message.az_int_q_bin_count = az_int_mapping->GetQBinCount();
|
||||
message.az_int_bin_to_q = az_int_mapping->GetBinToQ();
|
||||
message.az_int_bin_to_two_theta = az_int_mapping->GetBinToTwoTheta();
|
||||
message.az_int_phi_bin_count = az_int_mapping->GetAzimuthalBinCount();
|
||||
if (az_int_mapping->GetAzimuthalBinCount() > 1)
|
||||
message.az_int_bin_to_phi = az_int_mapping->GetBinToPhi();
|
||||
message.writer_notification_zmq_addr = image_pusher.GetWriterNotificationSocketAddress();
|
||||
message.rois = experiment.ROI().ExportMetadata();
|
||||
message.max_spot_count = experiment.GetMaxSpotCount();
|
||||
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
std::vector<std::unique_ptr<ADUHistogram>> adu_histogram_module;
|
||||
PixelMask pixel_mask;
|
||||
|
||||
AzimuthalIntegration az_int_mapping;
|
||||
std::unique_ptr<AzimuthalIntegration> az_int_mapping;
|
||||
|
||||
std::optional<uint64_t> max_delay;
|
||||
std::mutex max_delay_mutex;
|
||||
|
||||
@@ -311,8 +311,8 @@ void JFJochReceiverFPGA::FrameTransformationThread(uint32_t threadid) {
|
||||
|
||||
frame_transformation_ready.count_down();
|
||||
|
||||
uint16_t az_int_min_bin = std::floor(az_int_mapping.QToBin(experiment.GetLowQForBkgEstimate_recipA()));
|
||||
uint16_t az_int_max_bin = std::ceil(az_int_mapping.QToBin(experiment.GetHighQForBkgEstimate_recipA()));
|
||||
uint16_t az_int_min_bin = std::floor(az_int_mapping->QToBin(experiment.GetLowQForBkgEstimate_recipA()));
|
||||
uint16_t az_int_max_bin = std::ceil(az_int_mapping->QToBin(experiment.GetHighQForBkgEstimate_recipA()));
|
||||
|
||||
int64_t image_number;
|
||||
while (images_to_go.Get(image_number) != 0) {
|
||||
@@ -340,7 +340,7 @@ void JFJochReceiverFPGA::FrameTransformationThread(uint32_t threadid) {
|
||||
|
||||
ImageMetadata metadata(experiment);
|
||||
|
||||
AzimuthalIntegrationProfile az_int_profile_image(az_int_mapping);
|
||||
AzimuthalIntegrationProfile az_int_profile_image(*az_int_mapping);
|
||||
|
||||
auto local_spot_finding_settings = GetSpotFindingSettings();
|
||||
|
||||
@@ -678,5 +678,5 @@ void JFJochReceiverFPGA::LoadCalibrationToFPGA(uint16_t data_stream) {
|
||||
acquisition_device[data_stream].InitializeROIMap(experiment, roi_map);
|
||||
|
||||
// Initialize data processing
|
||||
acquisition_device[data_stream].InitializeDataProcessing(experiment, az_int_mapping);
|
||||
acquisition_device[data_stream].InitializeDataProcessing(experiment, *az_int_mapping);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ void JFJochReceiverLite::DataAnalysisThread(uint32_t id) {
|
||||
measurement_started.wait();
|
||||
|
||||
try {
|
||||
analysis = std::make_unique<MXAnalysisWithoutFPGA>(experiment, az_int_mapping, pixel_mask, indexer);
|
||||
analysis = std::make_unique<MXAnalysisWithoutFPGA>(experiment, *az_int_mapping, pixel_mask, indexer);
|
||||
} catch (const JFJochException &e) {
|
||||
Cancel(e);
|
||||
return;
|
||||
@@ -276,7 +276,7 @@ void JFJochReceiverLite::DataAnalysisThread(uint32_t id) {
|
||||
|
||||
auto image_start_time = std::chrono::high_resolution_clock::now();
|
||||
|
||||
AzimuthalIntegrationProfile profile(az_int_mapping);
|
||||
AzimuthalIntegrationProfile profile(*az_int_mapping);
|
||||
analysis->Analyze(data_msg, profile, GetSpotFindingSettings());
|
||||
|
||||
auto image_end_time = std::chrono::high_resolution_clock::now();
|
||||
|
||||
@@ -19,6 +19,16 @@ TEST_CASE("AzimuthalIntegrationMapping_Constructor","[AzimuthalIntegration]") {
|
||||
REQUIRE_NOTHROW(radial = std::make_unique<AzimuthalIntegration>(x, pixel_mask));
|
||||
}
|
||||
|
||||
TEST_CASE("AzimuthalIntegrationMapping_Create_16M","[AzimuthalIntegration]") {
|
||||
DiffractionExperiment x(DetDECTRIS(2000, 2000, "E16M", ""));
|
||||
x.DetectorDistance_mm(50).BeamX_pxl(1000).BeamY_pxl(1000);
|
||||
x.QSpacingForAzimInt_recipA(0.1).QRangeForAzimInt_recipA(0.1, 10);
|
||||
|
||||
PixelMask pixel_mask(x);
|
||||
AzimuthalIntegration mapping(x, pixel_mask);
|
||||
REQUIRE(mapping.GetBinNumber() == 99);
|
||||
}
|
||||
|
||||
TEST_CASE("AzimuthalIntegrationMapping_GetBinNumber","[AzimuthalIntegration]") {
|
||||
DiffractionExperiment x(DetJF4M());
|
||||
x.DetectorDistance_mm(50).BeamX_pxl(1000).BeamY_pxl(1000);
|
||||
|
||||
Reference in New Issue
Block a user