aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/diffraction.c22
-rw-r--r--src/diffraction.h2
-rw-r--r--src/indexamajig.c1
-rw-r--r--src/peaks.c2
4 files changed, 26 insertions, 1 deletions
diff --git a/src/diffraction.c b/src/diffraction.c
index 1960f786..8b245589 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -267,6 +267,28 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys,
}
+double get_tt(struct image *image, unsigned int xs, unsigned int ys)
+{
+ float r;
+ float rx = 0.0;
+ float ry = 0.0;
+ struct panel *p;
+
+ const unsigned int x = xs;
+ const unsigned int y = ys; /* Integer part only */
+
+ p = find_panel(&image->det, x, y);
+
+ rx = ((float)xs - p->cx) / p->res;
+ ry = ((float)ys - p->cy) / p->res;
+
+ /* Calculate q-vector for this sub-pixel */
+ r = sqrt(pow(rx, 2.0) + pow(ry, 2.0));
+
+ return atan2(r, p->clen);
+}
+
+
void get_diffraction(struct image *image, int na, int nb, int nc,
const double *intensities, const unsigned int *counts,
UnitCell *cell, int do_water, GradientMethod m)
diff --git a/src/diffraction.h b/src/diffraction.h
index 85d06cc2..ed583feb 100644
--- a/src/diffraction.h
+++ b/src/diffraction.h
@@ -32,4 +32,6 @@ extern void get_diffraction(struct image *image, int na, int nb, int nc,
extern struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys,
unsigned int sampling, float *ttp, float k);
+extern double get_tt(struct image *image, unsigned int xs, unsigned int ys);
+
#endif /* DIFFRACTION_H */
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 50318a1b..3dee0072 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -323,6 +323,7 @@ static void *process_image(void *pargsv)
}
/* No cell at this point? Then we're done. */
+ result->peaks_sane = 0;
if ( image.indexed_cell == NULL ) goto done;
/* Sanity check */
diff --git a/src/peaks.c b/src/peaks.c
index 9d5c305b..22e12949 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -164,7 +164,7 @@ static void integrate_peak(struct image *image, int xp, int yp,
Lsq = pow(p->clen, 2.0);
/* Area of pixel as seen from crystal (approximate) */
- get_q(image, x+xp, y+yp, 1, &tt, 1.0 / image->lambda);
+ tt = get_tt(image, x+xp, y+yp);
proj_area = pix_area * cos(tt);
/* Calculate distance from crystal to pixel */