aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-24 23:18:38 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:30 +0100
commit2647123048344846f4a245cd03b728666b7ad1da (patch)
tree032f9064cffaa389a4c851a7a282c3a9d6141a1f /tests
parent630282801f347c23de7edcf0a0ba639032bb845c (diff)
Write out a file of wrongness
Diffstat (limited to 'tests')
-rw-r--r--tests/pr_gradient_check.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pr_gradient_check.c b/tests/pr_gradient_check.c
index 36fe19ca..1dce7311 100644
--- a/tests/pr_gradient_check.c
+++ b/tests/pr_gradient_check.c
@@ -128,6 +128,7 @@ static int test_gradients(struct image *image, double incr_val, int refine,
int *valid;
int nref;
int n_acc, n_valid;
+ FILE *fh;
image->reflections = find_intersections(image, image->indexed_cell);
@@ -157,6 +158,8 @@ static int test_gradients(struct image *image, double incr_val, int refine,
calc_either_side(image, incr_val, valid, vals, refine);
+ fh = fopen("wrongness.dat", "w+");
+
n_valid = nref; n_acc = 0;
i = 0;
for ( refl = first_refl(image->reflections, &iter);
@@ -176,6 +179,10 @@ static int test_gradients(struct image *image, double incr_val, int refine,
double r1, r2, p;
int cl, ch;
+ double tt, dstar;
+
+ dstar = 2.0 * resolution(image->indexed_cell, h, k, l),
+ tt = 2.0*asin(image->lambda/(2.0/dstar));
grad1 = (vals[1][i] - vals[0][i]) / incr_val;
grad2 = (vals[2][i] - vals[1][i]) / incr_val;
@@ -203,6 +210,10 @@ static int test_gradients(struct image *image, double incr_val, int refine,
n_acc++;
}
+ fprintf(fh, "%e %f\n",
+ //resolution(image->indexed_cell, h, k, l),
+ rad2deg(tt), fabs((grad-cgrad)/grad));
+
}
i++;
@@ -211,6 +222,7 @@ static int test_gradients(struct image *image, double incr_val, int refine,
STATUS("%s: %i out of %i valid gradients were accurate.\n",
str, n_acc, n_valid);
+ fclose(fh);
if ( n_acc != n_valid ) return 1;