aboutsummaryrefslogtreecommitdiff
path: root/src/peaks.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-04-29 13:56:38 +0200
committerThomas White <taw@physics.org>2010-04-29 13:56:38 +0200
commitfea44364476869c59163e373f746f377754f4f23 (patch)
tree26b5e74f45eee5fe20fa6cffc6f80e16417f85a7 /src/peaks.c
parentfb978a5cef9deb84f108bc71117e5b06f4323189 (diff)
Peak integration improvements
Diffstat (limited to 'src/peaks.c')
-rw-r--r--src/peaks.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 2bbed2bf..d97c4d5f 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -136,16 +136,15 @@ static void integrate_peak(struct image *image, int xp, int yp,
{
signed int x, y;
const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS;
- int total = 0;
+ double total = 0;
int xct = 0;
int yct = 0;
for ( x=-INTEGRATION_RADIUS; x<+INTEGRATION_RADIUS; x++ ) {
for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) {
- int val;
struct panel *p;
- double sa, pix_area, Lsq, dsq, proj_area;
+ double val, sa, pix_area, Lsq, dsq, proj_area;
float tt;
/* Circular mask */
@@ -467,11 +466,10 @@ void output_intensities(struct image *image, UnitCell *cell,
int idx;
struct imagefeature *f;
- integrate_peak(image, hits[i].x, hits[i].y, &x, &y, &intensity);
-
/* Wait.. is there a closer feature which was detected? */
- f = image_feature_closest(image->features, x, y, &d, &idx);
- if ( (d < 10.0) && (f != NULL) ) {
+ f = image_feature_closest(image->features, hits[i].x, hits[i].y,
+ &d, &idx);
+ if ( (f != NULL) && (d < 10.0) ) {
/* f->intensity was measured on the filtered pattern,
* so instead re-integrate using old coordinates.
@@ -479,6 +477,10 @@ void output_intensities(struct image *image, UnitCell *cell,
integrate_peak(image, f->x, f->y, &x, &y, &intensity);
intensity = f->intensity;
+ } else {
+
+ integrate_peak(image, hits[i].x, hits[i].y,
+ &x, &y, &intensity);
}
/* Write h,k,l, integrated intensity and centroid coordinates */