From 5b69bbf806d03dc5722c48884874a2f5a3cb3cdd Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 27 Jan 2016 19:06:21 +0100 Subject: asdf: Don't assume that the number of peaks == image_feature_count() Yes, really. Sorry about the crappy API. --- libcrystfel/src/asdf.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c index 87f00716..39a574ae 100644 --- a/libcrystfel/src/asdf.c +++ b/libcrystfel/src/asdf.c @@ -1101,19 +1101,21 @@ int run_asdf(struct image *image, IndexingPrivate *ipriv) volume_max = volume * (1 + vtol); } - int N_reflections = image_feature_count(image->features); - gsl_vector *reflections[N_reflections]; + int n = image_feature_count(image->features); + int N_reflections = 0; + gsl_vector *reflections[n]; - for ( i = 0; i < N_reflections; i++ ) { + for ( i=0; ifeatures, i); if ( f == NULL ) continue; - reflections[i] = gsl_vector_alloc(3); - gsl_vector_set(reflections[i], 0, f->rx/1e10); - gsl_vector_set(reflections[i], 1, f->ry/1e10); - gsl_vector_set(reflections[i], 2, f->rz/1e10); + reflections[N_reflections] = gsl_vector_alloc(3); + gsl_vector_set(reflections[N_reflections], 0, f->rx/1e10); + gsl_vector_set(reflections[N_reflections], 1, f->ry/1e10); + gsl_vector_set(reflections[N_reflections], 2, f->rz/1e10); + N_reflections++; } struct asdf_cell *c = asdf_cell_new(N_reflections); -- cgit v1.2.3