v1.0.0-rc.112 #18
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user