aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2012-01-20 16:54:15 -0800
committerThomas White <taw@physics.org>2012-02-22 15:27:43 +0100
commit429e1c3dafd584095fd5b71cd03b35ba59de486f (patch)
tree63f0ef8868fbca7677b22c3a7c28293b5f63d492 /libcrystfel/src
parentb846de8dd0e22be28956f4b0ebb56ac78b73a202 (diff)
Integrate in order of resolution
Cutoff is disabled at the moment, because the sigmas are garbage
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/peaks.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 768b9ce9..54de7dee 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -544,6 +544,14 @@ struct integr_ind
};
+static int compare_resolution(const void *av, const void *bv)
+{
+ const struct integr_ind *a = av;
+ const struct integr_ind *b = bv;
+
+ return a->res > b->res;
+}
+
static struct integr_ind *sort_reflections(RefList *list, UnitCell *cell,
int *n)
{
@@ -577,6 +585,8 @@ static struct integr_ind *sort_reflections(RefList *list, UnitCell *cell,
i++;
}
+ qsort(il, *n, sizeof(struct integr_ind), compare_resolution);
+
return il;
}
@@ -587,6 +597,8 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
{
struct integr_ind *il;
int n, i;
+ double av = 0.0;
+ int first = 1;
il = sort_reflections(image->reflections, image->indexed_cell, &n);
if ( il == NULL ) {
@@ -600,7 +612,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
double d;
int idx;
double bg, max;
- double sigma;
+ double sigma, snr;
double pfs, pss;
int r;
Reflection *refl;
@@ -626,6 +638,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
pss = f->ss;
}
+
}
r = integrate_peak(image, pfs, pss, &fs, &ss,
@@ -644,5 +657,17 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
set_redundancy(refl, 0);
}
+ snr = intensity / sigma;
+ if ( snr > 1.0 ) {
+ if ( first ) {
+ av = snr;
+ first = 0;
+ } else {
+ av = av + 0.1*(snr - av);
+ }
+ //STATUS("%5.2f A, %5.2f, av %5.2f\n",
+ // 1e10/il[i].res, snr, av);
+ //if ( av < 1.0 ) break;
+ }
}
}