aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-12 18:50:14 +0100
committerThomas White <taw@physics.org>2009-11-12 18:50:14 +0100
commit857cc8c991a5ee4e717d01822da271ae34f5adaa (patch)
tree891d9f6e63370871726fe78d23d8b6e3796d92fc /src/detector.c
parentc9a551b872ae4eb16a606d46a7cf118af24f75f5 (diff)
Add 'detector' module
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;
+
+ }
+ }
+}