aboutsummaryrefslogtreecommitdiff
path: root/tests/polarisation_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-06-10 15:34:22 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commitc8693a9af33849be40a94e9c437d87c068fce740 (patch)
tree957369f29f0d557f954d13500deb1e9d33ae4529 /tests/polarisation_check.c
parent9de2a50dea4c81cc728bd61a678c074dbe702e2d (diff)
Update tests for detgeom
Diffstat (limited to 'tests/polarisation_check.c')
-rw-r--r--tests/polarisation_check.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/tests/polarisation_check.c b/tests/polarisation_check.c
index f8660e32..dcad4304 100644
--- a/tests/polarisation_check.c
+++ b/tests/polarisation_check.c
@@ -7,7 +7,7 @@
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2019 Thomas White <taw@physics.org>
+ * 2019-2020 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -71,43 +71,30 @@ int main(int argc, char *argv[])
}
fclose(fh);
- image.beam = NULL;
image.lambda = ph_eV_to_lambda(9000.0);
image.bw = 0.000001;
image.div = 0.0;
image.spectrum = spectrum_generate_gaussian(image.lambda, image.bw);
- image.det = calloc(1, sizeof(struct detector));
- image.det->n_panels = 1;
- image.det->panels = calloc(1, sizeof(struct panel));
+ image.detgeom = calloc(1, sizeof(struct detgeom));
+ image.detgeom->n_panels = 1;
+ image.detgeom->panels = calloc(1, sizeof(struct detgeom_panel));
image.dp = calloc(1, sizeof(float *));
image.bad = calloc(1, sizeof(int *));
- image.det->panels[0].w = w;
- image.det->panels[0].h = h;
- image.det->panels[0].fsx = 1.0;
- image.det->panels[0].fsy = 0.0;
- image.det->panels[0].ssx = 0.0;
- image.det->panels[0].ssy = 1.0;
- image.det->panels[0].xfs = 1.0;
- image.det->panels[0].yfs = 0.0;
- image.det->panels[0].xss = 0.0;
- image.det->panels[0].yss = 1.0;
- image.det->panels[0].cnx = -w/2;
- image.det->panels[0].cny = -h/2;
- image.det->panels[0].clen = 50.0e-3;
- image.det->panels[0].res = 10000; /* 10 micron pixels */
- image.det->panels[0].adu_per_eV = 10.0/9000.0; /* 10 adu/ph */
- image.det->panels[0].max_adu = +INFINITY; /* No cutoff */
- image.det->panels[0].orig_min_fs = 0;
- image.det->panels[0].orig_min_ss = 0;
- image.det->panels[0].orig_max_fs = w-1;
- image.det->panels[0].orig_max_ss = h-1;
-
- image.det->furthest_out_panel = &image.det->panels[0];
- image.det->furthest_out_fs = 0;
- image.det->furthest_out_ss = 0;
+ image.detgeom->panels[0].w = w;
+ image.detgeom->panels[0].h = h;
+ image.detgeom->panels[0].fsx = 1.0;
+ image.detgeom->panels[0].fsy = 0.0;
+ image.detgeom->panels[0].ssx = 0.0;
+ image.detgeom->panels[0].ssy = 1.0;
+ image.detgeom->panels[0].cnx = -w/2;
+ image.detgeom->panels[0].cny = -h/2;
+ image.detgeom->panels[0].cnz = 50.0e-3 / 10e-6;
+ image.detgeom->panels[0].pixel_pitch = 10e-6;
+ image.detgeom->panels[0].adu_per_photon = 1.0;
+ image.detgeom->panels[0].max_adu = +INFINITY; /* No cutoff */
image.dp[0] = malloc(w*h*sizeof(float));
memset(image.dp[0], 0, w*h*sizeof(float));
@@ -143,7 +130,8 @@ int main(int argc, char *argv[])
ncell = cell_rotate(cell, random_quaternion(rng));
crystal_set_cell(cr, ncell);
- list = predict_to_res(cr, largest_q(&image));
+ list = predict_to_res(cr, detgeom_max_resolution(image.detgeom,
+ image.lambda));
crystal_set_reflections(cr, list);
for ( refl = first_refl(list, &iter);
@@ -183,11 +171,9 @@ int main(int argc, char *argv[])
image.dp[0][i] = 1000.0 * map[i] / nmap[i];
if ( isnan(image.dp[0][i]) ) image.dp[0][i] = 0.0;
}
- hdf5_write_image("test.h5", &image, "/data/data");
+ //hdf5_write_image("test.h5", &image, "/data/data");
- free(image.beam);
- free(image.det->panels);
- free(image.det);
+ detgeom_free(image.detgeom);
free(image.dp[0]);
free(image.dp);
gsl_rng_free(rng);