aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/asdf.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-06-17 10:44:39 +0200
committerThomas White <taw@physics.org>2015-06-18 14:28:10 +0200
commit89411b3b07a795e49b1c80e56f5cf6304f33ac57 (patch)
treecb1d8c82bf848cf1ee056f2dfce4aae71c1cf84c /libcrystfel/src/asdf.c
parent8b21e8706963a8f327759b24377e7dff2fff60db (diff)
Small tidying up for asdf
Diffstat (limited to 'libcrystfel/src/asdf.c')
-rw-r--r--libcrystfel/src/asdf.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index d28fcf6a..345bd32c 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -7,6 +7,7 @@
#include <gsl/gsl_blas.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_multifit.h>
+#include <gsl/gsl_fit.h>
#include <fftw3.h>
#include "image.h"
@@ -56,7 +57,7 @@ struct fftw_vars fftw_vars_new()
}
-static int fftw_vars_free(struct fftw_vars fftw)
+static void fftw_vars_free(struct fftw_vars fftw)
{
fftw_free(fftw.in);
fftw_free(fftw.out);
@@ -102,16 +103,6 @@ static int tvector_free(struct tvector t)
}
-static int tvector_memcpy(struct tvector *dest, struct tvector *src, int n)
-{
- gsl_vector_memcpy(dest->t, src->t);
- dest->n = src->n;
- memcpy(dest->fits, src->fits, sizeof(int) * n);
-
- return 1;
-}
-
-
static int asdf_cell_free(struct asdf_cell *c)
{
int i;
@@ -364,12 +355,11 @@ static float find_ds_fft(double *projections, int N_projections, double d_max,
fftw_complex *out = fftw.out;
fftw_plan p = fftw.p;
- for ( i = 0; i < N; i++ ) {
+ for ( i=0; i<N; i++ ) {
in[i] = 0;
}
for ( i = 0; i < n; i++ ) {
-
k = (int)((projections_sorted[i] - projections_sorted[0]) /
(projections_sorted[n - 1] - projections_sorted[0]) *
(N - 1));
@@ -384,7 +374,7 @@ static float find_ds_fft(double *projections, int N_projections, double d_max,
int d = 1;
double max = 0;
double a;
- for ( i = 1; i <= i_max; i++ ) {
+ for ( i=1; i<=i_max; i++ ) {
a = sqrt(out[i][0] * out[i][0] + out[i][1] * out[i][1]);
if (a > max) {
max = a;
@@ -504,37 +494,6 @@ static int check_refl_fitting_cell(struct asdf_cell *c,
}
-static void print_asdf_cell(struct asdf_cell *cc)
-{
- double a, b, c, alpha, beta, gamma, ab, bc, ca;
-
- a = gsl_blas_dnrm2(cc->axes[0]);
- b = gsl_blas_dnrm2(cc->axes[1]);
- c = gsl_blas_dnrm2(cc->axes[2]);
-
- gsl_blas_ddot(cc->axes[0], cc->axes[1], &ab);
- gsl_blas_ddot(cc->axes[1], cc->axes[2], &bc);
- gsl_blas_ddot(cc->axes[0], cc->axes[2], &ca);
-
- alpha = acos(bc/b/c)/M_PI*180;
- beta = acos(ca/a/c)/M_PI*180;
- gamma = acos(ab/a/b)/M_PI*180;
-
- //~ int i, j;
- //~ for (i = 0; i < 3; i ++) {
- //~ for (j = 0; j < 3; j ++) {
- //~ printf("%f ", gsl_vector_get(cc.axes[i], j));
- //~ }
- //~ printf("\n");
- //~ }
-
- printf("%.2f %.2f %.2f %.2f %.2f %.2f %.0f %d \n", a, b, c,
- alpha, beta, gamma,
- cc->volume, cc->n);
-
-}
-
-
/* Returns 0 when refinement doesn't converge (i.e. all fitting reflections
* lie in the same plane) */
static int refine_asdf_cell(struct asdf_cell *c, gsl_vector **reflections,
@@ -749,6 +708,8 @@ static int find_acl(struct tvector t1, struct tvector t2, struct tvector t3)
if ( i <= j && i <= k ) return i;
if ( j <= i && j <= k ) return j;
if ( k <= i && k <= j ) return k;
+ ERROR("This point never reached!\n");
+ abort();
}
@@ -896,14 +857,6 @@ static void shuffle_triplets(int **triplets, int n)
}
-static double angle_between_gsl(gsl_vector *a, gsl_vector *b)
-{
- double ab;
- gsl_blas_ddot(a, b, &ab);
- return acos(ab/gsl_blas_dnrm2(a)/gsl_blas_dnrm2(b)) * 180 / M_PI;
-}
-
-
static int index_refls(gsl_vector **reflections, int N_reflections,
double d_max, double volume_min, double volume_max,
double LevelFit, double IndexFit, int i_max,