From 55efd42045ec343a51acbe2583c5c6c5903de6bf Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 19 Jul 2026 07:08:44 +0200 Subject: [PATCH] tests: seed spindle-parallel beam at truth in XtalOptimizer_rotation The gauge-weak beam-centre prior (c140b3567) deliberately restrains the spindle-parallel beam component toward the header instead of refining it freely. The rotation test seeded that exact component (beam-X, axis along X) off-truth, so the intended restraint slightly biased the co-refined distance and cell-c through the distance-cell degeneracy, pushing both just past the tight thresholds. Seed beam-X at its true value (the gauge direction is meant to be trusted to the header); keep beam-Y perturbed to still exercise beam-centre recovery in the well-constrained direction. Distance/cell now recover within the original thresholds. Source (the intended prior) untouched. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/XtalOptimizerTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/XtalOptimizerTest.cpp b/tests/XtalOptimizerTest.cpp index 5a809a87..f200693a 100644 --- a/tests/XtalOptimizerTest.cpp +++ b/tests/XtalOptimizerTest.cpp @@ -538,10 +538,14 @@ TEST_CASE("XtalOptimizer_rotation") { } } - // Seed slightly perturbed geometry and lattice; provide rotation axis for refinement + // Seed slightly perturbed geometry and lattice; provide rotation axis for refinement. + // The beam-centre component PARALLEL to the spindle (here X, the rotation axis) is a gauge-weak + // direction that XtalOptimizer now deliberately restrains toward the header rather than refining + // freely (see the BeamComponentPrior in XtalOptimizer.cpp). So only the perpendicular component + // (Y) is seeded off-truth to exercise beam-centre recovery; X is seeded at its true value. XtalOptimizerData xtal_opt{}; xtal_opt.latt = CrystalLattice(39.7f, 50.6f, 79.6f, 90.0f, 94.5f, 90.5f); - xtal_opt.geom.BeamX_pxl(1003).BeamY_pxl(997).DetectorDistance_mm(203.0) + xtal_opt.geom.BeamX_pxl(1000).BeamY_pxl(997).DetectorDistance_mm(203.0) .PoniRot1_rad(0.01).PoniRot2_rad(0.02); xtal_opt.crystal_system = gemmi::CrystalSystem::Monoclinic; xtal_opt.axis = axis;