aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/Makefile.am7
-rw-r--r--src/powder_plot.c111
3 files changed, 118 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 44c57383..9c3dd3d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,4 +16,5 @@ src/get_hkl
src/hdfsee
src/indexamajig
src/compare_hkl
+src/powder_plot
*~
diff --git a/src/Makefile.am b/src/Makefile.am
index 7fd07cad..4142c40f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,5 @@
-bin_PROGRAMS = pattern_sim process_hkl get_hkl indexamajig compare_hkl
+bin_PROGRAMS = pattern_sim process_hkl get_hkl indexamajig compare_hkl \
+ powder_plot
if HAVE_GTK
bin_PROGRAMS += hdfsee
@@ -37,4 +38,8 @@ get_hkl_LDADD = @LIBS@
compare_hkl_SOURCES = compare_hkl.c sfac.c cell.c utils.c reflections.c
compare_hkl_LDADD = @LIBS@
+powder_plot_SOURCES = powder_plot.c cell.c utils.c image.c hdf5-file.c \
+ detector.c index.c diffraction.c sfac.c dirax.c
+powder_plot_LDADD = @LIBS@
+
INCLUDES = "-I$(top_srcdir)/data"
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 <taw@physics.org>
+ *
+ * Part of CrystFEL - crystallography with a FEL
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#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] <file.h5>\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<image.width; x++ ) {
+ for ( y=0; y<image.height; y++ ) {
+
+ double rx, ry, rz;
+ double q;
+ int intensity;
+
+ map_position(&image, x, y, &rx, &ry, &rz);
+ q = modulus(rx, ry, rz);
+
+ intensity = image.data[x + image.width*y];
+
+ printf("%5i\t%5i\t%7.3f\t%7i\n", x, y, q/1.0e9, intensity);
+
+ }
+ }
+
+ return 0;
+}