From ebe633dab856ae1ea857a3c07c6f284c30899874 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 13 Nov 2009 12:22:42 +0100 Subject: No need to store the "phactors" --- src/detector.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/detector.c') diff --git a/src/detector.c b/src/detector.c index 9e4e5649..2b0c12d4 100644 --- a/src/detector.c +++ b/src/detector.c @@ -15,11 +15,23 @@ #include #include "image.h" +#include "utils.h" + + +/* Pulse energy density in J/m^2 */ +#define PULSE_ENERGY_DENSITY (30.0e7) void record_image(struct image *image) { int x, y; + double ph_per_e; + + /* How many photons are scattered per electron? */ + ph_per_e = PULSE_ENERGY_DENSITY * pow(THOMSON_LENGTH, 2.0) + / image->xray_energy; + + printf("%e photons are scattered per electron\n", ph_per_e); image->data = malloc(image->width * image->height * sizeof(uint16_t)); @@ -27,15 +39,16 @@ void record_image(struct image *image) for ( y=0; yheight; y++ ) { uint16_t counts; - double val; - double intensity; - double phac; + double val, intensity; + double sa; val = image->sfacs[x + image->width*y]; - phac = image->phactors[x + image->width*y]; + + /* What solid angle is subtended by this pixel? */ + sa = 1.0; intensity = pow(val, 2.0); - counts = intensity * phac; + counts = intensity * ph_per_e * sa; image->data[x + image->width*y] = counts; -- cgit v1.2.3