diff options
author | Thomas White <taw@physics.org> | 2014-03-28 15:23:24 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-03-28 15:23:24 +0100 |
commit | 42113f1a6f1283e230182b1a6a0d2cb44a6ef3aa (patch) | |
tree | 668fc2bbd25dbb57957c5f28eb5c001354e8d8dd /libcrystfel/src/integration.c | |
parent | 9f6233c33890008ca4a7d5bb8de271acbf9b9c49 (diff) |
Require at least two bright pixels in integration box before moving centre
Diffstat (limited to 'libcrystfel/src/integration.c')
-rw-r--r-- | libcrystfel/src/integration.c | 9 |
1 files changed, 8 insertions, 1 deletions
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; |