aboutsummaryrefslogtreecommitdiff
path: root/tests/prediction_gradient_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-03-17 16:33:19 +0100
committerThomas White <taw@physics.org>2015-04-20 15:50:39 +0200
commitf34e7e9ee45fedbd7d5a65c0732e91d69f92929e (patch)
tree260b721c98b8f9273b1d84f5eb8cdf253f7f9526 /tests/prediction_gradient_check.c
parent83e259f5ab54c848e80c33060a48dea379d38f6f (diff)
Split x and y terms in residual
Diffstat (limited to 'tests/prediction_gradient_check.c')
-rw-r--r--tests/prediction_gradient_check.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/prediction_gradient_check.c b/tests/prediction_gradient_check.c
index 15b4d803..953d5fde 100644
--- a/tests/prediction_gradient_check.c
+++ b/tests/prediction_gradient_check.c
@@ -85,7 +85,11 @@ static void scan(RefList *reflections, RefList *compare,
break;
case 1 :
- vals[idx][i] = xh + yh;
+ vals[idx][i] = xh;
+ break;
+
+ case 2 :
+ vals[idx][i] = yh;
break;
}
@@ -290,10 +294,17 @@ static double test_gradients(Crystal *cr, double incr_val, int refine,
rp.peak = &pk;
rp.panel = &image->det->panels[0];
- cgrad = pos_gradient(refine, &rp,
- crystal_get_image(cr)->det,
- crystal_get_image(cr)->lambda,
- crystal_get_cell(cr));
+ if ( checkrxy == 1 ) {
+ cgrad = x_gradient(refine, &rp,
+ crystal_get_image(cr)->det,
+ crystal_get_image(cr)->lambda,
+ crystal_get_cell(cr));
+ } else {
+ cgrad = y_gradient(refine, &rp,
+ crystal_get_image(cr)->det,
+ crystal_get_image(cr)->lambda,
+ crystal_get_cell(cr));
+ }
}
get_partial(refl, &r1, &r2, &p);
@@ -431,7 +442,7 @@ int main(int argc, char *argv[])
rng = gsl_rng_alloc(gsl_rng_mt19937);
- for ( checkrxy=1; checkrxy<2; checkrxy++ ) {
+ for ( checkrxy=0; checkrxy<3; checkrxy++ ) {
switch ( checkrxy ) {
@@ -439,9 +450,12 @@ int main(int argc, char *argv[])
STATUS("Excitation error:\n");
break;
case 1:
- STATUS("x+y coordinate:\n");
+ STATUS("x coordinate:\n");
break;
default:
+ case 2:
+ STATUS("y coordinate:\n");
+ break;
STATUS("WTF??\n");
break;
}