JFJochReceiver: Per-data-file radial integration profile
This commit is contained in:
1 parent
59fbeab176
commit
0d2fa850a2
8 files changed
+190
-104
No files matched your search
@@ -270,6 +270,7 @@ enum PlotType {
|
||||
message PlotRequest {
|
||||
PlotType type = 1;
|
||||
uint64 binning = 2;
|
||||
optional uint64 file_number = 3;
|
||||
}
|
||||
|
||||
message ReceiverDataProcessingPlots {
|
||||
|
||||
@@ -4,7 +4,7 @@ ADD_LIBRARY(ImageAnalysis STATIC
|
||||
GPUImageAnalysis.h
|
||||
RadialIntegration.cpp RadialIntegration.h
|
||||
RadialIntegrationMapping.cpp RadialIntegrationMapping.h
|
||||
StrongPixelSet.cpp StrongPixelSet.h GPUImageAnalysis_Alt.cpp)
|
||||
StrongPixelSet.cpp StrongPixelSet.h GPUImageAnalysis_Alt.cpp RadialIntegrationProfile.cpp RadialIntegrationProfile.h)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ImageAnalysis CommonFunctions)
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "RadialIntegrationProfile.h"
|
||||
#include "../common/JFJochException.h"
|
||||
|
||||
RadialIntegrationProfile::RadialIntegrationProfile(RadialIntegrationMapping &mapping)
|
||||
: bin_to_q(mapping.GetBinToQ()),
|
||||
sum(mapping.GetBinNumber(), 0),
|
||||
count(mapping.GetBinNumber(), 0) {
|
||||
|
||||
}
|
||||
|
||||
void RadialIntegrationProfile::Add(const std::vector<int32_t> &in_sum, const std::vector<int32_t> &in_count) {
|
||||
std::unique_lock<std::mutex> ul(m);
|
||||
|
||||
if ((in_sum.size() == sum.size()) && (in_count.size() == count.size())) {
|
||||
for (int i = 0; i < sum.size(); i++) {
|
||||
sum[i] += in_sum[i];
|
||||
count[i] += in_count[i];
|
||||
}
|
||||
} else if (!in_sum.empty() && !in_count.empty())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Mismatch in size of sum/count datasets");
|
||||
}
|
||||
|
||||
void RadialIntegrationProfile::GetPlot(JFJochProtoBuf::Plot &plot) const {
|
||||
std::unique_lock<std::mutex> ul(m);
|
||||
|
||||
std::vector<float> rad_int_profile(sum.size());
|
||||
for (int i = 0; i < sum.size(); i++) {
|
||||
if (count[i] > 0)
|
||||
rad_int_profile[i] = static_cast<float>(sum[i]) / static_cast<float>(count[i]);
|
||||
}
|
||||
|
||||
*plot.mutable_x() = {bin_to_q.begin(), bin_to_q.end()};
|
||||
*plot.mutable_y() = {rad_int_profile.begin(), rad_int_profile.end()};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_RADIALINTEGRATIONPROFILE_H
|
||||
#define JUNGFRAUJOCH_RADIALINTEGRATIONPROFILE_H
|
||||
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <jfjoch.pb.h>
|
||||
|
||||
#include "RadialIntegrationMapping.h"
|
||||
|
||||
class RadialIntegrationProfile {
|
||||
mutable std::mutex m;
|
||||
std::vector<int64_t> sum;
|
||||
std::vector<int64_t> count;
|
||||
std::vector<float> bin_to_q;
|
||||
public:
|
||||
explicit RadialIntegrationProfile(RadialIntegrationMapping &mapping);
|
||||
void Add(const std::vector<int32_t> &sum, const std::vector<int32_t> &count);
|
||||
void GetPlot(JFJochProtoBuf::Plot &plot) const;
|
||||
};
|
||||
|
||||
#endif //JUNGFRAUJOCH_RADIALINTEGRATIONPROFILE_H
|
||||
+68
-68
@@ -13,7 +13,7 @@ _sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xa5\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12\x13\n\tsummation\x18\x03 \x01(\x03H\x00\x12\x17\n\rimage_time_us\x18\x04 \x01(\x03H\x00\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12\x30\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCellH\x01\x88\x01\x01\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12\x36\n\x11scattering_vector\x18\x0f \x01(\x0b\x32\x16.JFJochProtoBuf.VectorH\x02\x88\x01\x01\x12\x18\n\x10\x61pply_pixel_mask\x18\x10 \x01(\x08\x12\x12\n\nbinning2x2\x18\x11 \x01(\x08\x42\x08\n\x06timingB\x0c\n\n_unit_cellB\x14\n\x12_scattering_vector\"\xf7\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x1a\n\rcount_time_us\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1f\n\x12pedestal_g0_frames\x18\x06 \x01(\x03H\x01\x88\x01\x01\x12\x1f\n\x12pedestal_g1_frames\x18\x07 \x01(\x03H\x02\x88\x01\x01\x12\x1f\n\x12pedestal_g2_frames\x18\x08 \x01(\x03H\x03\x88\x01\x01\x12\x19\n\x11\x63onversion_on_cpu\x18\t \x01(\x08\x42\x10\n\x0e_count_time_usB\x15\n\x13_pedestal_g0_framesB\x15\n\x13_pedestal_g1_framesB\x15\n\x13_pedestal_g2_frames\"b\n\x16\x44\x65tectorModuleGeometry\x12\x0e\n\x06pixel0\x18\x01 \x01(\x03\x12\x1b\n\x13\x66\x61st_direction_step\x18\x02 \x01(\x03\x12\x1b\n\x13slow_direction_step\x18\x03 \x01(\x03\"z\n\x10\x44\x65tectorGeometry\x12\x11\n\twidth_pxl\x18\x01 \x01(\x03\x12\x12\n\nheight_pxl\x18\x02 \x01(\x03\x12?\n\x0fmodule_geometry\x18\x03 \x03(\x0b\x32&.JFJochProtoBuf.DetectorModuleGeometry\"\xc1\x01\n\x08\x44\x65tector\x12\x10\n\x08nmodules\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x15\n\rpixel_size_mm\x18\x03 \x01(\x02\x12\x17\n\x0fmodule_hostname\x18\x04 \x03(\t\x12\x32\n\x08geometry\x18\x05 \x01(\x0b\x32 .JFJochProtoBuf.DetectorGeometry\x12*\n\x04type\x18\x06 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorType\"\xe1\x05\n\x10InternalSettings\x12\"\n\x1a\x66rame_time_pedestalG1G2_us\x18\x01 \x01(\x03\x12\x15\n\rframe_time_us\x18\x03 \x01(\x03\x12\x15\n\rcount_time_us\x18\x04 \x01(\x03\x12*\n\x08\x64\x65tector\x18\x05 \x01(\x0b\x32\x18.JFJochProtoBuf.Detector\x12\x14\n\x0cndatastreams\x18\x06 \x01(\x03\x12&\n\x1einternal_fpga_packet_generator\x18\t \x01(\x08\x12\x15\n\rstorage_cells\x18\n \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x0b \x01(\x03\x12\x1a\n\x12pedestal_g0_frames\x18\x0c \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\r \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x0e \x01(\x03\x12\x19\n\x11preview_period_us\x18\x0f \x01(\x03\x12\x1e\n\x16spot_finding_period_us\x18\x10 \x01(\x03\x12*\n\x04mode\x18\x13 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x19\n\x11mask_module_edges\x18\x14 \x01(\x08\x12\x17\n\x0fmask_chip_edges\x18\x15 \x01(\x08\x12\x16\n\x0eipv4_base_addr\x18\x16 \x01(\x03\x12\r\n\x05low_q\x18\x1a \x01(\x02\x12\x0e\n\x06high_q\x18\x1b \x01(\x02\x12\x11\n\tq_spacing\x18\x1c \x01(\x02\x12\x10\n\x08git_sha1\x18\x1d \x01(\t\x12\x10\n\x08git_date\x18\x1e \x01(\t\x12\x19\n\x11\x63onversion_on_cpu\x18\x1f \x01(\x08\x12\x13\n\x0bsource_name\x18 \x01(\t\x12\x19\n\x11source_name_short\x18! \x01(\t\x12\x17\n\x0finstrument_name\x18\" \x01(\t\x12\x1d\n\x15instrument_name_short\x18# \x01(\t\"|\n\x14JungfraujochSettings\x12\x30\n\x07\x64\x61taset\x18\x01 \x01(\x0b\x32\x1f.JFJochProtoBuf.DatasetSettings\x12\x32\n\x08internal\x18\x02 \x01(\x0b\x32 .JFJochProtoBuf.InternalSettings\"\x1e\n\nJFPedestal\x12\x10\n\x08pedestal\x18\x01 \x01(\x0c\"-\n\x11JFGainCalibration\x12\x18\n\x10gain_calibration\x18\x01 \x01(\x0c\"\xb2\x01\n\rJFCalibration\x12\x10\n\x08nmodules\x18\x01 \x01(\x04\x12\x16\n\x0enstorage_cells\x18\x02 \x01(\x04\x12,\n\x08pedestal\x18\x03 \x03(\x0b\x32\x1a.JFJochProtoBuf.JFPedestal\x12\x0c\n\x04mask\x18Line truncated
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xa5\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12\x13\n\tsummation\x18\x03 \x01(\x03H\x00\x12\x17\n\rimage_time_us\x18\x04 \x01(\x03H\x00\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12\x30\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCellH\x01\x88\x01\x01\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12\x36\n\x11scattering_vector\x18\x0f \x01(\x0b\x32\x16.JFJochProtoBuf.VectorH\x02\x88\x01\x01\x12\x18\n\x10\x61pply_pixel_mask\x18\x10 \x01(\x08\x12\x12\n\nbinning2x2\x18\x11 \x01(\x08\x42\x08\n\x06timingB\x0c\n\n_unit_cellB\x14\n\x12_scattering_vector\"\xf7\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x1a\n\rcount_time_us\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1f\n\x12pedestal_g0_frames\x18\x06 \x01(\x03H\x01\x88\x01\x01\x12\x1f\n\x12pedestal_g1_frames\x18\x07 \x01(\x03H\x02\x88\x01\x01\x12\x1f\n\x12pedestal_g2_frames\x18\x08 \x01(\x03H\x03\x88\x01\x01\x12\x19\n\x11\x63onversion_on_cpu\x18\t \x01(\x08\x42\x10\n\x0e_count_time_usB\x15\n\x13_pedestal_g0_framesB\x15\n\x13_pedestal_g1_framesB\x15\n\x13_pedestal_g2_frames\"b\n\x16\x44\x65tectorModuleGeometry\x12\x0e\n\x06pixel0\x18\x01 \x01(\x03\x12\x1b\n\x13\x66\x61st_direction_step\x18\x02 \x01(\x03\x12\x1b\n\x13slow_direction_step\x18\x03 \x01(\x03\"z\n\x10\x44\x65tectorGeometry\x12\x11\n\twidth_pxl\x18\x01 \x01(\x03\x12\x12\n\nheight_pxl\x18\x02 \x01(\x03\x12?\n\x0fmodule_geometry\x18\x03 \x03(\x0b\x32&.JFJochProtoBuf.DetectorModuleGeometry\"\xc1\x01\n\x08\x44\x65tector\x12\x10\n\x08nmodules\x18\x01 \x01(\x03\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x15\n\rpixel_size_mm\x18\x03 \x01(\x02\x12\x17\n\x0fmodule_hostname\x18\x04 \x03(\t\x12\x32\n\x08geometry\x18\x05 \x01(\x0b\x32 .JFJochProtoBuf.DetectorGeometry\x12*\n\x04type\x18\x06 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorType\"\xe1\x05\n\x10InternalSettings\x12\"\n\x1a\x66rame_time_pedestalG1G2_us\x18\x01 \x01(\x03\x12\x15\n\rframe_time_us\x18\x03 \x01(\x03\x12\x15\n\rcount_time_us\x18\x04 \x01(\x03\x12*\n\x08\x64\x65tector\x18\x05 \x01(\x0b\x32\x18.JFJochProtoBuf.Detector\x12\x14\n\x0cndatastreams\x18\x06 \x01(\x03\x12&\n\x1einternal_fpga_packet_generator\x18\t \x01(\x08\x12\x15\n\rstorage_cells\x18\n \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x0b \x01(\x03\x12\x1a\n\x12pedestal_g0_frames\x18\x0c \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\r \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x0e \x01(\x03\x12\x19\n\x11preview_period_us\x18\x0f \x01(\x03\x12\x1e\n\x16spot_finding_period_us\x18\x10 \x01(\x03\x12*\n\x04mode\x18\x13 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x19\n\x11mask_module_edges\x18\x14 \x01(\x08\x12\x17\n\x0fmask_chip_edges\x18\x15 \x01(\x08\x12\x16\n\x0eipv4_base_addr\x18\x16 \x01(\x03\x12\r\n\x05low_q\x18\x1a \x01(\x02\x12\x0e\n\x06high_q\x18\x1b \x01(\x02\x12\x11\n\tq_spacing\x18\x1c \x01(\x02\x12\x10\n\x08git_sha1\x18\x1d \x01(\t\x12\x10\n\x08git_date\x18\x1e \x01(\t\x12\x19\n\x11\x63onversion_on_cpu\x18\x1f \x01(\x08\x12\x13\n\x0bsource_name\x18 \x01(\t\x12\x19\n\x11source_name_short\x18! \x01(\t\x12\x17\n\x0finstrument_name\x18\" \x01(\t\x12\x1d\n\x15instrument_name_short\x18# \x01(\t\"|\n\x14JungfraujochSettings\x12\x30\n\x07\x64\x61taset\x18\x01 \x01(\x0b\x32\x1f.JFJochProtoBuf.DatasetSettings\x12\x32\n\x08internal\x18\x02 \x01(\x0b\x32 .JFJochProtoBuf.InternalSettings\"\x1e\n\nJFPedestal\x12\x10\n\x08pedestal\x18\x01 \x01(\x0c\"-\n\x11JFGainCalibration\x12\x18\n\x10gain_calibration\x18\x01 \x01(\x0c\"\xb2\x01\n\rJFCalibration\x12\x10\n\x08nmodules\x18\x01 \x01(\x04\x12\x16\n\x0enstorage_cells\x18\x02 \x01(\x04\x12,\n\x08pedestal\x18\x03 \x03(\x0b\x32\x1a.JFJochProtoBuf.JFPedestal\x12\x0c\n\x04mask\x18Line truncated
|
||||
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'jfjoch_pb2', globals())
|
||||
@@ -22,18 +22,18 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
DESCRIPTOR._options = None
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._options = None
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._serialized_options = b'8\001'
|
||||
_COMPRESSION._serialized_start=8576
|
||||
_COMPRESSION._serialized_end=8660
|
||||
_DETECTORTYPE._serialized_start=8662
|
||||
_DETECTORTYPE._serialized_end=8701
|
||||
_DETECTORMODE._serialized_start=8703
|
||||
_DETECTORMODE._serialized_end=8793
|
||||
_FPGAFIFOSTATUS._serialized_start=8795
|
||||
_FPGAFIFOSTATUS._serialized_end=8845
|
||||
_STATE._serialized_start=8847
|
||||
_STATE._serialized_end=8941
|
||||
_PLOTTYPE._serialized_start=8943
|
||||
_PLOTTYPE._serialized_end=9019
|
||||
_COMPRESSION._serialized_start=8618
|
||||
_COMPRESSION._serialized_end=8702
|
||||
_DETECTORTYPE._serialized_start=8704
|
||||
_DETECTORTYPE._serialized_end=8743
|
||||
_DETECTORMODE._serialized_start=8745
|
||||
_DETECTORMODE._serialized_end=8835
|
||||
_FPGAFIFOSTATUS._serialized_start=8837
|
||||
_FPGAFIFOSTATUS._serialized_end=8887
|
||||
_STATE._serialized_start=8889
|
||||
_STATE._serialized_end=8983
|
||||
_PLOTTYPE._serialized_start=8985
|
||||
_PLOTTYPE._serialized_end=9061
|
||||
_EMPTY._serialized_start=32
|
||||
_EMPTY._serialized_end=39
|
||||
_UNITCELL._serialized_start=41
|
||||
@@ -79,59 +79,59 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
_RECEIVERSTATUS._serialized_start=3910
|
||||
_RECEIVERSTATUS._serialized_end=4057
|
||||
_PLOTREQUEST._serialized_start=4059
|
||||
_PLOTREQUEST._serialized_end=4129
|
||||
_RECEIVERDATAPROCESSINGPLOTS._serialized_start=4132
|
||||
_RECEIVERDATAPROCESSINGPLOTS._serialized_end=4342
|
||||
_WRITERINPUT._serialized_start=4344
|
||||
_WRITERINPUT._serialized_end=4406
|
||||
_DATAFILESTATISTICS._serialized_start=4408
|
||||
_DATAFILESTATISTICS._serialized_end=4459
|
||||
_WRITEROUTPUT._serialized_start=4462
|
||||
_WRITEROUTPUT._serialized_end=4603
|
||||
_DETECTORMODULECONFIG._serialized_start=4606
|
||||
_DETECTORMODULECONFIG._serialized_end=4864
|
||||
_DETECTORCONFIG._serialized_start=4866
|
||||
_DETECTORCONFIG._serialized_end=4962
|
||||
_DETECTORINPUT._serialized_start=4965
|
||||
_DETECTORINPUT._serialized_end=5214
|
||||
_DETECTOROUTPUT._serialized_start=5216
|
||||
_DETECTOROUTPUT._serialized_end=5232
|
||||
_DETECTORSTATUS._serialized_start=5234
|
||||
_DETECTORSTATUS._serialized_end=5332
|
||||
_FPGASTATUS._serialized_start=5335
|
||||
_FPGASTATUS._serialized_end=6405
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._serialized_start=6324
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._serialized_end=6405
|
||||
_INDEXERDATAPROCESSINGPLOTS._serialized_start=6407
|
||||
_INDEXERDATAPROCESSINGPLOTS._serialized_end=6480
|
||||
_DATAPROCESSINGSETTINGS._serialized_start=6483
|
||||
_DATAPROCESSINGSETTINGS._serialized_end=6829
|
||||
_PREVIEWFRAME._serialized_start=6832
|
||||
_PREVIEWFRAME._serialized_end=7101
|
||||
_MODULESTATISTICS._serialized_start=7104
|
||||
_MODULESTATISTICS._serialized_end=7341
|
||||
_IMAGE._serialized_start=7343
|
||||
_IMAGE._serialized_end=7416
|
||||
_MASKTOLOAD._serialized_start=7418
|
||||
_MASKTOLOAD._serialized_end=7464
|
||||
_MEASUREMENTSTATISTICS._serialized_start=7467
|
||||
_MEASUREMENTSTATISTICS._serialized_end=8036
|
||||
_BROKERSTATUS._serialized_start=8039
|
||||
_BROKERSTATUS._serialized_end=8180
|
||||
_BROKERFULLSTATUS._serialized_start=8183
|
||||
_BROKERFULLSTATUS._serialized_end=8347
|
||||
_DETECTORLISTELEMENT._serialized_start=8349
|
||||
_DETECTORLISTELEMENT._serialized_end=8421
|
||||
_DETECTORLIST._serialized_start=8423
|
||||
_DETECTORLIST._serialized_end=8541
|
||||
_DETECTORSELECTION._serialized_start=8543
|
||||
_DETECTORSELECTION._serialized_end=8574
|
||||
_GRPC_JFJOCHRECEIVER._serialized_start=9022
|
||||
_GRPC_JFJOCHRECEIVER._serialized_end=9689
|
||||
_GRPC_JFJOCHWRITER._serialized_start=9692
|
||||
_GRPC_JFJOCHWRITER._serialized_end=9894
|
||||
_GRPC_JFJOCHDETECTOR._serialized_start=9897
|
||||
_GRPC_JFJOCHDETECTOR._serialized_end=10283
|
||||
_GRPC_JFJOCHBROKER._serialized_start=10286
|
||||
_GRPC_JFJOCHBROKER._serialized_end=11875
|
||||
_PLOTREQUEST._serialized_end=4171
|
||||
_RECEIVERDATAPROCESSINGPLOTS._serialized_start=4174
|
||||
_RECEIVERDATAPROCESSINGPLOTS._serialized_end=4384
|
||||
_WRITERINPUT._serialized_start=4386
|
||||
_WRITERINPUT._serialized_end=4448
|
||||
_DATAFILESTATISTICS._serialized_start=4450
|
||||
_DATAFILESTATISTICS._serialized_end=4501
|
||||
_WRITEROUTPUT._serialized_start=4504
|
||||
_WRITEROUTPUT._serialized_end=4645
|
||||
_DETECTORMODULECONFIG._serialized_start=4648
|
||||
_DETECTORMODULECONFIG._serialized_end=4906
|
||||
_DETECTORCONFIG._serialized_start=4908
|
||||
_DETECTORCONFIG._serialized_end=5004
|
||||
_DETECTORINPUT._serialized_start=5007
|
||||
_DETECTORINPUT._serialized_end=5256
|
||||
_DETECTOROUTPUT._serialized_start=5258
|
||||
_DETECTOROUTPUT._serialized_end=5274
|
||||
_DETECTORSTATUS._serialized_start=5276
|
||||
_DETECTORSTATUS._serialized_end=5374
|
||||
_FPGASTATUS._serialized_start=5377
|
||||
_FPGASTATUS._serialized_end=6447
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._serialized_start=6366
|
||||
_FPGASTATUS_FIFOSTATUSENTRY._serialized_end=6447
|
||||
_INDEXERDATAPROCESSINGPLOTS._serialized_start=6449
|
||||
_INDEXERDATAPROCESSINGPLOTS._serialized_end=6522
|
||||
_DATAPROCESSINGSETTINGS._serialized_start=6525
|
||||
_DATAPROCESSINGSETTINGS._serialized_end=6871
|
||||
_PREVIEWFRAME._serialized_start=6874
|
||||
_PREVIEWFRAME._serialized_end=7143
|
||||
_MODULESTATISTICS._serialized_start=7146
|
||||
_MODULESTATISTICS._serialized_end=7383
|
||||
_IMAGE._serialized_start=7385
|
||||
_IMAGE._serialized_end=7458
|
||||
_MASKTOLOAD._serialized_start=7460
|
||||
_MASKTOLOAD._serialized_end=7506
|
||||
_MEASUREMENTSTATISTICS._serialized_start=7509
|
||||
_MEASUREMENTSTATISTICS._serialized_end=8078
|
||||
_BROKERSTATUS._serialized_start=8081
|
||||
_BROKERSTATUS._serialized_end=8222
|
||||
_BROKERFULLSTATUS._serialized_start=8225
|
||||
_BROKERFULLSTATUS._serialized_end=8389
|
||||
_DETECTORLISTELEMENT._serialized_start=8391
|
||||
_DETECTORLISTELEMENT._serialized_end=8463
|
||||
_DETECTORLIST._serialized_start=8465
|
||||
_DETECTORLIST._serialized_end=8583
|
||||
_DETECTORSELECTION._serialized_start=8585
|
||||
_DETECTORSELECTION._serialized_end=8616
|
||||
_GRPC_JFJOCHRECEIVER._serialized_start=9064
|
||||
_GRPC_JFJOCHRECEIVER._serialized_end=9731
|
||||
_GRPC_JFJOCHWRITER._serialized_start=9734
|
||||
_GRPC_JFJOCHWRITER._serialized_end=9936
|
||||
_GRPC_JFJOCHDETECTOR._serialized_start=9939
|
||||
_GRPC_JFJOCHDETECTOR._serialized_end=10325
|
||||
_GRPC_JFJOCHBROKER._serialized_start=10328
|
||||
_GRPC_JFJOCHBROKER._serialized_end=11917
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
+19
-26
@@ -35,7 +35,6 @@ JFJochReceiver::JFJochReceiver(const JFJochProtoBuf::ReceiverInput &settings,
|
||||
frame_transformation_nthreads((experiment.GetSummation() >= threaded_summation_threshold) ?
|
||||
2 : in_forward_and_sum_nthreads),
|
||||
preview_publisher(in_preview_publisher),
|
||||
rad_int_profile_window(experiment.GetSpotFindingBin()),
|
||||
ndatastreams(experiment.GetDataStreamsNum()),
|
||||
data_acquisition_ready(ndatastreams),
|
||||
frame_transformation_ready((experiment.GetImageNum() > 0) ? frame_transformation_nthreads : 0)
|
||||
@@ -76,6 +75,11 @@ JFJochReceiver::JFJochReceiver(const JFJochProtoBuf::ReceiverInput &settings,
|
||||
logger.Info("GPU support missing");
|
||||
|
||||
rad_int_mapping = std::make_unique<RadialIntegrationMapping>(experiment, one_byte_mask.data());
|
||||
rad_int_profile = std::make_unique<RadialIntegrationProfile>(*rad_int_mapping);
|
||||
|
||||
for (int i = 0; i < experiment.GetDataFileCount(); i++)
|
||||
rad_int_profile_per_file.emplace_back(std::make_unique<RadialIntegrationProfile>(*rad_int_mapping));
|
||||
|
||||
spot_finder_mask = calib->CalculateOneByteMask(experiment);
|
||||
}
|
||||
|
||||
@@ -446,7 +450,13 @@ int64_t JFJochReceiver::FrameTransformationThread() {
|
||||
bkg_estimate.AddElement(image_number, bkg_estimate_val);
|
||||
|
||||
spot_finder->GetRadialIntegrationProfile(message.rad_int_profile);
|
||||
AddRadialIntegrationProfile(message.rad_int_profile);
|
||||
rad_int_profile->Add(spot_finder->GetRadialIntegrationSum(),
|
||||
spot_finder->GetRadialIntegrationCount());
|
||||
|
||||
if (image_number % experiment.GetDataFileCount() < rad_int_profile_per_file.size())
|
||||
rad_int_profile_per_file[image_number % experiment.GetDataFileCount()]
|
||||
->Add(spot_finder->GetRadialIntegrationSum(),
|
||||
spot_finder->GetRadialIntegrationCount());
|
||||
}
|
||||
|
||||
if (push_images_to_writer) {
|
||||
@@ -636,29 +646,6 @@ JFJochProtoBuf::DataProcessingSettings JFJochReceiver::GetDataProcessingSettings
|
||||
return data_processing_settings;
|
||||
}
|
||||
|
||||
void JFJochReceiver::AddRadialIntegrationProfile(const std::vector<float> &result) {
|
||||
std::unique_lock<std::mutex> ul(rad_int_profile_mutex);
|
||||
if (rad_int_profile.empty())
|
||||
rad_int_profile = result;
|
||||
else if (rad_int_profile.size() == result.size()) {
|
||||
for (int i = 0; i < rad_int_profile.size(); i++)
|
||||
rad_int_profile[i] += (result[i] - rad_int_profile[i]) / rad_int_profile_window;
|
||||
} else {
|
||||
// Throw exception?
|
||||
Abort();
|
||||
}
|
||||
}
|
||||
|
||||
void JFJochReceiver::GetRadialIntegrationProfile(JFJochProtoBuf::Plot &plot) {
|
||||
std::unique_lock<std::mutex> ul(rad_int_profile_mutex);
|
||||
|
||||
const auto &bin_to_q = rad_int_mapping->GetBinToQ();
|
||||
if (!rad_int_profile.empty()) {
|
||||
*plot.mutable_x() = {bin_to_q.begin(), bin_to_q.end()};
|
||||
*plot.mutable_y() = {rad_int_profile.begin(), rad_int_profile.end()};
|
||||
}
|
||||
}
|
||||
|
||||
JFJochProtoBuf::Plot JFJochReceiver::GetPlots(const JFJochProtoBuf::PlotRequest &request) {
|
||||
JFJochProtoBuf::Plot ret;
|
||||
auto nbins = experiment.GetSpotFindingBin();
|
||||
@@ -667,7 +654,13 @@ JFJochProtoBuf::Plot JFJochReceiver::GetPlots(const JFJochProtoBuf::PlotRequest
|
||||
|
||||
switch (request.type()) {
|
||||
case JFJochProtoBuf::RAD_INT:
|
||||
GetRadialIntegrationProfile(ret);
|
||||
if (request.has_file_number()) {
|
||||
if (request.file_number() < rad_int_profile_per_file.size())
|
||||
rad_int_profile_per_file[request.file_number()]->GetPlot(ret);
|
||||
} else {
|
||||
if (rad_int_profile)
|
||||
rad_int_profile->GetPlot(ret);
|
||||
}
|
||||
break;
|
||||
case JFJochProtoBuf::SPOT_COUNT:
|
||||
spot_count.GetPlot(ret, nbins);
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include "../common/ThreadSafeFIFO.h"
|
||||
#include "../common/ZMQPreviewPublisher.h"
|
||||
|
||||
#include "../image_analysis/RadialIntegration.h"
|
||||
#include "../image_analysis/RadialIntegrationMapping.h"
|
||||
#include "../image_analysis/RadialIntegrationProfile.h"
|
||||
|
||||
#include "../common/StatusVector.h"
|
||||
#include "../jungfrau/JFConversionFixedPoint.h"
|
||||
@@ -41,10 +42,8 @@ class JFJochReceiver {
|
||||
std::vector<std::future<int64_t>> data_acquisition_futures;
|
||||
|
||||
std::unique_ptr<RadialIntegrationMapping> rad_int_mapping;
|
||||
|
||||
std::vector<float> rad_int_profile;
|
||||
const size_t rad_int_profile_window;
|
||||
std::mutex rad_int_profile_mutex;
|
||||
std::unique_ptr<RadialIntegrationProfile> rad_int_profile;
|
||||
std::vector<std::unique_ptr<RadialIntegrationProfile>> rad_int_profile_per_file;
|
||||
|
||||
std::vector<uint8_t> spot_finder_mask;
|
||||
|
||||
@@ -99,10 +98,7 @@ class JFJochReceiver {
|
||||
FrameTransformation &transformation, DataMessage &message);
|
||||
void Abort(const JFJochException &e);
|
||||
void FinalizeMeasurement();
|
||||
JFJochProtoBuf::DataProcessingSettings GetDataProcessingSettings();
|
||||
|
||||
void AddRadialIntegrationProfile(const std::vector<float> &result);
|
||||
void GetRadialIntegrationProfile(JFJochProtoBuf::Plot &plots);
|
||||
JFJochProtoBuf::DataProcessingSettings GetDataProcessingSettings();
|
||||
|
||||
void UpdateMaxImage(int64_t image_number);
|
||||
public:
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "../image_analysis/RadialIntegrationProfile.h"
|
||||
#include "../image_analysis/RadialIntegrationMapping.h"
|
||||
#include "../image_analysis/RadialIntegration.h"
|
||||
|
||||
TEST_CASE("RadialIntegrationMapping_Constructor","[RadialIntegration]") {
|
||||
@@ -75,6 +78,38 @@ TEST_CASE("RadialIntegrationMapping_QToBin","[RadialIntegration]") {
|
||||
REQUIRE(mapping.QToBin(50.0) == Approx(38));
|
||||
}
|
||||
|
||||
TEST_CASE("RadialIntegrationProfile","[RadialIntegration]") {
|
||||
DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36));
|
||||
x.DetectorDistance_mm(50).BeamX_pxl(1000).BeamY_pxl(1000);
|
||||
x.QSpacingForRadialInt_recipA(0.1).LowQForRadialInt_recipA(0.1).HighQForRadialInt_recipA(4);
|
||||
|
||||
RadialIntegrationMapping mapping(x);
|
||||
|
||||
RadialIntegrationProfile profile(mapping);
|
||||
|
||||
std::vector<int32_t> sum(mapping.GetBinNumber());
|
||||
std::vector<int32_t> count(mapping.GetBinNumber());
|
||||
|
||||
for (int i = 0; i < mapping.GetBinNumber(); i++) {
|
||||
sum[i] = i * i * 4;
|
||||
count[i] = i;
|
||||
}
|
||||
REQUIRE_NOTHROW(profile.Add(sum, count));
|
||||
|
||||
std::vector<int32_t> sum_wr(mapping.GetBinNumber() - 1);
|
||||
REQUIRE_THROWS(profile.Add(sum_wr, count));
|
||||
|
||||
JFJochProtoBuf::Plot plot;
|
||||
profile.GetPlot(plot);
|
||||
|
||||
REQUIRE(plot.x_size() == mapping.GetBinNumber());
|
||||
REQUIRE(plot.y_size() == mapping.GetBinNumber());
|
||||
for (int i = 0; i < mapping.GetBinNumber(); i++) {
|
||||
REQUIRE(plot.x(i) == Approx(mapping.GetBinToQ()[i]));
|
||||
REQUIRE(plot.y(i) == Approx(i * 4));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("RadialIntegration_Process","[RadialIntegration]") {
|
||||
std::vector<uint16_t> pixel_to_bin = {0,1,2,4,3,1,2,3};
|
||||
std::vector<int16_t> test_image = {7,6,5,4,3,2,1,0};
|
||||
|
||||
Reference in new issue
Block a user