From e12bd3f7872cde18f096dce373002b63fa078448 Mon Sep 17 00:00:00 2001 From: taw27 Date: Fri, 25 Apr 2008 16:12:45 +0000 Subject: Move 'refinetest' to 'refinetest2d' in preparation for 'refinetest3d' git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@278 bf6ca9ba-c028-0410-8290-897cf20841d1 --- Makefile.am | 2 +- src/Makefile.am | 9 +++-- src/refinetest.c | 111 ----------------------------------------------------- src/refinetest2d.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 115 deletions(-) delete mode 100644 src/refinetest.c create mode 100644 src/refinetest2d.c diff --git a/Makefile.am b/Makefile.am index 3f6d2bf..3bd800e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,5 +3,5 @@ EXTRA_DIST = configure src/displaywindow.h src/trackball.h src/reflections.h src src/itrans-zaefferer.h src/itrans-stat.h src/mapping.h src/reproject.h src/prealign.h \ src/dirax.h src/image.h src/refine.h src/gtk-valuegraph.h src/intensities.h src/glbits.h src/gtk-valuegraph.h SUBDIRS = src data -TESTS = src/refinetest +TESTS = src/refinetest2d src/refinetest3d diff --git a/src/Makefile.am b/src/Makefile.am index ea94888..5b99a9f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,12 +1,15 @@ -bin_PROGRAMS = dtr refinetest +bin_PROGRAMS = dtr refinetest2d refinetest3d dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c cache.c \ itrans-threshold.c itrans-zaefferer.c itrans-stat.c control.c mapping.c reproject.c prealign.c basis.c \ dirax.c image.c refine.c gtk-valuegraph.c intensities.c glbits.c dtr_LDADD = @LIBS@ @GTK_LIBS@ -lm @GTKGLEXT_LIBS@ -lgsl -lgslcblas -lutil -refinetest_SOURCES = refinetest.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c -refinetest_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil +refinetest2d_SOURCES = refinetest2d.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c +refinetest2d_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil + +refinetest3d_SOURCES = refinetest3d.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c +refinetest3d_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil AM_CFLAGS = -Wall -g @CFLAGS@ @GTK_CFLAGS@ @GTKGLEXT_CFLAGS@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" diff --git a/src/refinetest.c b/src/refinetest.c deleted file mode 100644 index 870ac68..0000000 --- a/src/refinetest.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * refinectx.c - * - * Unit test for refinement procedure - * - * (c) 2007-2008 Thomas White - * - * dtr - Diffraction Tomography Reconstruction - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "basis.h" -#include "reflections.h" -#include "image.h" -#include "reproject.h" -#include "refine.h" -#include "utils.h" -#include "mapping.h" -#include "control.h" -#include "displaywindow.h" - -int main(int argc, char *argv[]) { - - ControlContext *ctx; - ReflectionList *reflections_real; - Basis *cell_real; - int fail; - - ctx = control_ctx_new(); - ctx->omega = deg2rad(0.0); - ctx->lambda = lambda(300.0e3); /* 300 keV */ - ctx->fmode = FORMULATION_PIXELSIZE; - ctx->x_centre = 256; - ctx->y_centre = 256; - ctx->pixel_size = 5e7; - image_add(ctx->images, NULL, 512, 512, deg2rad(0.0), ctx); - ctx->images->images[0].features = image_feature_list_new(); - - /* Fudge to avoid horrifying pointer-related death */ - ctx->dw = malloc(sizeof(DisplayWindow)); - ctx->dw->cur_image = 0; - - /* The "true" cell */ - cell_real = malloc(sizeof(Basis)); - cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; - cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; - cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; - /* The "real" reflections */ - reflections_real = reflection_list_from_cell(cell_real); - ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); -// printf("RT: %i test features generated.\n", ctx->images->images[0].features->n_features); - - /* The "model" cell to be refined */ - ctx->cell = malloc(sizeof(Basis)); - ctx->cell->a.x = 5.2e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.0e9; - ctx->cell->b.x = 0.2e9; ctx->cell->b.y = 4.8e9; 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_lattice = reflection_list_from_cell(ctx->cell); - ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); - reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); - - refine_do_cell(ctx); - image_feature_list_free(ctx->images->images[0].rflist); - reflection_list_from_new_cell(ctx->cell_lattice, ctx->cell); - ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); - - fail = 0; - if ( fabs(ctx->cell->a.x - cell_real->a.x) > 0.01e9 ) { - fprintf(stderr, "refinetest: ax not determined correctly\n"); - fail = 1; - } - if ( fabs(ctx->cell->a.y - cell_real->a.y) > 0.01e9 ) { - fprintf(stderr, "refinetest: ay not determined correctly\n"); - fail = 1; - } - if ( fabs(ctx->cell->b.x - cell_real->b.x) > 0.01e9 ) { - fprintf(stderr, "refinetest: bx not determined correctly\n"); - fail = 1; - } - if ( fabs(ctx->cell->b.y - cell_real->b.y) > 0.01e9 ) { - fprintf(stderr, "refinetest: by not determined correctly\n"); - fail = 1; - } - /* az, bz, cx, cy and cz are unconstrained hence will 'float' to meaningless values. - * This is ok. */ - - free(ctx); - - if ( fail ) return 1; - - return 0; - -} - -/* Dummy function stubs */ -#include "gtk-valuegraph.h" -void displaywindow_update_imagestack(DisplayWindow *dw) { }; -void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; -void displaywindow_update(DisplayWindow *dw) { }; -void displaywindow_error(const char *msg, DisplayWindow *dw) { }; -guint gtk_value_graph_get_type() { return 0; }; -GtkWidget *gtk_value_graph_new() { return NULL; }; -void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; - diff --git a/src/refinetest2d.c b/src/refinetest2d.c new file mode 100644 index 0000000..870ac68 --- /dev/null +++ b/src/refinetest2d.c @@ -0,0 +1,111 @@ +/* + * refinectx.c + * + * Unit test for refinement procedure + * + * (c) 2007-2008 Thomas White + * + * dtr - Diffraction Tomography Reconstruction + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "basis.h" +#include "reflections.h" +#include "image.h" +#include "reproject.h" +#include "refine.h" +#include "utils.h" +#include "mapping.h" +#include "control.h" +#include "displaywindow.h" + +int main(int argc, char *argv[]) { + + ControlContext *ctx; + ReflectionList *reflections_real; + Basis *cell_real; + int fail; + + ctx = control_ctx_new(); + ctx->omega = deg2rad(0.0); + ctx->lambda = lambda(300.0e3); /* 300 keV */ + ctx->fmode = FORMULATION_PIXELSIZE; + ctx->x_centre = 256; + ctx->y_centre = 256; + ctx->pixel_size = 5e7; + image_add(ctx->images, NULL, 512, 512, deg2rad(0.0), ctx); + ctx->images->images[0].features = image_feature_list_new(); + + /* Fudge to avoid horrifying pointer-related death */ + ctx->dw = malloc(sizeof(DisplayWindow)); + ctx->dw->cur_image = 0; + + /* The "true" cell */ + cell_real = malloc(sizeof(Basis)); + cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; + cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; + cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; + /* The "real" reflections */ + reflections_real = reflection_list_from_cell(cell_real); + ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); +// printf("RT: %i test features generated.\n", ctx->images->images[0].features->n_features); + + /* The "model" cell to be refined */ + ctx->cell = malloc(sizeof(Basis)); + ctx->cell->a.x = 5.2e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.0e9; + ctx->cell->b.x = 0.2e9; ctx->cell->b.y = 4.8e9; 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_lattice = reflection_list_from_cell(ctx->cell); + ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); + + refine_do_cell(ctx); + image_feature_list_free(ctx->images->images[0].rflist); + reflection_list_from_new_cell(ctx->cell_lattice, ctx->cell); + ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); + + fail = 0; + if ( fabs(ctx->cell->a.x - cell_real->a.x) > 0.01e9 ) { + fprintf(stderr, "refinetest: ax not determined correctly\n"); + fail = 1; + } + if ( fabs(ctx->cell->a.y - cell_real->a.y) > 0.01e9 ) { + fprintf(stderr, "refinetest: ay not determined correctly\n"); + fail = 1; + } + if ( fabs(ctx->cell->b.x - cell_real->b.x) > 0.01e9 ) { + fprintf(stderr, "refinetest: bx not determined correctly\n"); + fail = 1; + } + if ( fabs(ctx->cell->b.y - cell_real->b.y) > 0.01e9 ) { + fprintf(stderr, "refinetest: by not determined correctly\n"); + fail = 1; + } + /* az, bz, cx, cy and cz are unconstrained hence will 'float' to meaningless values. + * This is ok. */ + + free(ctx); + + if ( fail ) return 1; + + return 0; + +} + +/* Dummy function stubs */ +#include "gtk-valuegraph.h" +void displaywindow_update_imagestack(DisplayWindow *dw) { }; +void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; +void displaywindow_update(DisplayWindow *dw) { }; +void displaywindow_error(const char *msg, DisplayWindow *dw) { }; +guint gtk_value_graph_get_type() { return 0; }; +GtkWidget *gtk_value_graph_new() { return NULL; }; +void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; + -- cgit v1.2.3