From 3de4d63ee345b01a9f992f60e1fb818b0c707c9c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 8 Feb 2013 21:31:04 -0800 Subject: Saturation counting fixes --- libcrystfel/src/peaks.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index cfd00d58..31eea0cb 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -415,7 +415,6 @@ static void search_peaks_in_panel(struct image *image, float threshold, int nrej_fra = 0; int nrej_fail = 0; int nrej_snr = 0; - int nrej_sat = 0; int nacc = 0; int ncull; @@ -920,12 +919,17 @@ void validate_peaks(struct image *image, double min_snr, r = integrate_peak(image, f->fs, f->ss, &f_fs, &f_ss, &intensity, &sigma, - ir_inn, ir_mid, ir_out, 0, NULL, &saturated); + ir_inn, ir_mid, ir_out, 1, NULL, &saturated); if ( r ) { n_int++; continue; } + if ( saturated ) { + n_sat++; + if ( !use_saturated ) continue; + } + /* It is possible for the centroid to fall outside the image */ if ( (f_fs < p->min_fs) || (f_fs > p->max_fs) || (f_ss < p->min_ss) || (f_ss > p->max_ss) ) @@ -946,11 +950,6 @@ void validate_peaks(struct image *image, double min_snr, continue; } - if ( saturated && !use_saturated ) { - n_sat++; - continue; - } - /* Add using "better" coordinates */ image_add_feature(flist, f_fs, f_ss, image, intensity, NULL); @@ -962,4 +961,6 @@ void validate_peaks(struct image *image, double min_snr, // n_wtf, n_int, n_dft, n_snr, n_prx, n_sat); image_feature_list_free(image->features); image->features = flist; + image->num_saturated_peaks = n_sat; + image->num_peaks = image_feature_count(flist); } -- cgit v1.2.3