aboutsummaryrefslogtreecommitdiff
path: root/src/facetron.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-19 14:58:59 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:06 +0100
commitf74158ae3c381d98a44a66de1e7e0994b4520b22 (patch)
tree6b651b6a47afcf66fadb085f9a0c6de15029adc6 /src/facetron.c
parenteaf64b9939ff06e74413cf8f522574fbb90341db (diff)
facetron: Fix convergence criterion
Diffstat (limited to 'src/facetron.c')
-rw-r--r--src/facetron.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/facetron.c b/src/facetron.c
index 44dd39c3..a0c2b6e4 100644
--- a/src/facetron.c
+++ b/src/facetron.c
@@ -148,7 +148,7 @@ static double mean_partial_dev(struct image *image, struct cpeak *spots, int n,
get_asymm(hind, kind, lind, &ha, &ka, &la, sym);
I_full = lookup_intensity(i_full, ha, ka, la);
- delta_I += I_partial - spots[h].p * I_full;
+ delta_I += fabs(I_partial - spots[h].p * I_full);
if ( graph != NULL ) {
fprintf(graph, "%3i %3i %3i %5.2f (at %5.2f,%5.2f)"
@@ -286,7 +286,7 @@ static void refine_image(int mytask, void *tasks)
dev = iterate(image, pargs->i_full, pargs->sym, &spots, &n);
STATUS("Iteration %2i: mean dev = %5.2f\n", i, dev);
i++;
- } while ( (fabs(last_dev - dev) > 1.0) || (i == MAX_CYCLES) );
+ } while ( (fabs(last_dev - dev) > 1.0) && (i < MAX_CYCLES) );
mean_partial_dev(image, spots, n, pargs->sym,
pargs->i_full, pargs->graph);