aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorHelen Ginn <helen@strubi.ox.ac.uk>2018-04-30 10:48:37 +0200
committerThomas White <taw@physics.org>2018-05-02 09:46:16 +0200
commit71a60180b43c64f0f426a8ec181b83cbd958713e (patch)
tree0d3614b1e412381d81a443dfc59367529275228a /libcrystfel
parent5ca551032e2cc7e7391cd41be0599277363b58b6 (diff)
Correctly return the best matrix, not the last one
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/taketwo.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c
index 398e6fcb..1d6ef6a2 100644
--- a/libcrystfel/src/taketwo.c
+++ b/libcrystfel/src/taketwo.c
@@ -1547,11 +1547,13 @@ static int find_seeds(struct TakeTwoCell *cell, struct taketwo_private *tp)
return 1;
}
-static int start_seeds(gsl_matrix **rotation, struct TakeTwoCell *cell)
+static unsigned int start_seeds(gsl_matrix **rotation, struct TakeTwoCell *cell)
{
struct Seed *seeds = cell->seeds;
int seed_num = cell->seed_count;
int member_num = 0;
+ int max_members = 0;
+ gsl_matrix *rot = NULL;
/* We have seeds! Pass each of them through the seed-starter */
/* If a seed has the highest achieved membership, make note...*/
@@ -1568,17 +1570,23 @@ static int start_seeds(gsl_matrix **rotation, struct TakeTwoCell *cell)
int seed_obs2 = seeds[k].obs2;
member_num = start_seed(seed_obs1, seed_obs2, seed_idx1,
- seed_idx2, rotation, cell);
+ seed_idx2, &rot, cell);
+
+ if (member_num > max_members)
+ {
+ *rotation = rot;
+ max_members = member_num;
+ }
if (member_num >= NETWORK_MEMBER_THRESHOLD) {
free(seeds);
- return 1;
+ return max_members;
}
}
free(seeds);
- return (member_num > MINIMUM_MEMBER_THRESHOLD && rotation != NULL);
+ return max_members;
}