aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-04-16 14:09:59 +0200
committerThomas White <taw@physics.org>2013-04-16 14:09:59 +0200
commitb3f246e5c287670d06f3538d4d533d7c6d2e08ab (patch)
treecc1b4675b72901dcaf2fc528e01330df4fa4d71f
parente53110088bc818ef5b551b65bdaf702d9f04efc5 (diff)
Remove "use_saturated" argument to integrate_peak()
There are no side-effects to setting it either way, and the caller can just set saturated=NULL or ignore the result.
-rw-r--r--libcrystfel/src/peaks.c16
-rw-r--r--tests/integration_check.c10
2 files changed, 11 insertions, 15 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 6c09053b..14541ace 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -228,7 +228,7 @@ 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,
- int use_max_adu, int *bgPkMask, int *saturated)
+ int *bgPkMask, int *saturated)
{
signed int dfs, dss;
double lim_sq, out_lim_sq, mid_lim_sq;
@@ -308,9 +308,7 @@ static int integrate_peak(struct image *image, int cfs, int css,
val = image->data[idx];
/* Check if peak contains saturation in bg region */
- if ( use_max_adu && (val > p->max_adu) ) {
- if ( saturated != NULL ) *saturated = 1;
- }
+ if ( (saturated != NULL) && (val > p->max_adu) ) *saturated = 1;
bg_tot += val;
bg_tot_sq += pow(val, 2.0);
@@ -367,9 +365,7 @@ static int integrate_peak(struct image *image, int cfs, int css,
val = image->data[idx] - bg_mean;
/* Check if peak contains saturation */
- if ( use_max_adu && (val > p->max_adu) ) {
- if ( saturated != NULL ) *saturated = 1;
- }
+ if ( (saturated != NULL) && (val > p->max_adu) ) *saturated = 1;
pk_counts++;
pk_total += val;
@@ -502,7 +498,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, 1, NULL, &saturated);
+ ir_inn, ir_mid, ir_out, NULL, &saturated);
if ( saturated ) {
image->num_saturated_peaks++;
@@ -798,7 +794,7 @@ static void integrate_crystal(Crystal *cr, struct image *image, int use_closer,
r = integrate_peak(image, pfs, pss, &fs, &ss,
&intensity, &sigma, ir_inn, ir_mid, ir_out,
- 1, bgMasks[pnum], &saturated);
+ bgMasks[pnum], &saturated);
if ( saturated ) {
n_saturated++;
@@ -920,7 +916,7 @@ 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, 1, NULL, &saturated);
+ ir_inn, ir_mid, ir_out, NULL, &saturated);
if ( r ) {
n_int++;
continue;
diff --git a/tests/integration_check.c b/tests/integration_check.c
index 659eb7cc..ac871581 100644
--- a/tests/integration_check.c
+++ b/tests/integration_check.c
@@ -65,7 +65,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,
- 0, NULL, NULL);
+ NULL, NULL);
if ( r == 0 ) {
mean_intensity += intensity;
@@ -127,7 +127,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,
- 0, NULL, NULL);
+ NULL, NULL);
if ( r == 0 ) {
mean_intensity += intensity;
@@ -210,7 +210,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, 0, NULL, NULL);
+ 10.0, 15.0, 17.0, NULL, NULL);
STATUS(" First check: integrate_peak() returned %i", r);
if ( r == 0 ) {
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
}
r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma,
- 10.0, 15.0, 17.0, 0, NULL, NULL);
+ 10.0, 15.0, 17.0, NULL, NULL);
if ( r ) {
ERROR(" Second check: integrate_peak() returned %i (wrong).\n",
r);
@@ -278,7 +278,7 @@ int main(int argc, char *argv[])
}
r = integrate_peak(&image, 64, 64, &fsp, &ssp, &intensity, &sigma,
- 10.0, 15.0, 17.0, 0, NULL, NULL);
+ 10.0, 15.0, 17.0, NULL, NULL);
if ( r ) {
ERROR(" Fifth check: integrate_peak() returned %i (wrong).\n",
r);