diff options
author | Thomas White <taw@physics.org> | 2016-01-27 19:06:21 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-01-27 19:07:13 +0100 |
commit | 5b69bbf806d03dc5722c48884874a2f5a3cb3cdd (patch) | |
tree | 2bf69b6a00a2cac93e550bd0f6a6fb3367a471d7 /libcrystfel | |
parent | d03c49371628e676c79139e6846ccce184b62245 (diff) |
asdf: Don't assume that the number of peaks == image_feature_count()
Yes, really. Sorry about the crappy API.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/asdf.c | 16 |
1 files changed, 9 insertions, 7 deletions
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; i<n; i++ ) { struct imagefeature *f; f = image_get_feature(image->features, 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); |