From f2f35c529e31d42927ff9d0e6a1e55d4237ee8bb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 25 Aug 2020 12:24:30 +0200 Subject: Read/write backend options --- src/gui_project.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/gui_project.c') diff --git a/src/gui_project.c b/src/gui_project.c index a38cc305..7d124a5c 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -135,6 +135,21 @@ static void parse_tols(const char *text, float *tols) } +static int find_backend(const char *name, struct crystfelproject *proj) +{ + int i; + + for ( i=0; in_backends; i++ ) { + if ( strcmp(proj->backends[i].name, name) == 0 ) { + return i; + } + } + + ERROR("Couldn't find backend '%s'\n", name); + return 0; +} + + static void handle_var(const char *key, const char *val, struct crystfelproject *proj) { @@ -242,6 +257,10 @@ static void handle_var(const char *key, const char *val, proj->indexing_params.min_peaks = parse_int(val); } + if ( strcmp(key, "indexing.backend") == 0 ) { + proj->indexing_backend_selected = find_backend(val, proj); + } + if ( strcmp(key, "integration.method") == 0 ) { proj->indexing_params.integration_method = strdup(val); } @@ -277,6 +296,18 @@ static void handle_var(const char *key, const char *val, if ( strcmp(key, "search_pattern") == 0 ) { proj->data_search_pattern = decode_matchtype(val); } + + /* Backend indexing option? */ + if ( strncmp(key, "indexing.", 9) == 0 ) { + int i; + for ( i=0; in_backends; i++ ) { + struct crystfel_backend *be; + be = &proj->backends[i]; + be->read_indexing_opt(be->indexing_opts_priv, + key, val); + } + } + } @@ -463,6 +494,14 @@ int save_project(struct crystfelproject *proj) fprintf(fh, "indexing.min_peaks %i\n", proj->indexing_params.min_peaks); + fprintf(fh, "indexing.backend %s\n", + proj->backends[proj->indexing_backend_selected].name); + for ( i=0; in_backends; i++ ) { + struct crystfel_backend *be; + be = &proj->backends[i]; + be->write_indexing_opts(be->indexing_opts_priv, fh); + } + fprintf(fh, "integration.method %s\n", proj->indexing_params.integration_method); fprintf(fh, "integration.overpredict %i\n", -- cgit v1.2.3