v1.0.0-rc.112 #18

Merged
leonarski_f merged 37 commits from 2511-1.0.0-rc.112 into main 2025-11-30 17:39:23 +01:00
3 changed files with 34 additions and 22 deletions
Showing only changes of commit 87a9a0b745 - Show all commits

View File

@@ -18,27 +18,9 @@ void SpotAnalyze(const DiffractionExperiment &experiment,
BraggPrediction &prediction,
IndexerThreadPool *indexer,
DataMessage &output) {
std::vector<SpotToSave> spots_out;
auto geom = experiment.GetDiffractionGeometry();
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;
SpotAnalyze(experiment, spot_finding_settings, spots, output);
if ((indexer != nullptr) && spot_finding_settings.indexing) {
std::vector<Coord> recip;
@@ -49,8 +31,7 @@ void SpotAnalyze(const DiffractionExperiment &experiment,
recip.push_back(i.ReciprocalCoord(geom));
}
auto latt_f = indexer->Run(experiment, recip);
auto indexer_result = latt_f.get();
auto indexer_result = indexer->Run(experiment, recip).get();
output.indexing_time_s = indexer_result.indexing_time_s;
if (indexer_result.lattice.empty())

View File

@@ -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;
}

View File

@@ -28,4 +28,7 @@ void FilterSpuriousHighResolutionSpots(std::vector<SpotToSave> &spots, float thr
// For 20 spots or more - take the 95% percentile best high resolution spot
std::optional<float> GetResolution(const std::vector<SpotToSave> &spots);
void SpotAnalyze(const DiffractionExperiment &experiment, const SpotFindingSettings &settings,
const std::vector<DiffractionSpot> &spots, DataMessage &message);
#endif //JFJOCH_SPOTANALYSIS_H