From 4400739e74b8f4f37c1bdc64ed16022103a2089b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 15 Jan 2010 09:36:04 +0100 Subject: Handle upper and lower CCDs correctly --- src/ewald.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ewald.c') diff --git a/src/ewald.c b/src/ewald.c index 82b70df2..b5b61f1c 100644 --- a/src/ewald.c +++ b/src/ewald.c @@ -18,6 +18,7 @@ #include "utils.h" #include "cell.h" #include "ewald.h" +#include "detector.h" static struct rvec quat_rot(struct rvec q, struct quaternion z) @@ -73,8 +74,15 @@ void get_ewald(struct image *image) struct rvec q; /* Calculate q vectors for Ewald sphere */ - rx = ((double)x - image->x_centre) / image->resolution; - ry = ((double)y - image->y_centre) / image->resolution; + if ( y >= 512 ) { + /* Top CCD */ + rx = ((double)x - UPPER_CX) / image->resolution; + ry = ((double)y - UPPER_CY) / image->resolution; + } else { + /* Bottom CCD */ + rx = ((double)x - LOWER_CX) / image->resolution; + ry = ((double)y - LOWER_CY) / image->resolution; + } r = sqrt(pow(rx, 2.0) + pow(ry, 2.0)); twothetax = atan2(rx, image->camera_len); -- cgit v1.2.3