aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c
new file mode 100644
index 00000000..ebcbb814
--- /dev/null
+++ b/src/detector.c
@@ -0,0 +1,42 @@
+/*
+ * detector.c
+ *
+ * Detector properties
+ *
+ * (c) 2007-2009 Thomas White <thomas.white@desy.de>
+ *
+ * pattern_sim - Simulate diffraction patterns from small crystals
+ *
+ */
+
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "image.h"
+
+
+void record_image(struct image *image)
+{
+ int x, y;
+
+ image->data = malloc(image->width * image->height * sizeof(uint16_t));
+
+ for ( x=0; x<image->width; x++ ) {
+ for ( y=0; y<image->height; y++ ) {
+
+ uint16_t counts;
+ double val;
+ double intensity;
+
+ val = image->sfacs[x + image->width*y];
+
+ intensity = pow(val, 2.0);
+ counts = intensity*16;
+
+ image->data[x + image->width*y] = counts;
+
+ }
+ }
+}