calibration: an option to hold the detector tilt fixed

--mode calibration fits five parameters - beam centre, distance and the two
PONI tilts - and a program that cannot express a tilted detector has nowhere to
put the last two. Dropping them after the fact is worse than never fitting
them: the centre and the distance of a tilted fit have already absorbed the
tilt, so the flattened geometry is right nowhere.

rugnux --no-refine-tilt, the "Refine detector tilt" tick box on the viewer's
Calib page and RingOptimizer's refine_tilt argument hold rot1/rot2 at the value
the geometry came in with and fit the remaining three. That is the best
flat-detector answer, and the one such a program would refine to itself.

Measured on a five-distance calibrant series. At short distance the tilt is
real and reproducible - three independent fits agreeing to 0.01 deg, radial rms
1.4 -> 0.4 px - and its direct beam agrees with the background beam-centre
estimator to 0.05 px, so the tilted model is the physically right one. The
pinned fit then displaces the centre 2.6 px to absorb the tilt and lands within
0.03 px of the same place at every distance.

Past ~300 mm, where only two rings reach the detector, the tilt is instead
under-determined: it comes out with the opposite sign to every short-distance
fit and drags the PONI 28 px while the rms does not move (0.960 against 0.962).
The existing degeneracy guard only fires on a strictly single ring, so it does
not catch that; declining a tilt that does not pay for itself in rms is left
for a separate change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxrrPcxodNiXzhNiECCVp5
This commit is contained in:
2026-08-30 20:44:12 +02:00
co-authored by Claude Opus 5
parent d5818713cb
commit 03456dcddd
22 changed files with 136 additions and 32 deletions
+16 -3
View File
@@ -25,6 +25,16 @@ PowderCalibrationWidget::PowderCalibrationWidget(QWidget *parent) : QWidget(pare
"(q x azimuth) azimuthal profile over every image and fits the ring arcs in it; "
"spots pools the found spots and fits those.");
// The detector tilt is a free parameter of every one of these fits. Unticking it holds rot1/rot2
// where the geometry already has them - what a calibration handed to a program with no way to
// express a tilted detector (XDS) needs. It applies to the two buttons and to "Analyze dataset".
refineTiltCheck = new QCheckBox("Refine detector tilt", this);
refineTiltCheck->setChecked(true);
refineTiltCheck->setToolTip("Fit the detector tilt (PONI rot1/rot2) together with the beam centre "
"and the distance. Untick to hold the tilt where it is and fit only the "
"beam centre and the distance - for a calibration that will be given to "
"a program which cannot express a tilted detector, such as XDS.");
auto findBeamCenterButton = new QPushButton("Guess detector calibration", this);
connect(findBeamCenterButton, &QPushButton::clicked,this, &PowderCalibrationWidget::findBeamCenterClicked);
@@ -48,6 +58,8 @@ PowderCalibrationWidget::PowderCalibrationWidget(QWidget *parent) : QWidget(pare
refine_row->addWidget(calibrantRingsButton,2, 0);
refine_row->addWidget(refineTiltCheck,2, 1);
refine_row->addWidget(new QLabel("Dataset method:"),3,0);
refine_row->addWidget(methodCombo,3,1);
@@ -75,7 +87,8 @@ std::vector<float> PowderCalibrationWidget::GetCalibrantRings() const {
CalibrationSelection PowderCalibrationWidget::Selection() const {
return {calibrantCombo->currentText(), GetCalibrantRings(),
static_cast<CalibrationMethod>(methodCombo->currentData().toInt())};
static_cast<CalibrationMethod>(methodCombo->currentData().toInt()),
refineTiltCheck->isChecked()};
}
void PowderCalibrationWidget::updateCalibrantList() {
@@ -102,10 +115,10 @@ void PowderCalibrationWidget::loadImage(std::shared_ptr<const JFJochReaderImage>
void PowderCalibrationWidget::findBeamCenterClicked() {
const std::vector<float> rings = GetCalibrantRings();
emit findBeamCenter(QVector<float>(rings.begin(), rings.end()), true);
emit findBeamCenter(QVector<float>(rings.begin(), rings.end()), true, refineTiltCheck->isChecked());
}
void PowderCalibrationWidget::optimizeBeamCenterClicked() {
const std::vector<float> rings = GetCalibrantRings();
emit findBeamCenter(QVector<float>(rings.begin(), rings.end()), false);
emit findBeamCenter(QVector<float>(rings.begin(), rings.end()), false, refineTiltCheck->isChecked());
}