blob: 9e4e56496b0c14b11c0e1283b9b4f6049ead614e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*
* 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;
double phac;
val = image->sfacs[x + image->width*y];
phac = image->phactors[x + image->width*y];
intensity = pow(val, 2.0);
counts = intensity * phac;
image->data[x + image->width*y] = counts;
}
}
}
|