diff options
author | Thomas White <taw27@cam.ac.uk> | 2009-03-04 17:31:43 +0000 |
---|---|---|
committer | Thomas White <taw27@cam.ac.uk> | 2009-03-04 17:31:43 +0000 |
commit | c7a86f0de791be1e325a023478170154a3326e70 (patch) | |
tree | 2441f2ddbc3a151eabbddaad70eff8371bb659f8 | |
parent | 244303f588f9c4797836e062d0576d85a027ab2a (diff) |
Formatting, friendlier messages etc
-rw-r--r-- | main.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -216,7 +216,7 @@ int main(void) printf("-----------------------------------------\n\n"); - printf("Inputted values:\n"); + printf("You gave me these measurements:\n"); printf("--------------------------------------------------------------\n"); printf(" h1 k1 l1 h2 k2 l2 Spacing Angle ESD\n"); printf("--------------------------------------------------------------\n"); @@ -252,8 +252,9 @@ int main(void) gsl_multifit_fdfsolver_set(s, &f, &x.vector); iter = 0; - printf("\n"); - printf("iter a b c alpha beta gamma\n"); + printf("\nIterating...\n"); + printf("---------------------------------------------------------\n"); + printf("Itn a b c alpha beta gamma\n"); printf("---------------------------------------------------------\n"); print_state(iter, s); @@ -262,13 +263,15 @@ int main(void) iter++; status = gsl_multifit_fdfsolver_iterate(s); - printf(" status = %s\n", gsl_strerror(status)); + printf(" %s\n", gsl_strerror(status)); print_state(iter, s); if ( status ) break; status = gsl_multifit_test_delta(s->dx, s->x, 1e-6, 1e-6); } while ( (status == GSL_CONTINUE) && (iter < 500) ); + printf("\n---------------------------------------------------------\n"); + printf ("Final status = %s\n", gsl_strerror (status)); covar = gsl_matrix_alloc(6, 6); gsl_multifit_covar(s->J, 0.0, covar); @@ -276,8 +279,6 @@ int main(void) #define FIT(i) gsl_vector_get(s->x, i) #define ERR(i) sqrt(gsl_matrix_get(covar,i,i)) - printf("\n---------------------------------------------------------\n"); - { double chi = gsl_blas_dnrm2(s->f); double dof = n - 6; @@ -286,16 +287,15 @@ int main(void) printf("chisq/dof = %g / %g = %g\n", pow(chi, 2.0), dof, pow(chi, 2.0) / dof); - printf ("a = %8.5f +/- %8.5f\n", FIT(0), c*ERR(0)); - printf ("b = %8.5f +/- %8.5f\n", FIT(1), c*ERR(1)); - printf ("c = %8.5f +/- %8.5f\n", FIT(2), c*ERR(2)); - printf ("alpha = %8.5f +/- %8.5f\n", FIT(3), c*ERR(3)); - printf (" beta = %8.5f +/- %8.5f\n", FIT(4), c*ERR(4)); - printf ("gamma = %8.5f +/- %8.5f\n", FIT(5), c*ERR(5)); + printf("\nI think the unit cell is:\n"); + printf("\t\ta = %8.5f +/- %8.5f\n", FIT(0), c*ERR(0)); + printf("\t\tb = %8.5f +/- %8.5f\n", FIT(1), c*ERR(1)); + printf("\t\tc = %8.5f +/- %8.5f\n", FIT(2), c*ERR(2)); + printf("\t\talpha = %8.5f +/- %8.5f\n", FIT(3), c*ERR(3)); + printf("\t\t beta = %8.5f +/- %8.5f\n", FIT(4), c*ERR(4)); + printf("\t\tgamma = %8.5f +/- %8.5f\n\n", FIT(5), c*ERR(5)); } - printf ("status = %s\n", gsl_strerror (status)); - gsl_multifit_fdfsolver_free(s); gsl_matrix_free(covar); @@ -306,7 +306,7 @@ int main(void) cell.be = FIT(4); cell.ga = FIT(5); - printf("\nValues given by fitted cell:\n"); + printf("\nYour measurements when calculated with my cell are:\n"); printf("--------------------------------------------------------------\n"); printf(" h1 k1 l1 h2 k2 l2 Spacing Angle ESD\n"); printf("--------------------------------------------------------------\n"); |