aboutsummaryrefslogtreecommitdiff
path: root/src/peaks.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-05-27 14:31:10 +0200
committerThomas White <taw@physics.org>2010-05-27 14:31:10 +0200
commit421ed8c2ed2a3de6c3dcb79da9a25e50ea4193f6 (patch)
treeefad7cf68125c330d765c7e642db46bb6abba67c /src/peaks.c
parentccd31b477da6295255720e485ad0b30293597355 (diff)
Fix peak sanity check
Diffstat (limited to 'src/peaks.c')
-rw-r--r--src/peaks.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 4d6ab322..a44b2913 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -457,20 +457,19 @@ static int find_projected_peaks(struct image *image, UnitCell *cell)
int peak_sanity_check(struct image *image, UnitCell *cell)
{
int i;
- const int n_hits = image->n_hits;
- const struct reflhit *hits = image->hits;
int n_sane = 0;
find_projected_peaks(image, cell);
if ( image->n_hits == 0 ) return 0; /* Failed sanity check: no peaks */
- for ( i=0; i<n_hits; i++ ) {
+ for ( i=0; i<image->n_hits; i++ ) {
double d;
int idx;
struct imagefeature *f;
- f = image_feature_closest(image->features, hits[i].x, hits[i].y,
+ f = image_feature_closest(image->features,
+ image->hits[i].x, image->hits[i].y,
&d, &idx);
if ( (f != NULL) && (d < PEAK_CLOSE) ) {
n_sane++;
@@ -478,7 +477,9 @@ int peak_sanity_check(struct image *image, UnitCell *cell)
}
- if ( (float)n_sane / (float)n_hits < 0.8 ) return 0;
+ STATUS("Sanity factor: %f / %f = %f\n", (float)n_sane, (float)image->n_hits,
+ (float)n_sane / (float)image->n_hits);
+ if ( (float)n_sane / (float)image->n_hits < 0.8 ) return 0;
return 1;
}