From 79fcc8f0938f0d8056b7b745eb96b89d133a571e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 22 Feb 2010 10:25:45 +0100 Subject: Add powder_plot program --- src/powder_plot.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/powder_plot.c (limited to 'src/powder_plot.c') diff --git a/src/powder_plot.c b/src/powder_plot.c new file mode 100644 index 00000000..3f0c1abd --- /dev/null +++ b/src/powder_plot.c @@ -0,0 +1,111 @@ +/* + * powder_plot.c + * + * Plot powder patterns + * + * (c) 2006-2010 Thomas White + * + * Part of CrystFEL - crystallography with a FEL + * + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "utils.h" +#include "image.h" +#include "detector.h" +#include "index.h" +#include "hdf5-file.h" + + +static void show_help(const char *s) +{ + printf("Syntax: %s [options] \n\n", s); + printf( +"Compare intensity lists.\n" +"\n" +" -h, --help Display this help message.\n" +"\n"); +} + + +int main(int argc, char *argv[]) +{ + int c; + struct image image; + int x, y; + struct hdfile *hdfile; + char *filename = NULL; + + /* Long options */ + const struct option longopts[] = { + {"help", 0, NULL, 'h'}, + {"input", 1, NULL, 'i'}, + {0, 0, NULL, 0} + }; + + /* Short options */ + while ((c = getopt_long(argc, argv, "hi:", longopts, NULL)) != -1) { + + switch (c) { + case 'h' : { + show_help(argv[0]); + return 0; + } + + case 0 : { + break; + } + + case 'i' : { + filename = strdup(optarg); + break; + } + + default : { + return 1; + } + } + + } + + if ( filename == NULL ) { + ERROR("You must specify the input filename with -i\n"); + return 1; + } + + #include "geometry-lcls.tmp" + + hdfile = hdfile_open(filename); + hdfile_set_image(hdfile, "/data/data"); + hdf5_read(hdfile, &image); + + for ( x=0; x