Indexing: Fixes to better handling ice ring spots

This commit is contained in:
2025-12-17 21:11:01 +01:00
parent 88dba761e4
commit a71e1f16e7
4 changed files with 8 additions and 3 deletions
+1
View File
@@ -90,6 +90,7 @@ void RotationIndexer::TryIndex() {
.min_spots = experiment.GetIndexingSettings().GetViableCellMinSpots(),
.refine_beam_center = true,
.refine_distance_mm = false,
.index_ice_rings = experiment.GetIndexingSettings().GetIndexIceRings(),
.axis = axis_
};
@@ -413,8 +413,12 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
break;
}
const float tolerance_sq = tolerance * tolerance;
// Add residuals for each point
for (const auto &pt: spots) {
if (!data.index_ice_rings && pt.ice_ring)
continue;
Eigen::Matrix3d gonio_back_rot = Eigen::Matrix3d::Identity();
Coord recip = data.geom.DetectorToRecip(pt.x, pt.y);
@@ -442,10 +446,9 @@ bool XtalOptimizerInternal(XtalOptimizerData &data,
double norm_sq = (h - h_fp) * (h - h_fp) + (k - k_fp) * (k - k_fp) + (l - l_fp) * (l - l_fp);
if (norm_sq > tolerance * tolerance)
if (norm_sq > tolerance_sq)
continue;
problem.AddResidualBlock(
new ceres::AutoDiffCostFunction<XtalResidual, 3, 1, 1, 1, 2, 3, 3, 3>(
new XtalResidual(pt.x, pt.y,
@@ -27,6 +27,8 @@ struct XtalOptimizerData {
bool refine_distance_mm = false;
bool refine_detector_angles = false;
bool index_ice_rings = true;
float max_time = 1.0;
std::optional<GoniometerAxis> axis;
@@ -6,7 +6,6 @@
#include "AnalyzeIndexing.h"
#include "FitProfileRadius.h"
#include "spdlog/fmt/bundled/format.h"
namespace {
inline bool ok(float x) {