From 42113f1a6f1283e230182b1a6a0d2cb44a6ef3aa Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 28 Mar 2014 15:23:24 +0100 Subject: Require at least two bright pixels in integration box before moving centre --- libcrystfel/src/integration.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 14d97a2e..e753dea9 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -937,7 +937,7 @@ static double fit_J(struct intcontext *ic, struct peak_box *bx) static int center_and_check_box(struct intcontext *ic, struct peak_box *bx, int *sat) { - int i; + int i, nstrong; bx->offs_fs = 0.0; bx->offs_ss = 0.0; @@ -945,6 +945,7 @@ static int center_and_check_box(struct intcontext *ic, struct peak_box *bx, if ( check_box(ic, bx, sat) ) return 1; fit_bg(ic, bx); + nstrong = 0; for ( i=0; i<10; i++ ) { int p, q; @@ -965,6 +966,7 @@ static int center_and_check_box(struct intcontext *ic, struct peak_box *bx, bg = bx->a*p + bx->b*q + bx->c; if ( bi <= 3.0*bg ) continue; + nstrong++; if ( bi > max ) { max = bi; @@ -975,6 +977,11 @@ static int center_and_check_box(struct intcontext *ic, struct peak_box *bx, } } + /* We require at least two bright pixels in the peak region, + * otherwise we might just be centering on a pixel which is + * just at the tail of the distribution */ + if ( nstrong < 2 ) return 0; + bx->offs_fs += ifs; bx->offs_ss += iss; bx->cfs += ifs; -- cgit v1.2.3