From 2600c19c6d9b994de1cb2d5e634571a55434c707 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 23 Oct 2009 11:30:39 +0200 Subject: Initial fork from template_index to pattern_sim --- src/Makefile.am | 13 ++----- src/cell.c | 2 +- src/cell.h | 2 +- src/hdf5-file.c | 2 +- src/hdf5-file.h | 2 +- src/image.c | 2 +- src/image.h | 2 +- src/main.c | 109 ++++++++++++++++++++++++---------------------------- src/relrod.c | 2 +- src/relrod.h | 2 +- src/sim-main.c | 116 -------------------------------------------------------- src/templates.c | 2 +- src/templates.h | 2 +- src/utils.c | 2 +- src/utils.h | 2 +- 15 files changed, 66 insertions(+), 196 deletions(-) delete mode 100644 src/sim-main.c (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 40a39194..d30736c7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,5 @@ -bin_PROGRAMS = template_index simulate_patterns +bin_PROGRAMS = pattern_sim -template_index_SOURCES = main.c relrod.c utils.c image.c cell.c hdf5-file.c \ - templates.c -template_index_LDADD = @LIBS@ -lm -lgsl -lgslcblas -AM_CFLAGS = -Wall -g - -simulate_patterns_SOURCES = sim-main.c relrod.c utils.c image.c cell.c \ - hdf5-file.c templates.c -simulate_patterns_LDADD = @LIBS@ -lm -lgsl -lgslcblas +pattern_sim_SOURCES = main.c relrod.c utils.c image.c cell.c hdf5-file.c \ + templates.c +pattern_sim_LDADD = @LIBS@ -lm -lgsl -lgslcblas diff --git a/src/cell.c b/src/cell.c index 7f726fab..5e8b1ce6 100644 --- a/src/cell.c +++ b/src/cell.c @@ -5,7 +5,7 @@ * * (c) 2007-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/cell.h b/src/cell.h index 196b9521..b2203561 100644 --- a/src/cell.h +++ b/src/cell.h @@ -5,7 +5,7 @@ * * (c) 2007-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 46538c76..ca1d5450 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/hdf5-file.h b/src/hdf5-file.h index c288d4cd..a263368a 100644 --- a/src/hdf5-file.h +++ b/src/hdf5-file.h @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/image.c b/src/image.c index b7cf4c31..874d1f4a 100644 --- a/src/image.c +++ b/src/image.c @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/image.h b/src/image.h index 41e6e2b6..c596abfe 100644 --- a/src/image.h +++ b/src/image.h @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/main.c b/src/main.c index 967fbb58..04f806f2 100644 --- a/src/main.c +++ b/src/main.c @@ -1,11 +1,9 @@ /* * main.c * - * "Main" - * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ @@ -20,11 +18,15 @@ #include #include -#include "cell.h" #include "image.h" +#include "relrod.h" +#include "cell.h" #include "utils.h" #include "hdf5-file.h" -#include "templates.h" + + +/* Crystal size in metres */ +#define CRYSTAL_SIZE (500.0e-9) static void main_show_help(const char *s) @@ -37,13 +39,11 @@ static void main_show_help(const char *s) int main(int argc, char *argv[]) { - int c; - char **in_files; - size_t nin; - size_t i; + int c, i; UnitCell *cell; - TemplateList *templates; - struct image template_parameters; + struct image image; + int nrefl; + float t; while ((c = getopt(argc, argv, "h")) != -1) { @@ -58,17 +58,6 @@ int main(int argc, char *argv[]) } - if ( optind < argc ) { - nin = argc-optind; - in_files = malloc(nin*sizeof(char *)); - for ( i=0; ix; + y = f->y; /* Discards digits after the decimal point */ + + image.data[y*image.width+x] = 1; + + } - printf("%+8.2f %+8.2f deg\n", rad2deg(image.omega), - rad2deg(image.tilt)); + /* Write the output file */ + snprintf(filename, 32, "simulated-%.0f.h5", t); + hdf5_write(filename, image.data, image.width, image.height); } diff --git a/src/relrod.c b/src/relrod.c index f9ae68c9..7ee4dfe3 100644 --- a/src/relrod.c +++ b/src/relrod.c @@ -5,7 +5,7 @@ * * (c) 2007-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/relrod.h b/src/relrod.h index 9bb1762a..7d35cf60 100644 --- a/src/relrod.h +++ b/src/relrod.h @@ -5,7 +5,7 @@ * * (c) 2007-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/sim-main.c b/src/sim-main.c deleted file mode 100644 index c316987f..00000000 --- a/src/sim-main.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * sim-main.c - * - * Simulate test data - * - * (c) 2006-2009 Thomas White - * - * template_index - Indexing diffraction patterns by template matching - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "image.h" -#include "relrod.h" -#include "cell.h" -#include "utils.h" -#include "hdf5-file.h" - - -/* Crystal size in metres */ -#define CRYSTAL_SIZE (500.0e-9) - - -static void main_show_help(const char *s) -{ - printf("Syntax: %s [...]\n\n", s); - printf("Index diffraction patterns\n\n"); - printf(" -h Display this help message\n"); -} - - -int main(int argc, char *argv[]) -{ - int c, i; - UnitCell *cell; - struct image image; - int nrefl; - float t; - - while ((c = getopt(argc, argv, "h")) != -1) { - - switch ( c ) { - - case 'h' : { - main_show_help(argv[0]); - return 0; - } - - } - - } - - /* Define unit cell */ - cell = cell_new_from_parameters(28.10e-9, - 28.10e-9, - 16.52e-9, - deg2rad(90.0), - deg2rad(90.0), - deg2rad(120.0)); - - /* Define image parameters */ - image.width = 512; - image.height = 512; - image.omega = deg2rad(40.0); - image.fmode = FORMULATION_CLEN; - image.x_centre = 255.5; - image.y_centre = 255.5; - image.camera_len = 0.2; /* 20 cm */ - image.resolution = 5120; /* 512 pixels in 10 cm */ - image.lambda = 0.2e-9; /* LCLS wavelength */ - image.data = malloc(512*512*2); - - for ( t=0.0; t<180.0; t+=10.0 ) { - - char filename[32]; - - memset(image.data, 0, 512*512*2); - image.tilt = deg2rad(t); - - /* Calculate reflections */ - get_reflections(&image, cell, 1.0/CRYSTAL_SIZE); - - /* Construct the image */ - nrefl = image_feature_count(image.rflist); - for ( i=0; ix; - y = f->y; /* Discards digits after the decimal point */ - - image.data[y*image.width+x] = 1; - - } - - /* Write the output file */ - snprintf(filename, 32, "simulated-%.0f.h5", t); - hdf5_write(filename, image.data, image.width, image.height); - - } - - return 0; -} diff --git a/src/templates.c b/src/templates.c index 632e5a9f..1ad1c95a 100644 --- a/src/templates.c +++ b/src/templates.c @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/templates.h b/src/templates.h index c4b66171..c9d053ad 100644 --- a/src/templates.h +++ b/src/templates.h @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/utils.c b/src/utils.c index 0c7d7ad4..38855671 100644 --- a/src/utils.c +++ b/src/utils.c @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ diff --git a/src/utils.h b/src/utils.h index ef37bc73..a60abe7e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -5,7 +5,7 @@ * * (c) 2006-2009 Thomas White * - * template_index - Indexing diffraction patterns by template matching + * pattern_sim - Simulate diffraction patterns from small crystals * */ -- cgit v1.2.3