aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-09-05 12:31:04 +0200
committerThomas White <taw@physics.org>2014-09-05 12:44:44 +0200
commitf5a13135c61f6e86ebc5be8afabdf4dd5a8c629e (patch)
treef978349a2bfd173309eff2c67245d99cb1edaa9e /tests
parent0f1b53ccc75ea810e32254282981e95242e1c8ad (diff)
tests/ring_check: Fix after reverting use of image.dp[]
Diffstat (limited to 'tests')
-rw-r--r--tests/ring_check.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/ring_check.c b/tests/ring_check.c
index 9e70801a..10299fe0 100644
--- a/tests/ring_check.c
+++ b/tests/ring_check.c
@@ -63,7 +63,7 @@ static void third_integration_check(struct image *image, int n_trials,
for ( fs=0; fs<image->width; fs++ ) {
for ( ss=0; ss<image->height; ss++ ) {
- image->dp[0][fs+image->width*ss]
+ image->data[fs+image->width*ss]
= poisson_noise(rng, 1000.0);
}
}
@@ -122,9 +122,9 @@ static void fourth_integration_check(struct image *image, int n_trials,
for ( fs=0; fs<image->width; fs++ ) {
for ( ss=0; ss<image->height; ss++ ) {
int idx = fs+image->width*ss;
- image->dp[0][idx] = poisson_noise(rng, 1000.0);
+ image->data[idx] = poisson_noise(rng, 1000.0);
if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 9*9 ) continue;
- image->dp[0][idx] += 1000.0;
+ image->data[idx] += 1000.0;
pcount++;
}
}
@@ -171,7 +171,6 @@ int main(int argc, char *argv[])
int r, npx;
double ex;
gsl_rng *rng;
- float *dp;
int *bad;
rng = gsl_rng_alloc(gsl_rng_mt19937);
@@ -181,8 +180,7 @@ int main(int argc, char *argv[])
fclose(fh);
gsl_rng_set(rng, seed);
- dp = calloc(128*128, sizeof(float));
- image.dp = &dp;
+ image.data = malloc(128*128*sizeof(float));
bad = calloc(128*128, sizeof(int));
image.bad = &bad;
image.flags = NULL;
@@ -197,8 +195,6 @@ int main(int argc, char *argv[])
image.det->panels[0].max_fs = 128;
image.det->panels[0].min_ss = 0;
image.det->panels[0].max_ss = 128;
- image.det->panels[0].w = 128;
- image.det->panels[0].h = 128;
image.det->panels[0].fsx = 1.0;
image.det->panels[0].fsy = 0.0;
image.det->panels[0].ssx = 0.0;
@@ -216,6 +212,7 @@ int main(int argc, char *argv[])
image.width = 128;
image.height = 128;
+ memset(image.data, 0, 128*128*sizeof(float));
image.n_crystals = 0;
image.crystals = NULL;
@@ -242,7 +239,7 @@ int main(int argc, char *argv[])
for ( fs=0; fs<image.width; fs++ ) {
for ( ss=0; ss<image.height; ss++ ) {
if ( (fs-64)*(fs-64) + (ss-64)*(ss-64) > 9*9 ) continue;
- image.dp[0][fs+image.width*ss] = 1000.0;
+ image.data[fs+image.width*ss] = 1000.0;
npx++;
}
}
@@ -282,9 +279,9 @@ int main(int argc, char *argv[])
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;
+ image.data[fs+image.width*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.data[fs+image.width*ss] += 1000.0;
npx++;
}
}
@@ -314,11 +311,11 @@ int main(int argc, char *argv[])
}
+
free(image.beam);
free(image.det->panels);
free(image.det);
- free(image.dp[0]);
- free(image.bad[0]);
+ free(image.data);
gsl_rng_free(rng);
if ( fail ) return 1;