aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-01-22 11:25:10 +0100
committerThomas White <taw@physics.org>2021-01-22 11:25:10 +0100
commit27a6976e7ec7a5309475bcfe360ec13cb418175f (patch)
tree596af550f48392a7992c6c8bc1abe29bf74091ae
parent0985233e652cce6017ef61abbd857a5440e3e46b (diff)
GUI: Set default values for FoM parameters
-rw-r--r--src/gui_fom.c21
-rw-r--r--src/gui_project.c6
-rw-r--r--src/gui_project.h6
3 files changed, 31 insertions, 2 deletions
diff --git a/src/gui_fom.c b/src/gui_fom.c
index 73d80f41..936a39fb 100644
--- a/src/gui_fom.c
+++ b/src/gui_fom.c
@@ -121,6 +121,8 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
GtkWidget *entry;
GtkWidget *check;
GtkWidget *da;
+ int i;
+ char tmp[64];
dialog = gtk_dialog_new_with_buttons("Calculate figures of merit",
GTK_WINDOW(proj->window),
@@ -146,8 +148,13 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
combo = gtk_combo_box_text_new();
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(combo),
FALSE, FALSE, 4.0);
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
- "xxx", "Dummy result");
+ for ( i=0; i<proj->n_merge_results; i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ proj->merge_results[i].name,
+ proj->merge_results[i].name);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo),
+ proj->n_merge_results-1);
label = gtk_label_new("Figures of merit to show:");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
@@ -166,6 +173,8 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
FALSE, FALSE, 4.0);
entry = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(entry), 4);
+ snprintf(tmp, 64, "%.2f", proj->fom_res_min);
+ gtk_entry_set_text(GTK_ENTRY(entry), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry),
FALSE, FALSE, 4.0);
label = gtk_label_new("to");
@@ -173,6 +182,8 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
FALSE, FALSE, 4.0);
entry = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(entry), 4);
+ snprintf(tmp, 64, "%.2f", proj->fom_res_max);
+ gtk_entry_set_text(GTK_ENTRY(entry), tmp);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry),
FALSE, FALSE, 4.0);
label = gtk_label_new("Å. Number of bins:");
@@ -182,17 +193,23 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
gtk_entry_set_width_chars(GTK_ENTRY(entry), 4);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry),
FALSE, FALSE, 4.0);
+ snprintf(tmp, 64, "%i", proj->fom_nbins);
+ gtk_entry_set_text(GTK_ENTRY(entry), tmp);
hbox = gtk_hbox_new(FALSE, 0.0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
FALSE, FALSE, 4.0);
check = gtk_check_button_new_with_label("Discard reflections with I/sigI less than");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
+ proj->fom_use_min_snr);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(check),
FALSE, FALSE, 4.0);
entry = gtk_entry_new();
gtk_entry_set_width_chars(GTK_ENTRY(entry), 4);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry),
FALSE, FALSE, 4.0);
+ snprintf(tmp, 64, "%.2f", proj->fom_min_snr);
+ gtk_entry_set_text(GTK_ENTRY(entry), tmp);
da = gtk_drawing_area_new();
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(da),
diff --git a/src/gui_project.c b/src/gui_project.c
index ec6f616b..3eb2293d 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -1014,6 +1014,12 @@ void default_project(struct crystfelproject *proj)
proj->merge_results = NULL;
proj->n_merge_results = 0;
+
+ proj->fom_res_min = 0.0;
+ proj->fom_res_max = INFINITY;
+ proj->fom_nbins = 20;
+ proj->fom_min_snr = 0.0;
+ proj->fom_use_min_snr = 0;
}
diff --git a/src/gui_project.h b/src/gui_project.h
index db1ad2ad..81bf3884 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -265,6 +265,12 @@ struct crystfelproject {
struct gui_merge_result *merge_results;
int n_merge_results;
+
+ double fom_res_min;
+ double fom_res_max;
+ int fom_nbins;
+ double fom_min_snr;
+ int fom_use_min_snr;
};
extern enum match_type_id decode_matchtype(const char *type_id);