aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-24 11:41:49 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:30 +0100
commitee9a78637d9fd1fad826092e0d4453a9da014c50 (patch)
treec7986412f48a418e694e3001ce63cb401898d405 /tests
parent45c407fe626f98eb8d44209f8e2b7e553ae77fb0 (diff)
More gradient diagnostics
Diffstat (limited to 'tests')
-rw-r--r--tests/pr_gradient_check.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/tests/pr_gradient_check.c b/tests/pr_gradient_check.c
index d2aa376e..36fe19ca 100644
--- a/tests/pr_gradient_check.c
+++ b/tests/pr_gradient_check.c
@@ -174,6 +174,9 @@ static int test_gradients(struct image *image, double incr_val, int refine,
n_valid--;
} else {
+ double r1, r2, p;
+ int cl, ch;
+
grad1 = (vals[1][i] - vals[0][i]) / incr_val;
grad2 = (vals[2][i] - vals[1][i]) / incr_val;
grad = (grad1 + grad2) / 2.0;
@@ -181,19 +184,23 @@ static int test_gradients(struct image *image, double incr_val, int refine,
cgrad = gradient(image, refine, refl,
image->profile_radius);
- if ( !within_tolerance(grad, cgrad, 10.0) ) {
- STATUS("!- %s %3i %3i %3i %5.2Lf %5.2Lf %5.2Lf"
- " -> %10.2Le %10.2Le"
- " -> %10.2Le %10.2e\n", str, h, k, l,
- vals[0][i], vals[1][i], vals[2][i],
- grad1, grad2, grad, cgrad);
+ get_partial(refl, &r1, &r2, &p, &cl, &ch);
+
+ if ( (fabs(cgrad) > 1e-9) &&
+ !within_tolerance(grad, cgrad, 10.0) )
+ {
+ STATUS("!- %s %3i %3i %3i"
+ " %10.2Le %10.2e ratio = %5.2Lf"
+ " %10.2e %10.2e\n",
+ str, h, k, l, grad, cgrad, cgrad/grad,
+ r1, r2);
} else {
- //STATUS("OK %s %5.2f %5.2f %5.2f"
- // " -> %10.2Le %10.2Le"
- // " -> %10.2Le %10.2e\n", str,
- // vals[0][i], vals[1][i], vals[2][i],
- // grad1, grad2, grad, cgrad);
- n_acc++;
+ //STATUS("OK %s %3i %3i %3i"
+ // " %10.2Le %10.2e ratio = %5.2Lf"
+ // " %10.2e %10.2e\n",
+ // str, h, k, l, grad, cgrad, cgrad/grad,
+ // r1, r2);
+ n_acc++;
}
}