aboutsummaryrefslogtreecommitdiff
path: root/src/ewald.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-04 19:04:20 +0100
committerThomas White <taw@physics.org>2010-02-04 19:04:20 +0100
commita162a01f988a86f38d10a1b507d524637670566e (patch)
tree401f12e5878d8ca150b51bca5835cae627eabc6e /src/ewald.c
parentc85a8a308ec7ab50545255530da6a31b841be3ed (diff)
Improved framework for detector geometry
Diffstat (limited to 'src/ewald.c')
-rw-r--r--src/ewald.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ewald.c b/src/ewald.c
index 19ce301e..94fb4ed6 100644
--- a/src/ewald.c
+++ b/src/ewald.c
@@ -68,20 +68,25 @@ void get_ewald(struct image *image)
for ( x=0; x<image->width; x++ ) {
for ( y=0; y<image->height; y++ ) {
- double rx, ry, r;
+ double rx = 0.0;
+ double ry = 0.0;
+ double r;
double twothetax, twothetay, twotheta;
double qx, qy, qz;
struct rvec q;
+ int p;
/* Calculate q vectors for Ewald sphere */
- 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;
+ for ( p=0; p<image->det.n_panels; p++ ) {
+ if ( (x >= image->det.panels[p].min_x)
+ && (x <= image->det.panels[p].max_x)
+ && (y >= image->det.panels[p].min_y)
+ && (y <= image->det.panels[p].max_y) ) {
+ rx = ((double)x - image->det.panels[p].cx)
+ / image->resolution;
+ ry = ((double)y - image->det.panels[p].cy)
+ / image->resolution;
+ }
}
r = sqrt(pow(rx, 2.0) + pow(ry, 2.0));