diff options
-rw-r--r-- | libcrystfel/src/peaks.c | 12 | ||||
-rw-r--r-- | tests/integration_check.c | 10 |
2 files changed, 12 insertions, 10 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index 5987f8ff..35cc1f96 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -197,7 +197,8 @@ static void make_BgMask(struct image *image, unsigned char *mask, static int integrate_peak(struct image *image, int cfs, int css, double *pfs, double *pss, double *intensity, double *sigma, - double ir_inn, double ir_mid, double ir_out) + double ir_inn, double ir_mid, double ir_out, + int use_max_adu) { signed int fs, ss; double lim_sq, out_lim_sq, mid_lim_sq; @@ -267,7 +268,7 @@ static int integrate_peak(struct image *image, int cfs, int css, val = image->data[idx]; /* Veto peak if it contains saturation in bg region */ - if ( val > p->max_adu ) return 1; + if ( use_max_adu && (val > p->max_adu) ) return 1; bg_tot += val; bg_tot_sq += pow(val, 2.0); @@ -318,7 +319,7 @@ static int integrate_peak(struct image *image, int cfs, int css, val = image->data[idx] - bg_mean; /* Veto peak if it contains saturation */ - if ( image->data[idx] > p->max_adu ) return 1; + if ( use_max_adu && (image->data[idx] > p->max_adu) ) return 1; pk_counts++; pk_total += val; @@ -455,7 +456,7 @@ static void search_peaks_in_panel(struct image *image, float threshold, /* Centroid peak and get better coordinates. */ r = integrate_peak(image, mask_fs, mask_ss, &f_fs, &f_ss, &intensity, &sigma, - ir_inn, ir_mid, ir_out); + ir_inn, ir_mid, ir_out, 0); if ( r ) { /* Bad region - don't detect peak */ @@ -713,7 +714,8 @@ void integrate_reflections(struct image *image, int use_closer, int bgsub, } r = integrate_peak(image, pfs, pss, &fs, &ss, - &intensity, &sigma, ir_inn, ir_mid, ir_out); + &intensity, &sigma, ir_inn, ir_mid, ir_out, + 1); /* Record intensity and set redundancy to 1 on success */ if ( r == 0 ) { diff --git a/tests/integration_check.c b/tests/integration_check.c index 7fe98fa0..d43e5fd2 100644 --- a/tests/integration_check.c +++ b/tests/integration_check.c @@ -64,7 +64,7 @@ static void third_integration_check(struct image *image, int n_trials, } r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0); + &intensity, &sigma, 10.0, 15.0, 17.0, 0); if ( r == 0 ) { mean_intensity += intensity; @@ -125,7 +125,7 @@ static void fourth_integration_check(struct image *image, int n_trials, } r = integrate_peak(image, 64, 64, &fsp, &ssp, - &intensity, &sigma, 10.0, 15.0, 17.0); + &intensity, &sigma, 10.0, 15.0, 17.0, 0); if ( r == 0 ) { mean_intensity += intensity; @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) /* First check: no intensity -> no peak, or very low intensity */ r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0); + 10.0, 15.0, 17.0, 0); STATUS(" First check: integrate_peak() returned %i", r); if ( r == 0 ) { @@ -233,7 +233,7 @@ int main(int argc, char *argv[]) } r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0); + 10.0, 15.0, 17.0, 0); if ( r ) { ERROR(" Second check: integrate_peak() returned %i (wrong).\n", r); @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) } r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma, - 10.0, 15.0, 17.0); + 10.0, 15.0, 17.0, 0); if ( r ) { ERROR(" Fifth check: integrate_peak() returned %i (wrong).\n", r); |