aboutsummaryrefslogtreecommitdiff
path: root/src/gui_project.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-25 12:24:30 +0200
committerThomas White <taw@physics.org>2020-08-25 12:31:46 +0200
commitf2f35c529e31d42927ff9d0e6a1e55d4237ee8bb (patch)
treebb138cc1cc85750c6b96785d917f0447d573b261 /src/gui_project.c
parent30a11737e799faa335d049cc9018ada08cf3442e (diff)
Read/write backend options
Diffstat (limited to 'src/gui_project.c')
-rw-r--r--src/gui_project.c39
1 files changed, 39 insertions, 0 deletions
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; i<proj->n_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; i<proj->n_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; i<proj->n_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",