From 2318ae07fa5baaead4c1bc55bc4e63694c1942dc Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 28 Aug 2011 04:29:43 -0700 Subject: Hooks for estimation of maximum resolution for each image --- libcrystfel/src/reflist-utils.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'libcrystfel/src/reflist-utils.c') diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c index c13b7bcf..66bd377e 100644 --- a/libcrystfel/src/reflist-utils.c +++ b/libcrystfel/src/reflist-utils.c @@ -434,3 +434,40 @@ double max_intensity(RefList *list) return max; } + + +/** + * res_cutoff: + * @list: A %RefList + * + * Returns: A new %RefList with resolution cutoff applied + **/ +RefList *res_cutoff(RefList *list, UnitCell *cell, double min, double max) +{ + Reflection *refl; + RefListIterator *iter; + RefList *new; + + new = reflist_new(); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) + { + double one_over_d; + signed int h, k, l; + Reflection *n; + + get_indices(refl, &h, &k, &l); + + one_over_d = 2.0 * resolution(cell, h, k, l); + if ( one_over_d < min ) continue; + if ( one_over_d > max ) continue; + + n = add_refl(new, h, k, l); + copy_data(n, refl); + } + + reflist_free(list); + return new; +} -- cgit v1.2.3