diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration_check.c | 16 | ||||
-rw-r--r-- | tests/pr_p_gradient_check.c | 4 | ||||
-rw-r--r-- | tests/prediction_gradient_check.c | 8 | ||||
-rw-r--r-- | tests/prof2d_check.c | 6 | ||||
-rw-r--r-- | tests/ring_check.c | 58 |
5 files changed, 41 insertions, 51 deletions
diff --git a/tests/integration_check.c b/tests/integration_check.c index 10989cbb..0713d837 100644 --- a/tests/integration_check.c +++ b/tests/integration_check.c @@ -3,7 +3,11 @@ * * Check reflection integration * - * Copyright © 2013 Thomas White <taw@physics.org> + * Copyright © 2013-2016 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. + * + * Authors: + * 2013-2016 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -72,10 +76,6 @@ int main(int argc, char *argv[]) image.det->n_panels = 1; image.det->panels = calloc(1, sizeof(struct panel)); - image.det->panels[0].min_fs = 0; - image.det->panels[0].max_fs = w; - image.det->panels[0].min_ss = 0; - image.det->panels[0].max_ss = h; image.det->panels[0].w = w; image.det->panels[0].h = h; image.det->panels[0].fsx = 1.0; @@ -90,11 +90,10 @@ int main(int argc, char *argv[]) image.det->panels[0].cny = -h/2; image.det->panels[0].clen = 60.0e-3; image.det->panels[0].res = 100000; /* 10 px per mm */ - image.det->panels[0].adu_per_eV = 10.0/9000.0; /* 10 adu/ph */ + image.det->panels[0].adu_per_eV = NAN; + image.det->panels[0].adu_per_photon = 10; image.det->panels[0].max_adu = +INFINITY; /* No cutoff */ - image.width = w; - image.height = h; image.dp = malloc(sizeof(float *)); image.dp[0] = malloc(w*h*sizeof(float)); memset(image.dp[0], 0, w*h*sizeof(float)); @@ -121,6 +120,7 @@ int main(int argc, char *argv[]) list = reflist_new(); refl = add_refl(list, 0, 0, 0); set_detector_pos(refl, 64, 64); + set_panel(refl, &image.det->panels[0]); cell = cell_new(); cell_set_lattice_type(cell, L_CUBIC); cell_set_centering(cell, 'P'); diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c index 17709741..9c2a6633 100644 --- a/tests/pr_p_gradient_check.c +++ b/tests/pr_p_gradient_check.c @@ -411,9 +411,7 @@ int main(int argc, char *argv[]) } - image.width = 1024; - image.height = 1024; - image.det = simple_geometry(&image); + image.det = simple_geometry(&image, 1024, 1024); image.det->panels[0].res = 13333.3; image.det->panels[0].clen = 80e-3; image.det->panels[0].coffset = 0.0; diff --git a/tests/prediction_gradient_check.c b/tests/prediction_gradient_check.c index 0ab8a2ec..b9f23217 100644 --- a/tests/prediction_gradient_check.c +++ b/tests/prediction_gradient_check.c @@ -3,11 +3,11 @@ * * Check partiality gradients for prediction refinement * - * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2012-2015 Thomas White <taw@physics.org> + * 2012-2016 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -418,9 +418,7 @@ int main(int argc, char *argv[]) } - image.width = 1024; - image.height = 1024; - image.det = simple_geometry(&image); + image.det = simple_geometry(&image, 1024, 1024); image.det->panels[0].res = 13333.3; image.det->panels[0].clen = 80e-3; image.det->panels[0].coffset = 0.0; diff --git a/tests/prof2d_check.c b/tests/prof2d_check.c index e0534710..8081748c 100644 --- a/tests/prof2d_check.c +++ b/tests/prof2d_check.c @@ -89,12 +89,6 @@ int main(int argc, char *argv[]) image.dp = calloc(1, sizeof(float *)); image.bad = calloc(1, sizeof(int *)); - image.width = w; - image.height = h; - image.det->panels[0].min_fs = 0; - image.det->panels[0].max_fs = w; - image.det->panels[0].min_ss = 0; - image.det->panels[0].max_ss = h; image.det->panels[0].w = w; image.det->panels[0].h = h; image.det->panels[0].fsx = 1.0; diff --git a/tests/ring_check.c b/tests/ring_check.c index 99c433c2..25c0045c 100644 --- a/tests/ring_check.c +++ b/tests/ring_check.c @@ -3,11 +3,11 @@ * * Check peak integration * - * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2011-2014 Thomas White <taw@physics.org> + * 2011-2016 Thomas White <taw@physics.org> * 2012 Andrew Martin <andrew.martin@desy.de> * * This file is part of CrystFEL. @@ -60,15 +60,16 @@ static void third_integration_check(struct image *image, int n_trials, double fsp, ssp; int r; - for ( fs=0; fs<image->width; fs++ ) { - for ( ss=0; ss<image->height; ss++ ) { - image->dp[0][fs+image->width*ss] + for ( fs=0; fs<image->det->panels[0].w; fs++ ) { + for ( ss=0; ss<image->det->panels[0].h; ss++ ) { + image->dp[0][fs+image->det->panels[0].w*ss] = poisson_noise(rng, 1000.0); } } - r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0, NULL); + r = integrate_peak(image, 64, 64, &image->det->panels[0], + &fsp, &ssp, &intensity, &sigma, + 10.0, 15.0, 17.0, NULL); if ( r == 0 ) { mean_intensity += intensity; @@ -118,9 +119,9 @@ static void fourth_integration_check(struct image *image, int n_trials, double fsp, ssp; int r; - for ( fs=0; fs<image->width; fs++ ) { - for ( ss=0; ss<image->height; ss++ ) { - int idx = fs+image->width*ss; + for ( fs=0; fs<image->det->panels[0].w; fs++ ) { + for ( ss=0; ss<image->det->panels[0].h; ss++ ) { + int idx = fs+image->det->panels[0].w*ss; image->dp[0][idx] = poisson_noise(rng, 1000.0); if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 9*9 ) continue; image->dp[0][idx] += 1000.0; @@ -128,8 +129,9 @@ static void fourth_integration_check(struct image *image, int n_trials, } } - r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0, NULL); + r = integrate_peak(image, 64, 64, &image->det->panels[0], + &fsp, &ssp, &intensity, &sigma, + 10.0, 15.0, 17.0, NULL); if ( r == 0 ) { mean_intensity += intensity; @@ -189,10 +191,6 @@ int main(int argc, char *argv[]) image.det->n_panels = 1; image.det->panels = calloc(1, sizeof(struct panel)); - image.det->panels[0].min_fs = 0; - image.det->panels[0].max_fs = 127; - image.det->panels[0].min_ss = 0; - image.det->panels[0].max_ss = 127; image.det->panels[0].fsx = 1.0; image.det->panels[0].fsy = 0.0; image.det->panels[0].ssx = 0.0; @@ -207,18 +205,18 @@ int main(int argc, char *argv[]) image.det->panels[0].res = 1.0; image.det->panels[0].w = 128; image.det->panels[0].h = 128; - image.det->panels[0].adu_per_eV = 1.0/1000.0; /* -> 1 adu per photon */ + image.det->panels[0].adu_per_eV = NAN; + image.det->panels[0].adu_per_photon = 1.0; image.det->panels[0].max_adu = +INFINITY; /* No cutoff */ - image.width = 128; - image.height = 128; memset(image.dp[0], 0, 128*128*sizeof(float)); image.n_crystals = 0; image.crystals = NULL; /* First check: no intensity -> no peak, or very low intensity */ - r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, + r = integrate_peak(&image, 64, 64, &image.det->panels[0], + &fsp, &ssp, &intensity, &sigma, 10.0, 15.0, 17.0, NULL); STATUS(" First check: integrate_peak() returned %i", r); if ( r == 0 ) { @@ -236,15 +234,16 @@ int main(int argc, char *argv[]) /* Second check: uniform peak gives correct I and low sigma(I) */ npx = 0; - for ( fs=0; fs<image.width; fs++ ) { - for ( ss=0; ss<image.height; ss++ ) { + for ( fs=0; fs<image.det->panels[0].w; fs++ ) { + for ( ss=0; ss<image.det->panels[0].h; ss++ ) { if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 9*9 ) continue; - image.dp[0][fs+image.width*ss] = 1000.0; + image.dp[0][fs+image.det->panels[0].w*ss] = 1000.0; npx++; } } - r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, + r = integrate_peak(&image, 64, 64, &image.det->panels[0], + &fsp, &ssp, &intensity, &sigma, 10.0, 15.0, 17.0, NULL); if ( r ) { ERROR(" Second check: integrate_peak() returned %i (wrong).\n", @@ -277,16 +276,17 @@ int main(int argc, char *argv[]) /* Fifth check: uniform peak on uniform background */ npx = 0; - for ( fs=0; fs<image.width; fs++ ) { - for ( ss=0; ss<image.height; ss++ ) { - image.dp[0][fs+image.width*ss] = 1000.0; + for ( fs=0; fs<image.det->panels[0].w; fs++ ) { + for ( ss=0; ss<image.det->panels[0].h; ss++ ) { + image.dp[0][fs+image.det->panels[0].w*ss] = 1000.0; if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 9*9 ) continue; - image.dp[0][fs+image.width*ss] += 1000.0; + image.dp[0][fs+image.det->panels[0].w*ss] += 1000.0; npx++; } } - r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, + r = integrate_peak(&image, 64, 64, &image.det->panels[0], + &fsp, &ssp, &intensity, &sigma, 10.0, 15.0, 17.0, NULL); if ( r ) { ERROR(" Fifth check: integrate_peak() returned %i (wrong).\n", |