From 541c05ac1979404e10e514653836cc29adfe7d02 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 3 May 2016 17:09:09 +0200 Subject: Remove slab-relative coordinates from tests --- tests/integration_check.c | 16 +++++------ tests/pr_p_gradient_check.c | 4 +-- tests/prediction_gradient_check.c | 8 ++---- tests/prof2d_check.c | 6 ---- tests/ring_check.c | 58 +++++++++++++++++++-------------------- 5 files changed, 41 insertions(+), 51 deletions(-) (limited to 'tests') 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 + * Copyright © 2013-2016 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. + * + * Authors: + * 2013-2016 Thomas White * * 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 + * 2012-2016 Thomas White * * 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 + * 2011-2016 Thomas White * 2012 Andrew Martin * * 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; fswidth; fs++ ) { - for ( ss=0; ssheight; ss++ ) { - image->dp[0][fs+image->width*ss] + for ( fs=0; fsdet->panels[0].w; fs++ ) { + for ( ss=0; ssdet->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; fswidth; fs++ ) { - for ( ss=0; ssheight; ss++ ) { - int idx = fs+image->width*ss; + for ( fs=0; fsdet->panels[0].w; fs++ ) { + for ( ss=0; ssdet->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; fspanels[0].w; fs++ ) { + for ( ss=0; sspanels[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; fspanels[0].w; fs++ ) { + for ( ss=0; sspanels[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", -- cgit v1.2.3