From 42fc18c3ce4af1dccdf511b1da8ab4b0860e3b96 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 25 Mar 2021 11:00:06 +0100 Subject: PinkIndexer: fix conversion of detector shift --- libcrystfel/src/indexers/pinkindexer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/indexers/pinkindexer.c b/libcrystfel/src/indexers/pinkindexer.c index c829bd1e..149bb5bd 100644 --- a/libcrystfel/src/indexers/pinkindexer.c +++ b/libcrystfel/src/indexers/pinkindexer.c @@ -81,12 +81,13 @@ static void restoreReciprocalCell(UnitCell *cell, LatticeTransform_t* appliedRed static void makeRightHanded(UnitCell* cell); +/* Return mean clen in m */ static double mean_clen(struct detgeom *dg) { int i; double total = 0.0; for ( i=0; in_panels; i++ ) { - total += dg->panels[i].cnz; + total += dg->panels[i].cnz * dg->panels[i].pixel_pitch; } return total / dg->n_panels; } @@ -100,7 +101,7 @@ static void scale_detector_shift(double fake_clen, int i; double mean = mean_clen(dg); for ( i=0; in_panels; i++ ) { - if ( !within_tolerance(dg->panels[i].cnz, mean, 2.0) ) { + if ( !within_tolerance(dg->panels[i].cnz*dg->panels[i].pixel_pitch, mean, 2.0) ) { ERROR("WARNING: Detector is not flat enough to apply " "detector position offset\n"); *pdx = 0.0; -- cgit v1.2.3