diff options
author | Thomas White <taw@physics.org> | 2021-02-09 15:33:01 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-02-09 15:33:01 +0100 |
commit | 60932e51e0e488555793793e3a802eeb6b988dd9 (patch) | |
tree | c21d69f0ea38f3ce154c7635727748363ec60722 | |
parent | 6dd93e7278f0ff3dc7be63b9dd5b28b30c17f3da (diff) |
GUI: Load/save FoM parameters
-rw-r--r-- | src/gui_fom.c | 2 | ||||
-rw-r--r-- | src/gui_project.c | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/gui_fom.c b/src/gui_fom.c index c117b7ee..1f8fe1cc 100644 --- a/src/gui_fom.c +++ b/src/gui_fom.c @@ -652,6 +652,8 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj) GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(f->cell_chooser), TRUE); + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(f->cell_chooser), + proj->fom_cell_filename); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(f->cell_chooser), FALSE, FALSE, 4.0); button = gtk_button_new_from_icon_name("edit-clear", diff --git a/src/gui_project.c b/src/gui_project.c index addf87bb..6c9c5e5f 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -312,6 +312,30 @@ static void add_metadata_to_copy(struct index_params *ip, } +static void parse_fom_opt(const char *key, const char *val, + struct crystfelproject *proj) +{ + if ( strcmp(key, "fom.min_res_A") == 0 ) { + proj->fom_res_min = parse_float(val); + } + if ( strcmp(key, "fom.max_res_A") == 0 ) { + proj->fom_res_max = parse_float(val); + } + if ( strcmp(key, "fom.min_snr") == 0 ) { + proj->fom_min_snr = parse_float(val); + } + if ( strcmp(key, "fom.num_bins") == 0 ) { + proj->fom_nbins = parse_int(val); + } + if ( strcmp(key, "fom.min_meas") == 0 ) { + proj->fom_min_meas = parse_int(val); + } + if ( strcmp(key, "fom.cell_file") == 0 ) { + proj->fom_cell_filename = strdup(val); + } +} + + static void parse_stream_opt(const char *key, const char *val, struct index_params *ip) { @@ -432,6 +456,10 @@ static void handle_var(const char *key, const char *val, proj->data_top_folder = strdup(val); } + if ( strncmp(key, "fom.", 4) == 0 ) { + parse_fom_opt(key, val, proj); + } + if ( strncmp(key, "stream.", 7) == 0 ) { parse_stream_opt(key, val, &proj->indexing_params); } else if ( strcmp(key, "stream") == 0 ) { @@ -880,6 +908,13 @@ int save_project(struct crystfelproject *proj) be->write_merging_opts(be->merging_opts_priv, fh); } + fprintf(fh, "fom.min_res_A %f\n", proj->fom_res_min); + fprintf(fh, "fom.max_res_A %f\n", proj->fom_res_max); + fprintf(fh, "fom.num_bins %i\n", proj->fom_nbins); + fprintf(fh, "fom.min_snr %f\n", proj->fom_min_snr); + fprintf(fh, "fom.min_meas %i\n", proj->fom_min_meas); + fprintf(fh, "fom.cell_file %s\n", proj->fom_cell_filename); + fprintf(fh, "show_peaks %i\n", proj->show_peaks); fprintf(fh, "show_refls %i\n", proj->show_refls); fprintf(fh, "label_refls %i\n", proj->label_refls); |