From 58881c8f772dac2920d5cf1c2bf1638e0a086c21 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 7 Nov 2011 18:00:53 +0100 Subject: Fussiness --- src/peaks.c | 64 ++++++++++++------------------------------------------------- 1 file changed, 12 insertions(+), 52 deletions(-) diff --git a/src/peaks.c b/src/peaks.c index a5e1983a..eef4ea31 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -391,7 +391,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, * intensity of this peak is only an estimate at this stage. */ r = integrate_peak(image, mask_fs, mask_ss, &f_fs, &f_ss, &intensity, - &pbg, &pmax, &sigma, 0, 1, 1); + &pbg, &pmax, &sigma, 0, 1, 1); if ( r ) { /* Bad region - don't detect peak */ @@ -437,7 +437,8 @@ static void search_peaks_in_panel(struct image *image, float threshold, // STATUS("%i accepted, %i box, %i proximity, %i outside panel, " // "%i in bad regions, %i with SNR < %g, %i badrow culled.\n", -// nacc, nrej_dis, nrej_pro, nrej_fra, nrej_bad, nrej_snr, min_snr, ncull); +// nacc, nrej_dis, nrej_pro, nrej_fra, nrej_bad, +// nrej_snr, min_snr, ncull); } @@ -464,23 +465,23 @@ void search_peaks(struct image *image, float threshold, float min_gradient, int peak_sanity_check(struct image *image) { - + int i; int n_feat = 0; int n_sane = 0; double ax, ay, az; double bx, by, bz; - double cx, cy, cz; + double cx, cy, cz; double min_dist = 0.25; /* Round towards nearest */ fesetround(1); /* Cell basis vectors for this image */ - cell_get_cartesian(image->indexed_cell, &ax, &ay, &az, + cell_get_cartesian(image->indexed_cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); - + /* Loop over peaks, checking proximity to nearest reflection */ for ( i=0; ifeatures); i++ ) { @@ -496,7 +497,8 @@ int peak_sanity_check(struct image *image) /* Reciprocal space position of found peak */ q = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda); - /* Decimal and fractional Miller indices of nearest Bragg reflection */ + /* Decimal and fractional Miller indices of nearest + * reciprocal lattice point */ hd = q.u * ax + q.v * ay + q.w * az; kd = q.u * bx + q.v * by + q.w * bz; ld = q.u * cx + q.v * cy + q.w * cz; @@ -505,10 +507,9 @@ int peak_sanity_check(struct image *image) l = lrint(ld); /* Check distance */ - if ( fabs(h - hd) < min_dist && - fabs(k - kd) < min_dist && - fabs(l - ld) < min_dist ) { - // printf("%6.1f %6.1f %3g %3g %3g %6.2f %6.2f %6.2f\n",f->fs,f->ss,h,k,l,hd,kd,ld); + if ( (fabs(h - hd) < min_dist) && (fabs(k - kd) < min_dist) + && (fabs(l - ld) < min_dist) ) + { n_sane++; continue; } @@ -523,47 +524,6 @@ int peak_sanity_check(struct image *image) } - -//int peak_sanity_check(RefList *rlist, ImageFeatureList *flist) -//{ -// int i; -// int n_feat = 0; -// int n_sane = 0; -// -// for ( i=0; ifs, 2.0) + pow(ss-f->ss, 2.0)); -// if ( dist < PEAK_CLOSE ) { -// n_sane++; -// continue; -// } -// } -// -// } -// -// if ( (float)n_sane / (float)n_feat < 0.1 ) return 0; -// -// return 1; -//} - - /* Integrate the list of predicted reflections in "image" */ void integrate_reflections(struct image *image, int polar, int use_closer, int bgsub) -- cgit v1.2.3