aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-09-08 16:00:58 +0200
committerThomas White <taw@physics.org>2020-09-08 16:16:48 +0200
commit3269c5306a5b185dd364c1e5631e3527f17432b3 (patch)
treefaaf53644085b03c3138e94bc8e355e8df4ece89
parentb38aa96a8c10b0ba58342264ddbac26f854dfb33 (diff)
Add integration radii to CrystFELIndexingOpts
-rw-r--r--src/crystfelindexingopts.c74
-rw-r--r--src/crystfelindexingopts.h11
-rw-r--r--src/gui_index.c8
3 files changed, 92 insertions, 1 deletions
diff --git a/src/crystfelindexingopts.c b/src/crystfelindexingopts.c
index d41c4ad9..f88e4be2 100644
--- a/src/crystfelindexingopts.c
+++ b/src/crystfelindexingopts.c
@@ -420,8 +420,36 @@ static GtkWidget *integration_parameters(CrystFELIndexingOpts *io)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
FALSE, FALSE, 0);
+ /* --int-radii */
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(hbox),
+ FALSE, FALSE, 0);
+
+ label = gtk_label_new("Integration radii - inner:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ io->ir_inn = gtk_entry_new();
+ gtk_entry_set_width_chars(GTK_ENTRY(io->ir_inn), 4);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(io->ir_inn),
+ FALSE, FALSE, 0);
+
+ label = gtk_label_new("middle:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ io->ir_mid = gtk_entry_new();
+ gtk_entry_set_width_chars(GTK_ENTRY(io->ir_mid), 4);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(io->ir_mid),
+ FALSE, FALSE, 0);
+
+ label = gtk_label_new("outer:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ io->ir_out = gtk_entry_new();
+ gtk_entry_set_width_chars(GTK_ENTRY(io->ir_out), 4);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(io->ir_out),
+ FALSE, FALSE, 0);
+
/* FIXME: fix-bandwidth, divergence, profile-radius */
- /* FIXME: --int-radius */
return box;
}
@@ -823,3 +851,47 @@ void crystfel_indexing_opts_set_push_res(CrystFELIndexingOpts *opts,
snprintf(tmp, 63, "%f", push_res);
gtk_entry_set_text(GTK_ENTRY(opts->push_res), tmp);
}
+
+
+void crystfel_indexing_opts_set_integration_radii(CrystFELIndexingOpts *opts,
+ float ir_inn,
+ float ir_mid,
+ float ir_out)
+{
+ char tmp[64];
+
+ snprintf(tmp, 63, "%f", ir_inn);
+ gtk_entry_set_text(GTK_ENTRY(opts->ir_inn), tmp);
+
+ snprintf(tmp, 63, "%f", ir_mid);
+ gtk_entry_set_text(GTK_ENTRY(opts->ir_mid), tmp);
+
+ snprintf(tmp, 63, "%f", ir_out);
+ gtk_entry_set_text(GTK_ENTRY(opts->ir_out), tmp);
+}
+
+
+static void get_float_val(GtkEntry *entry, float *pval)
+{
+ float val;
+ char *rval;
+ const gchar *text = gtk_entry_get_text(entry);
+ errno = 0;
+ val = strtod(text, &rval);
+ if ( *rval != '\0' ) {
+ printf("Invalid integration radius '%s'\n", text);
+ } else {
+ *pval = val;
+ }
+}
+
+
+void crystfel_indexing_opts_get_integration_radii(CrystFELIndexingOpts *opts,
+ float *ir_inn,
+ float *ir_mid,
+ float *ir_out)
+{
+ get_float_val(GTK_ENTRY(opts->ir_inn), ir_inn);
+ get_float_val(GTK_ENTRY(opts->ir_mid), ir_mid);
+ get_float_val(GTK_ENTRY(opts->ir_out), ir_out);
+}
diff --git a/src/crystfelindexingopts.h b/src/crystfelindexingopts.h
index 197f8863..ddf6b1b2 100644
--- a/src/crystfelindexingopts.h
+++ b/src/crystfelindexingopts.h
@@ -73,6 +73,9 @@ struct _crystfelindexingopts
GtkWidget *overpredict;
GtkWidget *limit_res;
GtkWidget *push_res;
+ GtkWidget *ir_inn;
+ GtkWidget *ir_mid;
+ GtkWidget *ir_out;
};
struct _crystfelindexingoptsclass
@@ -100,6 +103,10 @@ extern int crystfel_indexing_opts_get_min_peaks(CrystFELIndexingOpts *opts);
extern char *crystfel_indexing_opts_get_integration_method_string(CrystFELIndexingOpts *opts);
extern int crystfel_indexing_opts_get_overpredict(CrystFELIndexingOpts *opts);
extern float crystfel_indexing_opts_get_push_res(CrystFELIndexingOpts *opts);
+extern void crystfel_indexing_opts_get_integration_radii(CrystFELIndexingOpts *opts,
+ float *ir_inn,
+ float *ir_mid,
+ float *ir_out);
extern void crystfel_indexing_opts_set_cell_file(CrystFELIndexingOpts *opts,
@@ -127,5 +134,9 @@ extern void crystfel_indexing_opts_set_overpredict(CrystFELIndexingOpts *opts,
int overpredict);
extern void crystfel_indexing_opts_set_push_res(CrystFELIndexingOpts *opts,
float push_res);
+extern void crystfel_indexing_opts_set_integration_radii(CrystFELIndexingOpts *opts,
+ float ir_inn,
+ float ir_mid,
+ float ir_out);
#endif /* CRYSTFELINDEXINGOPTS_H */
diff --git a/src/gui_index.c b/src/gui_index.c
index d11028b4..4395a90e 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -87,6 +87,10 @@ static void get_indexing_opts(struct crystfelproject *proj,
proj->indexing_params.integration_method = crystfel_indexing_opts_get_integration_method_string(opts);
proj->indexing_params.overpredict = crystfel_indexing_opts_get_overpredict(opts);
proj->indexing_params.push_res = crystfel_indexing_opts_get_push_res(opts);
+ crystfel_indexing_opts_get_integration_radii(opts,
+ &proj->indexing_params.ir_inn,
+ &proj->indexing_params.ir_mid,
+ &proj->indexing_params.ir_out);
}
@@ -321,6 +325,10 @@ static void set_indexing_opts(struct crystfelproject *proj,
crystfel_indexing_opts_set_integration_method_string(opts, proj->indexing_params.integration_method);
crystfel_indexing_opts_set_overpredict(opts, proj->indexing_params.overpredict);
crystfel_indexing_opts_set_push_res(opts, proj->indexing_params.push_res);
+ crystfel_indexing_opts_set_integration_radii(opts,
+ proj->indexing_params.ir_inn,
+ proj->indexing_params.ir_mid,
+ proj->indexing_params.ir_out);
}