diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-01-20 15:23:19 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:43 +0100 |
commit | 4cd99469d0d369933143c985df665bac35dbb363 (patch) | |
tree | 4aef4fadc19828784856008aca78a8b9d6ed87e4 /libcrystfel | |
parent | 2ad7bdc53c4219092ecfc4d4cb04a14fdb8e7506 (diff) |
Integrate via "sorted" list (sorting not implemented yet)
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/peaks.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index ca284e90..cbcb2ed0 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -534,16 +534,65 @@ int peak_sanity_check(struct image *image) } -/* Integrate the list of predicted reflections in "image" */ -void integrate_reflections(struct image *image, int polar, int use_closer, - int bgsub, double min_snr) +struct integr_ind +{ + signed int h; + signed int k; + signed int l; + double res; + Reflection *refl; +}; + + +static struct integr_ind *sort_reflections(RefList *list, UnitCell *cell, + int *n) { + struct integr_ind *il; Reflection *refl; RefListIterator *iter; + int i; + + *n = num_reflections(list); + + il = calloc(*n, sizeof(struct integr_ind)); + if ( il == NULL ) return NULL; - for ( refl = first_refl(image->reflections, &iter); + + for ( refl = first_refl(list, &iter); refl != NULL; - refl = next_refl(refl, iter) ) { + refl = next_refl(refl, iter) ) + { + signed int h, k, l; + double res; + + get_indices(refl, &h, &k, &l); + res = resolution(cell, h, k, l); + + il[i].h = h; + il[i].k = k; + il[i].l = l; + il[i].res = res; + il[i].refl = refl; + } + + return il; +} + + +/* Integrate the list of predicted reflections in "image" */ +void integrate_reflections(struct image *image, int polar, int use_closer, + int bgsub, double min_snr) +{ + struct integr_ind *il; + int n, i; + + il = sort_reflections(image->reflections, image->indexed_cell, &n); + if ( il == NULL ) { + ERROR("Couldn't sort reflections\n"); + return; + } + + for ( i=0; i<n; i++ ) { double fs, ss, intensity; double d; @@ -552,6 +601,9 @@ void integrate_reflections(struct image *image, int polar, int use_closer, double sigma; double pfs, pss; int r; + Reflection *refl; + + refl = il[i].refl; get_detector_pos(refl, &pfs, &pss); |