aboutsummaryrefslogtreecommitdiff
path: root/src/gui_ambi.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-02-17 17:22:28 +0100
committerThomas White <taw@physics.org>2021-02-17 17:22:28 +0100
commite0437375017e504124cab53e5d19f4da499e88e7 (patch)
tree2963056cf418fbaeecf0e398b5e7a1000b004cd7 /src/gui_ambi.c
parent5a549e4fdc6265748fa2eabacb19f5ff850d27eb (diff)
GUI: Re-work local backend plumbing
A single command line is not expressive enough for at least two cases: process_hkl, which needs to be run two extra times to generate the splits, and ambigator, which needs to have its input streams concatenated first. This also splits out the routine for creating the working folder and writing the notes file.
Diffstat (limited to 'src/gui_ambi.c')
-rw-r--r--src/gui_ambi.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gui_ambi.c b/src/gui_ambi.c
index 294196fc..8ab0acc3 100644
--- a/src/gui_ambi.c
+++ b/src/gui_ambi.c
@@ -452,3 +452,39 @@ gint ambi_sig(GtkWidget *widget, struct crystfelproject *proj)
return FALSE;
}
+
+
+int write_ambigator_script(const char *filename,
+ struct gui_indexing_result *input,
+ const char *n_thread_str,
+ struct ambi_params *params,
+ const char *out_stream)
+{
+ FILE *fh;
+ char *exe_path;
+ int i;
+
+ fh = fopen(filename, "w");
+ if ( fh == NULL ) return 1;
+
+ fprintf(fh, "cat \\\n");
+ for ( i=0; i<input->n_streams; i++ ) {
+ fprintf(fh, "%s \\\n", input->streams[i]);
+ }
+
+ exe_path = get_crystfel_exe("ambigator");
+ if ( exe_path == NULL ) return 1;
+ fprintf(fh, "| %s - \\\n", exe_path);
+
+ fprintf(fh, " -j %s", n_thread_str);
+ fprintf(fh, " -o %s", out_stream);
+ fprintf(fh, " -y %s", params->sym);
+// if ( params->source_sym != NULL ) {
+// fprintf(fh, " -w %s", params->source_sym);
+// }
+
+ fprintf(fh, " --iterations=%i", params->niter);
+
+ fclose(fh);
+ return 0;
+}