aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui_ambi.c44
-rw-r--r--src/gui_project.c60
-rw-r--r--src/gui_project.h22
3 files changed, 65 insertions, 61 deletions
diff --git a/src/gui_ambi.c b/src/gui_ambi.c
index d5a295cf..294196fc 100644
--- a/src/gui_ambi.c
+++ b/src/gui_ambi.c
@@ -125,15 +125,15 @@ static void ambi_response_sig(GtkWidget *dialog, gint resp,
char *job_notes;
const char *results_name;
- win->proj->ambi_use_res = get_bool(win->limit_res);
- win->proj->ambi_res_min = get_float(win->min_res);
- win->proj->ambi_res_max = get_float(win->max_res);
- win->proj->ambi_niter = get_uint(win->niter);
- win->proj->ambi_use_ncorr = get_bool(win->use_ncorr);
- win->proj->ambi_ncorr = get_uint(win->ncorr);
- win->proj->ambi_sym = get_sym(win->sym);
- win->proj->ambi_source_sym = get_sym(win->source_sym);
- win->proj->ambi_operator = get_str(win->operator);
+ win->proj->ambi_params.use_res = get_bool(win->limit_res);
+ win->proj->ambi_params.res_min = get_float(win->min_res);
+ win->proj->ambi_params.res_max = get_float(win->max_res);
+ win->proj->ambi_params.niter = get_uint(win->niter);
+ win->proj->ambi_params.use_ncorr = get_bool(win->use_ncorr);
+ win->proj->ambi_params.ncorr = get_uint(win->ncorr);
+ win->proj->ambi_params.sym = get_sym(win->sym);
+ win->proj->ambi_params.source_sym = get_sym(win->source_sym);
+ win->proj->ambi_params.operator = get_str(win->operator);
backend_idx = gtk_combo_box_get_active(GTK_COMBO_BOX(win->backend_combo));
if ( backend_idx < 0 ) return;
@@ -193,7 +193,7 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->sym),
FALSE, FALSE, 4.0);
crystfel_symmetry_selector_set_group_symbol(CRYSTFEL_SYMMETRY_SELECTOR(win->sym),
- proj->ambi_sym);
+ proj->ambi_params.sym);
hbox = gtk_hbox_new(FALSE, 0.0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
@@ -205,7 +205,7 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->source_sym),
FALSE, FALSE, 4.0);
crystfel_symmetry_selector_set_group_symbol(CRYSTFEL_SYMMETRY_SELECTOR(win->source_sym),
- proj->ambi_source_sym);
+ proj->ambi_params.source_sym);
g_signal_connect(G_OBJECT(win->use_source_sym), "toggled",
G_CALLBACK(i_maybe_disable), win->source_sym);
@@ -217,13 +217,13 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->use_operator),
FALSE, FALSE, 4.0);
win->operator = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(win->operator), proj->ambi_operator);
+ gtk_entry_set_text(GTK_ENTRY(win->operator), proj->ambi_params.operator);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->operator),
FALSE, FALSE, 4.0);
g_signal_connect(G_OBJECT(win->use_operator), "toggled",
G_CALLBACK(i_maybe_disable), win->operator);
- if ( proj->ambi_source_sym != NULL ) {
+ if ( proj->ambi_params.source_sym != NULL ) {
gtk_widget_set_sensitive(win->operator, FALSE);
set_active(win->use_source_sym, TRUE);
} else {
@@ -235,12 +235,12 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
FALSE, FALSE, 4.0);
win->limit_res = gtk_check_button_new_with_label("Restrict resolution range:");
- set_active(win->limit_res, proj->ambi_use_res);
+ set_active(win->limit_res, proj->ambi_params.use_res);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->limit_res),
FALSE, FALSE, 4.0);
win->min_res = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(win->min_res), 6);
- snprintf(tmp, 64, "%.2f", proj->ambi_res_min);
+ snprintf(tmp, 64, "%.2f", proj->ambi_params.res_min);
gtk_entry_set_text(GTK_ENTRY(win->min_res), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->min_res),
FALSE, FALSE, 4.0);
@@ -249,7 +249,7 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
FALSE, FALSE, 4.0);
win->max_res = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(win->max_res), 6);
- snprintf(tmp, 64, "%.2f", proj->ambi_res_max);
+ snprintf(tmp, 64, "%.2f", proj->ambi_params.res_max);
gtk_entry_set_text(GTK_ENTRY(win->max_res), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->max_res),
FALSE, FALSE, 4.0);
@@ -260,8 +260,8 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
G_CALLBACK(i_maybe_disable), win->min_res);
g_signal_connect(G_OBJECT(win->limit_res), "toggled",
G_CALLBACK(i_maybe_disable), win->max_res);
- gtk_widget_set_sensitive(win->min_res, proj->ambi_use_res);
- gtk_widget_set_sensitive(win->max_res, proj->ambi_use_res);
+ gtk_widget_set_sensitive(win->min_res, proj->ambi_params.use_res);
+ gtk_widget_set_sensitive(win->max_res, proj->ambi_params.use_res);
hbox = gtk_hbox_new(FALSE, 0.0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
@@ -271,14 +271,14 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
FALSE, FALSE, 4.0);
win->ncorr = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(win->ncorr), 6);
- snprintf(tmp, 64, "%i", proj->ambi_ncorr);
+ snprintf(tmp, 64, "%i", proj->ambi_params.ncorr);
gtk_entry_set_text(GTK_ENTRY(win->ncorr), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->ncorr),
FALSE, FALSE, 4.0);
g_signal_connect(G_OBJECT(win->use_ncorr), "toggled",
G_CALLBACK(i_maybe_disable), win->ncorr);
- set_active(win->use_ncorr, proj->ambi_use_ncorr);
- gtk_widget_set_sensitive(win->ncorr, proj->ambi_use_ncorr);
+ set_active(win->use_ncorr, proj->ambi_params.use_ncorr);
+ gtk_widget_set_sensitive(win->ncorr, proj->ambi_params.use_ncorr);
hbox = gtk_hbox_new(FALSE, 0.0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
@@ -288,7 +288,7 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
FALSE, FALSE, 4.0);
win->niter = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(win->niter), 2);
- snprintf(tmp, 64, "%i", proj->ambi_niter);
+ snprintf(tmp, 64, "%i", proj->ambi_params.niter);
gtk_entry_set_text(GTK_ENTRY(win->niter), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->niter),
FALSE, FALSE, 4.0);
diff --git a/src/gui_project.c b/src/gui_project.c
index aea76d1e..af50dec2 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -316,31 +316,31 @@ static void parse_ambi_opt(const char *key, const char *val,
struct crystfelproject *proj)
{
if ( strcmp(key, "ambi.min_res_A") == 0 ) {
- proj->ambi_res_min = parse_float(val);
+ proj->ambi_params.res_min = parse_float(val);
}
if ( strcmp(key, "ambi.max_res_A") == 0 ) {
- proj->ambi_res_max = parse_float(val);
+ proj->ambi_params.res_max = parse_float(val);
}
if ( strcmp(key, "ambi.use_res") == 0 ) {
- proj->ambi_use_res = parse_int(val);
+ proj->ambi_params.use_res = parse_int(val);
}
if ( strcmp(key, "ambi.niter") == 0 ) {
- proj->ambi_niter = parse_int(val);
+ proj->ambi_params.niter = parse_int(val);
}
if ( strcmp(key, "ambi.ncorr") == 0 ) {
- proj->ambi_ncorr = parse_int(val);
+ proj->ambi_params.ncorr = parse_int(val);
}
if ( strcmp(key, "ambi.use_ncorr") == 0 ) {
- proj->ambi_use_ncorr = parse_int(val);
+ proj->ambi_params.use_ncorr = parse_int(val);
}
if ( strcmp(key, "ambi.sym") == 0 ) {
- proj->ambi_sym = strdup(val);
+ proj->ambi_params.sym = strdup(val);
}
if ( strcmp(key, "ambi.source_sym") == 0 ) {
- proj->ambi_source_sym = strdup(val);
+ proj->ambi_params.source_sym = strdup(val);
}
if ( strcmp(key, "ambi.operator") == 0 ) {
- proj->ambi_operator = strdup(val);
+ proj->ambi_params.operator = strdup(val);
}
}
@@ -913,20 +913,20 @@ int save_project(struct crystfelproject *proj)
}
}
- fprintf(fh, "ambi.min_res_A %f\n", proj->ambi_res_min);
- fprintf(fh, "ambi.max_res_A %f\n", proj->ambi_res_max);
- fprintf(fh, "ambi.use_res %i\n", proj->ambi_use_res);
- fprintf(fh, "ambi.niter %i\n", proj->ambi_niter);
- fprintf(fh, "ambi.ncorr %i\n", proj->ambi_ncorr);
- fprintf(fh, "ambi.use_ncorr %i\n", proj->ambi_use_ncorr);
- if ( proj->ambi_sym != NULL ) {
- fprintf(fh, "ambi.sym %s\n", proj->ambi_sym);
+ fprintf(fh, "ambi.min_res_A %f\n", proj->ambi_params.res_min);
+ fprintf(fh, "ambi.max_res_A %f\n", proj->ambi_params.res_max);
+ fprintf(fh, "ambi.use_res %i\n", proj->ambi_params.use_res);
+ fprintf(fh, "ambi.niter %i\n", proj->ambi_params.niter);
+ fprintf(fh, "ambi.ncorr %i\n", proj->ambi_params.ncorr);
+ fprintf(fh, "ambi.use_ncorr %i\n", proj->ambi_params.use_ncorr);
+ if ( proj->ambi_params.sym != NULL ) {
+ fprintf(fh, "ambi.sym %s\n", proj->ambi_params.sym);
}
- if ( proj->ambi_source_sym != NULL ) {
- fprintf(fh, "ambi.source_sym %s\n", proj->ambi_source_sym);
+ if ( proj->ambi_params.source_sym != NULL ) {
+ fprintf(fh, "ambi.source_sym %s\n", proj->ambi_params.source_sym);
}
- if ( proj->ambi_operator != NULL ) {
- fprintf(fh, "ambi.operator %s\n", proj->ambi_operator);
+ if ( proj->ambi_params.operator != NULL ) {
+ fprintf(fh, "ambi.operator %s\n", proj->ambi_params.operator);
}
if ( proj->ambi_new_job_title != NULL ) {
fprintf(fh, "ambi.new_job_title %s\n",
@@ -1114,15 +1114,15 @@ void default_project(struct crystfelproject *proj)
proj->indexing_params.metadata_to_copy = NULL;
proj->indexing_params.n_metadata = 0;
- proj->ambi_use_res = 1;
- proj->ambi_res_min = 20; /* Angstroms */
- proj->ambi_res_max = 4; /* Angstroms */
- proj->ambi_niter = 4;
- proj->ambi_use_ncorr = 0;
- proj->ambi_ncorr = 1000;
- proj->ambi_sym = NULL;
- proj->ambi_source_sym = NULL;
- proj->ambi_operator = NULL;
+ proj->ambi_params.use_res = 1;
+ proj->ambi_params.res_min = 20; /* Angstroms */
+ proj->ambi_params.res_max = 4; /* Angstroms */
+ proj->ambi_params.niter = 4;
+ proj->ambi_params.use_ncorr = 0;
+ proj->ambi_params.ncorr = 1000;
+ proj->ambi_params.sym = NULL;
+ proj->ambi_params.source_sym = NULL;
+ proj->ambi_params.operator = NULL;
proj->merging_params.model = strdup("unity");
proj->merging_params.symmetry = strdup("1");
diff --git a/src/gui_project.h b/src/gui_project.h
index 123a926a..f62de101 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -114,6 +114,18 @@ struct merging_params {
float push_res;
};
+struct ambi_params {
+ int use_res;
+ double res_min; /* Angstroms */
+ double res_max; /* Angstroms */
+ int niter;
+ int use_ncorr;
+ int ncorr;
+ char *sym;
+ char *source_sym;
+ char *operator;
+};
+
struct gui_indexing_result
{
char *name;
@@ -308,15 +320,7 @@ struct crystfelproject {
char *ambi_new_job_title;
int ambi_backend_selected;
GtkWidget *ambi_opts;
- int ambi_use_res;
- double ambi_res_min; /* Angstroms */
- double ambi_res_max; /* Angstroms */
- int ambi_niter;
- int ambi_use_ncorr;
- int ambi_ncorr;
- char *ambi_sym;
- char *ambi_source_sym;
- char *ambi_operator;
+ struct ambi_params ambi_params;
};
extern enum match_type_id decode_matchtype(const char *type_id);