aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c11
-rw-r--r--src/refine.c24
-rw-r--r--src/refinetest2d.c27
-rw-r--r--src/refinetest3d.c27
4 files changed, 59 insertions, 30 deletions
diff --git a/src/main.c b/src/main.c
index 6259818..1f14e72 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,7 +55,8 @@ void main_do_reconstruction(ControlContext *ctx) {
/* Find all the features */
printf("MA: Analysing images..."); fflush(stdout);
for ( i=0; i<ctx->images->n_images; i++ ) {
- ctx->images->images[i].features = itrans_process_image(&ctx->images->images[i], ctx->psmode);
+ ctx->images->images[i].features = itrans_process_image(&ctx->images->images[i],
+ ctx->psmode);
itrans_quantify_features(&ctx->images->images[i]);
}
printf("done.\n");
@@ -106,7 +107,7 @@ static gint main_method_window_response(GtkWidget *method_window, gint response,
case 2 : ctx->psmode = PEAKSEARCH_ZAEFFERER; break;
case 3 : ctx->psmode = PEAKSEARCH_STAT; break;
case 4 : ctx->psmode = PEAKSEARCH_CACHED; break;
- default: ctx->psmode = PEAKSEARCH_NONE; break; /* This happens when reading from a cache file */
+ default: ctx->psmode = PEAKSEARCH_NONE; break; /* Happens when reading from a cache file */
}
if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->checkbox_prealign)) ) {
@@ -189,7 +190,8 @@ void main_method_dialog_open(ControlContext *ctx) {
GtkWidget *cache_file_selector_label;
method_window = gtk_dialog_new_with_buttons("Reconstruction Parameters", NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_window_set_default_size(GTK_WINDOW(method_window), 400, -1);
vbox = gtk_vbox_new(FALSE, 0);
@@ -216,7 +218,8 @@ void main_method_dialog_open(ControlContext *ctx) {
cache_file_selector_label = gtk_label_new("Cache File to Load: ");
gtk_table_attach_defaults(GTK_TABLE(table), cache_file_selector_label, 1, 2, 2, 3);
gtk_misc_set_alignment(GTK_MISC(cache_file_selector_label), 1, 0.5);
- ctx->cache_file_selector = gtk_file_chooser_button_new("Select Cache File to Load", GTK_FILE_CHOOSER_ACTION_OPEN);
+ ctx->cache_file_selector = gtk_file_chooser_button_new("Select Cache File to Load",
+ GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_table_attach_defaults(GTK_TABLE(table), ctx->cache_file_selector, 2, 3, 2, 3);
gtk_widget_set_sensitive(GTK_WIDGET(ctx->cache_file_selector), FALSE);
diff --git a/src/refine.c b/src/refine.c
index b3ac84a..5de8df3 100644
--- a/src/refine.c
+++ b/src/refine.c
@@ -80,7 +80,8 @@ void refine_do_sequence(ControlContext *ctx) {
reproject_lattice_changed(ctx);
fit = refine_do_cell(ctx);
- printf("RF: omega_offs=%f deg, fit=%f nm^-1\n", rad2deg(omega_offs), fit/DISPFACTOR);
+ printf("RF: omega_offs=%f deg, fit=%f nm^-1\n", rad2deg(omega_offs),
+ fit/DISPFACTOR);
fit_vals[idx++] = fit;
if ( fit < fit_best ) {
fit_best = fit;
@@ -254,21 +255,25 @@ static double refine_iteration(SimplexVertex *s, Deviation *d, int nf) {
/* Is the worst vertex any better? */
fom_new = refine_mean_dev(d, nf, s, v_worst);
- if ( REFINE_DEBUG ) printf("New mean deviation for the worst vertex after reflection is %f nm^-1\n", fom_new/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("New mean deviation for the worst vertex after reflection is %f nm^-1\n",
+ fom_new/DISPFACTOR);
if ( fom_new > fom_worst ) {
double fom_new_new;
/* It's worse than before. Contract in 1D and see if that helps. */
if ( REFINE_DEBUG ) printf("Worse. Trying a 1D contraction...\n");
- refine_simplex_transform(s, v_worst, -0.5); /* Minus puts it back on the original side of the 'good' face */
+ /* Minus puts it back on the original side of the 'good' face */
+ refine_simplex_transform(s, v_worst, -0.5);
fom_new_new = refine_mean_dev(d, nf, s, v_worst);
- if ( REFINE_DEBUG ) printf("Mean deviation after 1D contraction is %f nm^-1\n", fom_new_new/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("Mean deviation after 1D contraction is %f nm^-1\n",
+ fom_new_new/DISPFACTOR);
if ( fom_new_new > fom_second_worst ) {
int i;
- if ( REFINE_DEBUG ) printf("Not as good as the second worst vertex: contracting around the best vertex (%i)\n", v_best);
+ if ( REFINE_DEBUG ) printf("Not as good as the second worst vertex: contracting around the "
+ "best vertex (%i)\n", v_best);
for ( i=0; i<=NUM_PARAMS; i++ ) {
if ( i != v_best ) refine_simplex_contract(s, i, v_best);
}
@@ -346,7 +351,8 @@ double refine_do_cell(ControlContext *ctx) {
int j;
if ( !ctx->images->images[i].rflist ) {
- ctx->images->images[i].rflist = reproject_get_reflections(&ctx->images->images[i], ctx->cell_lattice);
+ ctx->images->images[i].rflist = reproject_get_reflections(&ctx->images->images[i],
+ ctx->cell_lattice);
}
for ( j=0; j<ctx->images->images[i].rflist->n_features; j++ ) {
@@ -385,7 +391,8 @@ double refine_do_cell(ControlContext *ctx) {
/* Determine the difference vector */
dix = rf->partner->x - rf->x;
diy = rf->partner->y - rf->y;
- //printf("RF: Feature %3i: %3i %3i %3i dev = %+9.5f %+9.5f px ", j, d[f].h, d[f].k, d[f].l, dix, diy);
+ //printf("RF: Feature %3i: %3i %3i %3i dev = %+9.5f %+9.5f px ", j, d[f].h, d[f].k, d[f].l,
+ // dix, diy);
old_x = rf->partner->x;
old_y = rf->partner->y;
@@ -437,7 +444,8 @@ double refine_do_cell(ControlContext *ctx) {
if ( REFINE_DEBUG ) printf("------------------- Simplex method iteration %i -------------------\n", it);
conv = refine_iteration(s, d, nf);
if ( conv < tol ) {
- if ( REFINE_DEBUG ) printf("RF: Converged after %i iterations (%f nm^-1)\n", it, conv/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("RF: Converged after %i iterations (%f nm^-1)\n", it,
+ conv/DISPFACTOR);
break;
}
diff --git a/src/refinetest2d.c b/src/refinetest2d.c
index 49a0c6b..ea4d206 100644
--- a/src/refinetest2d.c
+++ b/src/refinetest2d.c
@@ -44,39 +44,48 @@ static int check_cell(Basis *cell, Basis *cell_real) {
fail = 0;
if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", cell->a.x/1e9, cell_real->a.x/1e9);
+ fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n",
+ cell->a.x/1e9, cell_real->a.x/1e9);
fail = 1;
}
if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", cell->a.y/1e9, cell_real->a.y/1e9);
+ fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n",
+ cell->a.y/1e9, cell_real->a.y/1e9);
fail = 1;
}
// if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) {
-// fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", cell->a.z/1e9, cell_real->a.z/1e9);
+// fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n",
+// cell->a.z/1e9, cell_real->a.z/1e9);
// fail = 1;
// }
if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", cell->b.x/1e9, cell_real->b.x/1e9);
+ fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n",
+ cell->b.x/1e9, cell_real->b.x/1e9);
fail = 1;
}
if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", cell->b.y/1e9, cell_real->b.y/1e9);
+ fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n",
+ cell->b.y/1e9, cell_real->b.y/1e9);
fail = 1;
}
// if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) {
-// fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", cell->b.z/1e9, cell_real->b.z/1e9);
+// fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n",
+// cell->b.z/1e9, cell_real->b.z/1e9);
// fail = 1;
// }
// if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) {
-// fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", cell->c.x/1e9, cell_real->c.x/1e9);
+// fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n",
+// cell->c.x/1e9, cell_real->c.x/1e9);
// fail = 1;
// }
// if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) {
-// fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", cell->c.y/1e9, cell_real->c.y/1e9);
+// fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n",
+// cell->c.y/1e9, cell_real->c.y/1e9);
// fail = 1;
// }
// if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) {
-// fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", cell->c.z/1e9, cell_real->c.z/1e9);
+// fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n",
+// cell->c.z/1e9, cell_real->c.z/1e9);
// fail = 1;
// }
diff --git a/src/refinetest3d.c b/src/refinetest3d.c
index c78adbb..f7a8896 100644
--- a/src/refinetest3d.c
+++ b/src/refinetest3d.c
@@ -40,39 +40,48 @@ static int check_cell(Basis *cell, Basis *cell_real) {
fail = 0;
if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", cell->a.x/1e9, cell_real->a.x/1e9);
+ fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n",
+ cell->a.x/1e9, cell_real->a.x/1e9);
fail = 1;
}
if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", cell->a.y/1e9, cell_real->a.y/1e9);
+ fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n",
+ cell->a.y/1e9, cell_real->a.y/1e9);
fail = 1;
}
if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", cell->a.z/1e9, cell_real->a.z/1e9);
+ fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n",
+ cell->a.z/1e9, cell_real->a.z/1e9);
fail = 1;
}
if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", cell->b.x/1e9, cell_real->b.x/1e9);
+ fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n",
+ cell->b.x/1e9, cell_real->b.x/1e9);
fail = 1;
}
if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", cell->b.y/1e9, cell_real->b.y/1e9);
+ fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n",
+ cell->b.y/1e9, cell_real->b.y/1e9);
fail = 1;
}
if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", cell->b.z/1e9, cell_real->b.z/1e9);
+ fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n",
+ cell->b.z/1e9, cell_real->b.z/1e9);
fail = 1;
}
if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", cell->c.x/1e9, cell_real->c.x/1e9);
+ fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n",
+ cell->c.x/1e9, cell_real->c.x/1e9);
fail = 1;
}
if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", cell->c.y/1e9, cell_real->c.y/1e9);
+ fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n",
+ cell->c.y/1e9, cell_real->c.y/1e9);
fail = 1;
}
if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) {
- fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", cell->c.z/1e9, cell_real->c.z/1e9);
+ fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n",
+ cell->c.z/1e9, cell_real->c.z/1e9);
fail = 1;
}