diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-03-28 15:01:45 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2010-03-28 15:01:45 +0200 |
commit | 119207062fb4a2a41d8ee48fdd7458fc9cf6a30c (patch) | |
tree | a751fc4086bd9c05bed15cffd3c6d656e0278960 /src/peaks.c | |
parent | bedc04ff825009d29abd6a3ac1cd1149db2cecc3 (diff) |
Use integrate_peak() instead of sum_nearby_points()
Diffstat (limited to 'src/peaks.c')
-rw-r--r-- | src/peaks.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/peaks.c b/src/peaks.c index 00e1cbdd..23f13e61 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -325,21 +325,6 @@ void dump_peaks(struct image *image) } -static double sum_nearby_points(float *data, int width, int x, int y) -{ - int dx, dy; - double intensity = 0; - - for ( dx=-3; dx<=3; dx++ ) { - for ( dy=-3; dy<=3; dy++ ) { - intensity += data[(x+dx) + width*(y+dy)]; - } - } - - return intensity; -} - - void output_intensities(struct image *image, UnitCell *cell) { int x, y; @@ -417,7 +402,7 @@ void output_intensities(struct image *image, UnitCell *cell) image->orientation.y, image->orientation.z); for ( i=0; i<n_hits; i++ ) { - double intensity; + float x, y, intensity; /* Bounds check */ if ( hits[i].x + 3 >= image->width ) continue; @@ -425,12 +410,11 @@ void output_intensities(struct image *image, UnitCell *cell) if ( hits[i].y + 3 >= image->height ) continue; if ( hits[i].y - 3 < 0 ) continue; - intensity = sum_nearby_points(image->data, image->width, - hits[i].x, hits[i].y); + integrate_peak(image, hits[i].x, hits[i].y, &x, &y, &intensity); - printf("%3i %3i %3i %6f (at %i,%i)\n", - hits[i].h, hits[i].k, hits[i].l, intensity, - hits[i].x, hits[i].y); + /* Write h,k,l, integrated intensity and centroid coordinates */ + printf("%3i %3i %3i %6f (at %5.2f,%5.2f)\n", + hits[i].h, hits[i].k, hits[i].l, intensity, x, y); } |