diff options
author | Thomas White <taw@physics.org> | 2016-11-10 17:02:14 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-02-27 17:12:41 +0100 |
commit | ea1178d014eadb9fe8e24935693a5380b709ef33 (patch) | |
tree | 39ae4995a2da892917d7796e0f36e5568da1cea0 /tests | |
parent | 77cf2edd09bb01ae331935f467064c751f6e338e (diff) |
New partiality model from Ginn et al.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pr_p_gradient_check.c | 25 | ||||
-rw-r--r-- | tests/prediction_gradient_check.c | 22 |
2 files changed, 16 insertions, 31 deletions
diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c index 5322fcca..b9da05bc 100644 --- a/tests/pr_p_gradient_check.c +++ b/tests/pr_p_gradient_check.c @@ -59,7 +59,7 @@ static void scan_partialities(RefList *reflections, RefList *compare, { signed int h, k, l; Reflection *refl2; - double rlow, rhigh, p; + double p; get_indices(refl, &h, &k, &l); refl2 = find_refl(compare, h, k, l); @@ -69,7 +69,7 @@ static void scan_partialities(RefList *reflections, RefList *compare, continue; } - get_partial(refl2, &rlow, &rhigh, &p); + p = get_partiality(refl2); vals[idx][i] = p; if ( unlikely(p < 0.0) ) { ERROR("Negative partiality! %3i %3i %3i %f\n", @@ -306,8 +306,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, i++; } else { - double r1, r2, p; - grad1 = (vals[1][i] - vals[0][i]) / incr_val; grad2 = (vals[2][i] - vals[1][i]) / incr_val; grad = (grad1 + grad2) / 2.0; @@ -315,8 +313,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, cgrad = gradient(cr, refine, refl, pmodel); - get_partial(refl, &r1, &r2, &p); - if ( isnan(cgrad) ) { n_nan++; continue; @@ -343,11 +339,11 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, { if ( !quiet ) { - STATUS("!- %s %3i %3i %3i" - " %10.2Le %10.2e ratio = %5.2Lf" - " %10.2e %10.2e\n", + STATUS("!- %s %3i %3i %3i " + "%10.2Le %10.2e " + "ratio = %5.2Lf\n", str, h, k, l, grad, cgrad, - cgrad/grad, r1, r2); + cgrad/grad); } n_bad++; @@ -447,18 +443,15 @@ int main(int argc, char *argv[]) rng = gsl_rng_alloc(gsl_rng_mt19937); - for ( i=0; i<2; i++ ) { + for ( i=0; i<1; i++ ) { UnitCell *rot; double val; PartialityModel pmodel; if ( i == 0 ) { - pmodel = PMODEL_SCSPHERE; - STATUS("Testing SCSphere model:\n"); - } else if ( i == 1 ) { - pmodel = PMODEL_SCGAUSSIAN; - STATUS("Testing SCGaussian model.\n"); + pmodel = PMODEL_XSPHERE; + STATUS("Testing XSphere model:\n"); } else { ERROR("WTF?\n"); return 1; diff --git a/tests/prediction_gradient_check.c b/tests/prediction_gradient_check.c index 0ffc07ca..85d61ead 100644 --- a/tests/prediction_gradient_check.c +++ b/tests/prediction_gradient_check.c @@ -73,7 +73,6 @@ static void scan(RefList *reflections, RefList *compare, { signed int h, k, l; Reflection *refl2; - double rlow, rhigh, p; double fs, ss, xh, yh; struct panel *panel; @@ -85,7 +84,6 @@ static void scan(RefList *reflections, RefList *compare, continue; } - get_partial(refl2, &rlow, &rhigh, &p); get_detector_pos(refl2, &fs, &ss); panel = get_panel(refl2); twod_mapping(fs, ss, &xh, &yh, panel); @@ -93,7 +91,7 @@ static void scan(RefList *reflections, RefList *compare, switch ( checkrxy ) { case 0 : - vals[idx][i] = (rlow + rhigh)/2.0; + vals[idx][i] = get_exerr(refl2); break; case 1 : @@ -279,8 +277,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, i++; } else { - double r1, r2, p; - grad1 = (vals[1][i] - vals[0][i]) / incr_val; grad2 = (vals[2][i] - vals[1][i]) / incr_val; grad = (grad1 + grad2) / 2.0; @@ -300,18 +296,14 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, if ( checkrxy == 1 ) { cgrad = x_gradient(refine, refl, crystal_get_cell(cr), - &image->det->panels[0], - crystal_get_image(cr)->lambda); + &image->det->panels[0]); } else { cgrad = y_gradient(refine, refl, crystal_get_cell(cr), - &image->det->panels[0], - crystal_get_image(cr)->lambda); + &image->det->panels[0]); } } - get_partial(refl, &r1, &r2, &p); - if ( isnan(cgrad) ) { n_nan++; continue; @@ -338,11 +330,11 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, { if ( !quiet ) { - STATUS("!- %s %3i %3i %3i" - " %10.2Le %10.2e ratio = %5.2Lf" - " %10.2e %10.2e\n", + STATUS("!- %s %3i %3i %3i " + "%10.2Le %10.2e " + "ratio = %5.2Lf\n", str, h, k, l, grad, cgrad, - cgrad/grad, r1, r2); + cgrad/grad); } n_bad++; |