aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/integration.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-05-24 15:26:15 +0200
committerThomas White <taw@physics.org>2013-05-27 17:33:16 +0200
commit45cbdb156b10f560d7d254348162e8dbd144be19 (patch)
tree19d72c39344b1369af6e6c2e8df3b9c510ecb3d9 /libcrystfel/src/integration.c
parentc2f556d32166abfaf6d34f4d96ee650cf6101487 (diff)
Code organisation
Diffstat (limited to 'libcrystfel/src/integration.c')
-rw-r--r--libcrystfel/src/integration.c117
1 files changed, 58 insertions, 59 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index c7372bc7..bb7ec746 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -48,65 +48,6 @@
#include "integration.h"
-struct integr_ind
-{
- double res;
- Reflection *refl;
-};
-
-
-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 *np)
-{
- struct integr_ind *il;
- Reflection *refl;
- RefListIterator *iter;
- int i, n;
-
- n = num_reflections(list);
- *np = 0; /* For now */
-
- if ( n == 0 ) return NULL;
-
- il = calloc(n, sizeof(struct integr_ind));
- if ( il == NULL ) return NULL;
-
- i = 0;
- for ( refl = first_refl(list, &iter);
- refl != NULL;
- refl = next_refl(refl, iter) )
- {
- signed int h, k, l;
- double res;
-
- if ( get_redundancy(refl) == 0 ) continue;
-
- get_indices(refl, &h, &k, &l);
- res = resolution(cell, h, k, l);
-
- il[i].res = res;
- il[i].refl = refl;
-
- i++;
- assert(i <= n);
- }
-
- qsort(il, n, sizeof(struct integr_ind), compare_resolution);
-
- *np = n;
- return il;
-}
-
-
static void check_eigen(gsl_vector *e_val)
{
int i;
@@ -908,6 +849,64 @@ static void estimate_mosaicity(Crystal *cr, struct image *image)
}
+struct integr_ind
+{
+ double res;
+ Reflection *refl;
+};
+
+
+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 *np)
+{
+ struct integr_ind *il;
+ Reflection *refl;
+ RefListIterator *iter;
+ int i, n;
+
+ *np = 0; /* For now */
+
+ n = num_reflections(list);
+ if ( n == 0 ) return NULL;
+
+ il = calloc(n, sizeof(struct integr_ind));
+ if ( il == NULL ) return NULL;
+
+ i = 0;
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) )
+ {
+ signed int h, k, l;
+ double res;
+
+ if ( get_redundancy(refl) == 0 ) continue;
+
+ get_indices(refl, &h, &k, &l);
+ res = resolution(cell, h, k, l);
+
+ il[i].res = res;
+ il[i].refl = refl;
+
+ i++;
+ }
+
+ qsort(il, i, sizeof(struct integr_ind), compare_resolution);
+
+ *np = i;
+ return il;
+}
+
+
static void estimate_resolution(RefList *reflections, Crystal *cr,
struct image *image)
{