SpotAnalyze: Extract spot analysis function into a dedicated
This commit is contained in:
@@ -50,7 +50,7 @@ void FilterSpotsByCount(std::vector<SpotToSave> &input, int64_t count) {
|
||||
}
|
||||
|
||||
void FilterSpuriousHighResolutionSpots(std::vector<SpotToSave> &spots, float threshold) {
|
||||
std::ranges::sort(spots, [] (SpotToSave &a, SpotToSave &b) {
|
||||
std::ranges::sort(spots, [](SpotToSave &a, SpotToSave &b) {
|
||||
return a.d_A > b.d_A;
|
||||
});
|
||||
|
||||
@@ -125,3 +125,31 @@ void GenerateSpotPlot(DataMessage &msg, float d_min_A) {
|
||||
msg.spot_plot_intensity = result;
|
||||
msg.spot_plot_count = count;
|
||||
}
|
||||
|
||||
void SpotAnalyze(const DiffractionExperiment &experiment,
|
||||
const SpotFindingSettings &spot_finding_settings,
|
||||
const std::vector<DiffractionSpot> &spots,
|
||||
DataMessage &output) {
|
||||
auto geom = experiment.GetDiffractionGeometry();
|
||||
|
||||
std::vector<SpotToSave> spots_out;
|
||||
|
||||
for (const auto &spot: spots)
|
||||
spots_out.push_back(spot.Export(geom));
|
||||
|
||||
if (spot_finding_settings.high_res_gap_Q_recipA.has_value())
|
||||
FilterSpuriousHighResolutionSpots(spots_out, spot_finding_settings.high_res_gap_Q_recipA.value());
|
||||
|
||||
if (experiment.GetDatasetSettings().IsDetectIceRings() && spot_finding_settings.ice_ring_width_Q_recipA > 0.0f)
|
||||
MarkIceRings(spots_out, spot_finding_settings.ice_ring_width_Q_recipA);
|
||||
|
||||
CountSpots(output, spots_out, spot_finding_settings.cutoff_spot_count_low_res);
|
||||
|
||||
GenerateSpotPlot(output, spot_finding_settings.high_resolution_limit);
|
||||
|
||||
output.resolution_estimate = GetResolution(spots_out);
|
||||
|
||||
FilterSpotsByCount(spots_out, experiment.GetMaxSpotCount());
|
||||
|
||||
output.spots = spots_out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user