aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/peaks.c14
-rw-r--r--libcrystfel/src/peaks.h3
-rw-r--r--src/im-sandbox.c3
-rw-r--r--src/im-sandbox.h1
-rw-r--r--src/indexamajig.c5
5 files changed, 18 insertions, 8 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index bf6a92f0..f13c7245 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -293,10 +293,9 @@ static int integrate_peak(struct image *image, int cfs, int css,
val = image->data[idx];
- /* Veto peak if it contains saturation in bg region */
+ /* Check if peak contains saturation in bg region */
if ( use_max_adu && (val > p->max_adu) ) {
if ( saturated != NULL ) *saturated = 1;
- return 1;
}
bg_tot += val;
@@ -353,10 +352,9 @@ static int integrate_peak(struct image *image, int cfs, int css,
val = image->data[idx] - bg_mean;
- /* Veto peak if it contains saturation */
+ /* Check if peak contains saturation */
if ( use_max_adu && (val > p->max_adu) ) {
if ( saturated != NULL ) *saturated = 1;
- return 1;
}
pk_counts++;
@@ -697,7 +695,8 @@ static struct integr_ind *sort_reflections(RefList *list, UnitCell *cell,
/* Integrate the list of predicted reflections in "image" */
void integrate_reflections(struct image *image, int use_closer, int bgsub,
double min_snr,
- double ir_inn, double ir_mid, double ir_out)
+ double ir_inn, double ir_mid, double ir_out,
+ int integrate_saturated)
{
struct integr_ind *il;
int n, i;
@@ -794,7 +793,10 @@ void integrate_reflections(struct image *image, int use_closer, int bgsub,
&intensity, &sigma, ir_inn, ir_mid, ir_out,
1, bgMasks[pnum], &saturated);
- if ( saturated ) image->n_saturated++;
+ if ( saturated ) {
+ image->n_saturated++;
+ if ( !integrate_saturated ) r = 1;
+ }
/* I/sigma(I) cutoff */
if ( intensity/sigma < min_snr ) r = 1;
diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h
index 39fdf54c..ec76fd3b 100644
--- a/libcrystfel/src/peaks.h
+++ b/libcrystfel/src/peaks.h
@@ -43,7 +43,8 @@ extern void search_peaks(struct image *image, float threshold,
extern void integrate_reflections(struct image *image,
int use_closer, int bgsub, double min_snr,
- double ir_inn, double ir_mid, double ir_out);
+ double ir_inn, double ir_mid, double ir_out,
+ int integrate_saturated);
extern double peak_lattice_agreement(struct image *image, UnitCell *cell,
double *pst);
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 70839f21..80bb78e0 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -328,7 +328,8 @@ static void process_image(const struct index_args *iargs,
iargs->min_int_snr,
iargs->ir_inn,
iargs->ir_mid,
- iargs->ir_out);
+ iargs->ir_out,
+ iargs->integrate_saturated);
}
} else {
image.reflections = NULL;
diff --git a/src/im-sandbox.h b/src/im-sandbox.h
index 8ad9fd90..9f23f88b 100644
--- a/src/im-sandbox.h
+++ b/src/im-sandbox.h
@@ -66,6 +66,7 @@ struct index_args
double ir_mid;
double ir_out;
struct copy_hdf5_field *copyme;
+ int integrate_saturated;
};
diff --git a/src/indexamajig.c b/src/indexamajig.c
index f628eb29..2e5c8904 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -161,6 +161,8 @@ static void show_help(const char *s)
" least 10%% of the located peaks.\n"
" --no-bg-sub Don't subtract local background estimates from\n"
" integrated intensities.\n"
+" --integrate-saturated During the final integration stage, don't reject\n"
+" peaks which contain pixels above max_adu.\n"
);
}
@@ -242,6 +244,7 @@ int main(int argc, char *argv[])
float ir_inn = 4.0;
float ir_mid = 5.0;
float ir_out = 7.0;
+ int integrate_saturated = 0;
copyme = new_copy_hdf5_field_list();
if ( copyme == NULL ) {
@@ -288,6 +291,7 @@ int main(int argc, char *argv[])
{"min-integration-snr",1, NULL, 12},
{"tolerance", 1, NULL, 13},
{"int-radius", 1, NULL, 14},
+ {"integrate-saturated",0, &integrate_saturated,1},
{0, 0, NULL, 0}
};
@@ -634,6 +638,7 @@ int main(int argc, char *argv[])
iargs.ir_inn = ir_inn;
iargs.ir_mid = ir_mid;
iargs.ir_out = ir_out;
+ iargs.integrate_saturated = integrate_saturated;
create_sandbox(&iargs, n_proc, prefix, config_basename, fh,
use_this_one_instead, ofh);