diff options
author | Thomas White <taw@physics.org> | 2020-07-02 12:13:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | a9abdf26bcece9846fefd79497b16c4c24cf6772 (patch) | |
tree | a68c1b4eec832d82b4d7643ba1d685e2704ced2c | |
parent | caaf96b2c39a0f3c39f6e87d67b628281410c858 (diff) |
Add default_project (and add Stream to GUI project struct)
-rw-r--r-- | src/crystfel_gui.c | 34 | ||||
-rw-r--r-- | src/gui_project.c | 44 | ||||
-rw-r--r-- | src/gui_project.h | 4 |
3 files changed, 49 insertions, 33 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index d0b6e1cc..c3395534 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -661,39 +661,7 @@ int main(int argc, char *argv[]) gtk_init(&argc, &argv); - proj.unsaved = 0; - proj.geom_filename = NULL; - proj.n_frames = 0; - proj.max_frames = 0; - proj.filenames = NULL; - proj.events = NULL; - proj.peak_params = NULL; - proj.unitcell_combo = NULL; - proj.info_bar = NULL; - proj.backend_private = NULL; - proj.data_top_folder = NULL; - proj.data_search_pattern = 0; - proj.stream_filename = NULL; - - /* Default parameter values */ - proj.show_peaks = 0; - proj.peak_search_params.method = PEAK_ZAEF; - proj.peak_search_params.threshold = 800.0; - proj.peak_search_params.min_sq_gradient = 100000; - proj.peak_search_params.min_snr = 5.0; - proj.peak_search_params.local_bg_radius = 3; - proj.peak_search_params.min_res = 0; - proj.peak_search_params.min_sig = 11.0; - proj.peak_search_params.max_res = 1200; - proj.peak_search_params.min_pix_count = 2; - proj.peak_search_params.max_pix_count = 200; - proj.peak_search_params.min_peak_over_neighbour = -INFINITY; - proj.peak_search_params.pk_inn = 3.0; - proj.peak_search_params.pk_mid = 4.0; - proj.peak_search_params.pk_out = 5.0; - proj.peak_search_params.half_pixel_shift = 1; - proj.peak_search_params.revalidate = 1; - proj.backend = backend_local; + default_project(&proj); proj.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(proj.window), "CrystFEL"); diff --git a/src/gui_project.c b/src/gui_project.c index 48102ac6..ec6f1c45 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -215,6 +215,10 @@ static void handle_var(const char *key, const char *val, proj->data_top_folder = strdup(val); } + if ( strcmp(key, "stream") == 0 ) { + proj->stream_filename = strdup(val); + } + if ( strcmp(key, "search_pattern") == 0 ) { proj->data_search_pattern = decode_matchtype(val); } @@ -338,6 +342,7 @@ int save_project(struct crystfelproject *proj) fprintf(fh, "data_folder %s\n", proj->data_top_folder); fprintf(fh, "search_pattern %s\n", str_matchtype(proj->data_search_pattern)); + fprintf(fh, "stream %s\n", proj->stream_filename); fprintf(fh, "peak_search_params.method %s\n", str_peaksearch(proj->peak_search_params.method)); @@ -390,3 +395,42 @@ int save_project(struct crystfelproject *proj) proj->unsaved = 0; return 0; } + + +void default_project(struct crystfelproject *proj) +{ + proj->unsaved = 0; + proj->geom_filename = NULL; + proj->n_frames = 0; + proj->max_frames = 0; + proj->filenames = NULL; + proj->events = NULL; + proj->peak_params = NULL; + proj->unitcell_combo = NULL; + proj->info_bar = NULL; + proj->backend_private = NULL; + proj->data_top_folder = NULL; + proj->data_search_pattern = 0; + proj->stream_filename = NULL; + proj->stream = NULL; + + /* Default parameter values */ + proj->show_peaks = 0; + proj->peak_search_params.method = PEAK_ZAEF; + proj->peak_search_params.threshold = 800.0; + proj->peak_search_params.min_sq_gradient = 100000; + proj->peak_search_params.min_snr = 5.0; + proj->peak_search_params.local_bg_radius = 3; + proj->peak_search_params.min_res = 0; + proj->peak_search_params.min_sig = 11.0; + proj->peak_search_params.max_res = 1200; + proj->peak_search_params.min_pix_count = 2; + proj->peak_search_params.max_pix_count = 200; + proj->peak_search_params.min_peak_over_neighbour = -INFINITY; + proj->peak_search_params.pk_inn = 3.0; + proj->peak_search_params.pk_mid = 4.0; + proj->peak_search_params.pk_out = 5.0; + proj->peak_search_params.half_pixel_shift = 1; + proj->peak_search_params.revalidate = 1; + proj->backend = backend_local; +} diff --git a/src/gui_project.h b/src/gui_project.h index 5056e8b9..1b2e2525 100644 --- a/src/gui_project.h +++ b/src/gui_project.h @@ -32,6 +32,7 @@ #include <gtk/gtk.h> #include <peaks.h> +#include <stream.h> enum match_type_id { @@ -85,6 +86,7 @@ struct crystfelproject { * 'filenames' list should be complete */ enum match_type_id data_search_pattern; + Stream *stream; int n_frames; int max_frames; char **filenames; @@ -114,6 +116,8 @@ extern int match_filename(const char *fn, enum match_type_id mt); extern int load_project(struct crystfelproject *proj); +extern void default_project(struct crystfelproject *proj); + extern int save_project(struct crystfelproject *proj); extern void add_file_to_project(struct crystfelproject *proj, |