From 857cc8c991a5ee4e717d01822da271ae34f5adaa Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 12 Nov 2009 18:50:14 +0100 Subject: Add 'detector' module --- src/detector.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/detector.c (limited to 'src/detector.c') 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 + * + * pattern_sim - Simulate diffraction patterns from small crystals + * + */ + + +#include +#include +#include + +#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; xwidth; x++ ) { + for ( y=0; yheight; 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; + + } + } +} -- cgit v1.2.3