aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-10-25 16:29:01 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:03 +0100
commit4e6691e2f6c0aa2ef92b8d3be03b513336cc3586 (patch)
treeaa28060c8bca2997d4b56bc4ff44eab305439d83 /src
parent0b51b862bca321d465b90a672aaa6028406b6ef7 (diff)
Update definition of bandwidth to match documentation
Diffstat (limited to 'src')
-rw-r--r--src/diffraction-gpu.c8
-rw-r--r--src/diffraction.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index 409178b9..825f6372 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -113,7 +113,7 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
double ax, ay, az;
double bx, by, bz;
double cx, cy, cz;
- float k, klow;
+ float klow, khigh;
cl_event *event;
int p;
float *tt_ptr;
@@ -136,9 +136,9 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
cell.s[6] = cx; cell.s[7] = cy; cell.s[8] = cz;
/* Calculate wavelength */
- k = 1.0/image->lambda; /* Centre value */
- klow = k - k*(image->beam->bandwidth/2.0); /* Lower value */
- bwstep = k * image->beam->bandwidth / BWSAMPLING;
+ klow = 1.0/(image->lambda + image->beam->bandwidth/2.0);
+ khigh = 1.0/(image->lambda - image->beam->bandwidth/2.0);
+ bwstep = (khigh-klow) / BWSAMPLING;
/* Orientation */
orientation.s[0] = image->orientation.w;
diff --git a/src/diffraction.c b/src/diffraction.c
index 66a2ba27..20490c99 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -301,7 +301,7 @@ void get_diffraction(struct image *image, int na, int nb, int nc,
double ax, ay, az;
double bx, by, bz;
double cx, cy, cz;
- float k, klow, bwstep;
+ float klow, khigh, bwstep;
cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz);
@@ -311,9 +311,9 @@ void get_diffraction(struct image *image, int na, int nb, int nc,
/* Needed later for Lorentz calculation */
image->twotheta = malloc(image->width * image->height * sizeof(double));
- k = 1.0/image->lambda; /* Centre value */
- klow = k - k*(image->beam->bandwidth/2.0); /* Lower value */
- bwstep = k * image->beam->bandwidth / BWSAMPLING;
+ klow = 1.0/(image->lambda + image->beam->bandwidth/2.0);
+ khigh = 1.0/(image->lambda - image->beam->bandwidth/2.0);
+ bwstep = (khigh-klow) / BWSAMPLING;
for ( xs=0; xs<image->width*SAMPLING; xs++ ) {
for ( ys=0; ys<image->height*SAMPLING; ys++ ) {