aboutsummaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-01-15 09:36:04 +0100
committerThomas White <taw@physics.org>2010-01-15 09:36:04 +0100
commit4400739e74b8f4f37c1bdc64ed16022103a2089b (patch)
treef690734f3010a7ef1d3d8f5d96680d1eb84a607c /src/index.c
parentbe91dcd68350569a709699867a1c25cf7ea6d15a (diff)
Handle upper and lower CCDs correctly
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/index.c b/src/index.c
index c8d5dbe6..b90a3c0b 100644
--- a/src/index.c
+++ b/src/index.c
@@ -24,8 +24,11 @@
#include "utils.h"
#include "peaks.h"
#include "dirax.h"
+#include "sfac.h"
+#include "detector.h"
+/* x,y in pixels relative to central beam */
static int map_position(struct image *image, double x, double y,
double *rx, double *ry, double *rz)
{
@@ -35,13 +38,8 @@ static int map_position(struct image *image, double x, double y,
/* Angular description of reflection */
double theta, psi, k;
- x -= image->x_centre;
- y -= image->y_centre;
k = 1.0 / image->lambda;
- /* FIXME: Don't process lower CCD for now */
- if ( y < 0 ) return 0;
-
if ( image->fmode == FORMULATION_CLEN ) {
/* Convert pixels to metres */
@@ -81,14 +79,22 @@ void index_pattern(struct image *image, int no_index, int dump_peaks,
/* Perform 'fine' peak search */
search_peaks(image, dump_peaks);
- /* Map positions to 3D. FIXME: Handle lower detector */
+ /* Map positions to 3D */
for ( i=0; i<image_feature_count(image->features); i++ ) {
struct imagefeature *f;
f = image_get_feature(image->features, i);
- map_position(image, f->x, f->y, &f->rx, &f->ry, &f->rz);
+ if ( f->y >=512 ) {
+ /* Top half of CCD */
+ map_position(image, f->x-UPPER_CX, f->y-UPPER_CY,
+ &f->rx, &f->ry, &f->rz);
+ } else {
+ /* Lower half of CCD */
+ map_position(image, f->x-LOWER_CX, f->y-LOWER_CY,
+ &f->rx, &f->ry, &f->rz);
+ }
}
if ( use_dirax ) {