aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2008-08-13 14:46:04 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2008-08-13 14:46:04 +0000
commitb6b097dbefeb213f7171d1199bf2c11842706e73 (patch)
tree6a30d1a07e48fd8405ec1eb29e548837502f57d8
parenta695694114f4b52d8dd015e2376f4aee5d4074b4 (diff)
3D test diagnostic stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@289 bf6ca9ba-c028-0410-8290-897cf20841d1
-rw-r--r--src/refinetest3d.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/refinetest3d.c b/src/refinetest3d.c
index f7a8896..5d08e9e 100644
--- a/src/refinetest3d.c
+++ b/src/refinetest3d.c
@@ -38,51 +38,81 @@ static int check_cell(Basis *cell, Basis *cell_real) {
int fail;
+ printf(" Refinement Actual\n");
+ printf("---------------------------\n");
+ printf("ax %+8f %+8f\n", cell->a.x/1e9, cell_real->a.x/1e9);
+ printf("ay %+8f %+8f\n", cell->a.y/1e9, cell_real->a.y/1e9);
+ printf("az %+8f %+8f\n", cell->a.z/1e9, cell_real->a.z/1e9);
+ printf("bx %+8f %+8f\n", cell->b.x/1e9, cell_real->b.x/1e9);
+ printf("by %+8f %+8f\n", cell->b.y/1e9, cell_real->b.y/1e9);
+ printf("bz %+8f %+8f\n", cell->b.z/1e9, cell_real->b.z/1e9);
+ printf("cx %+8f %+8f\n", cell->c.x/1e9, cell_real->c.x/1e9);
+ printf("cy %+8f %+8f\n", cell->c.y/1e9, cell_real->c.y/1e9);
+ printf("cz %+8f %+8f\n", cell->c.z/1e9, cell_real->c.z/1e9);
+
fail = 0;
if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n",
cell->a.x/1e9, cell_real->a.x/1e9);
fail = 1;
+ } else {
+ printf("ax is OK.\n");
}
if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n",
cell->a.y/1e9, cell_real->a.y/1e9);
fail = 1;
+ } else {
+ printf("ay is OK.\n");
}
if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n",
cell->a.z/1e9, cell_real->a.z/1e9);
fail = 1;
+ } else {
+ printf("az is OK.\n");
}
if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n",
cell->b.x/1e9, cell_real->b.x/1e9);
fail = 1;
+ } else {
+ printf("bx is OK.\n");
}
if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n",
cell->b.y/1e9, cell_real->b.y/1e9);
fail = 1;
+ } else {
+ printf("by is OK.\n");
}
if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n",
cell->b.z/1e9, cell_real->b.z/1e9);
fail = 1;
+ } else {
+ printf("bz is OK.\n");
}
if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n",
cell->c.x/1e9, cell_real->c.x/1e9);
fail = 1;
+ } else {
+ printf("cx is OK.\n");
}
if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n",
cell->c.y/1e9, cell_real->c.y/1e9);
fail = 1;
+ } else {
+ printf("cy is OK.\n");
}
if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) {
fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n",
cell->c.z/1e9, cell_real->c.z/1e9);
fail = 1;
+ } else {
+ printf("cz is OK.\n");
}
return fail;
@@ -103,7 +133,7 @@ int main(int argc, char *argv[]) {
ctx->x_centre = 256;
ctx->y_centre = 256;
ctx->pixel_size = 5e7;
- image_add(ctx->images, NULL, 512, 512, deg2rad(0.0), ctx);
+ image_add(ctx->images, NULL, 512, 512, deg2rad(00.0), ctx);
ctx->images->images[0].features = image_feature_list_new();
image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx);
ctx->images->images[1].features = image_feature_list_new();
@@ -128,9 +158,9 @@ int main(int argc, char *argv[]) {
/* The "model" cell to be refined */
ctx->cell = malloc(sizeof(Basis));
- ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.0e9; ctx->cell->a.z = 0.0e9;
- ctx->cell->b.x = 0.0e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.0e9;
- ctx->cell->c.x = 0.0e9; ctx->cell->c.y = 0.0e9; ctx->cell->c.z = 5.0e9;
+ ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9;
+ ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9;
+ ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9;
ctx->cell->a.x += random_plusminus(0.1e9);
ctx->cell_lattice = reflection_list_from_cell(ctx->cell);
ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice);
@@ -151,6 +181,8 @@ int main(int argc, char *argv[]) {
if ( fail ) return 1;
+ printf("\n3D refinement test OK.\n");
+
return 0;
}