Commit 483e3d58 authored by Thomas White's avatar Thomas White
Browse files

indexamajig: Add --integrate-saturated

parent 1d7ab964
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -66,6 +66,7 @@ struct index_args
double ir_mid;
double ir_out;
struct copy_hdf5_field *copyme;
int integrate_saturated;
};
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment