diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-09-19 23:06:06 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:26:58 +0100 |
commit | 99699c2fc1c81976aa95b47c25a1e7edbda4e58b (patch) | |
tree | 8c90f125a2b75e21fa17799470fd1fa05a51cedf /src | |
parent | 1757b74cf13ceb57ef056a0140c3e97358e640f0 (diff) |
process_hkl: Fix progress bar
Diffstat (limited to 'src')
-rw-r--r-- | src/process_hkl.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/process_hkl.c b/src/process_hkl.c index de1f9b09..beeebb39 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -361,7 +361,7 @@ static void merge_all(FILE *fh, double **pmodel, ReflItemList **pobserved, float f0; int n_nof0 = 0; int f0_valid = 0; - int n_patterns = 1; + int n_patterns = 0; double *new_pattern = new_list_intensity(); ReflItemList *items = new_items(); ReflItemList *observed = new_items(); @@ -396,6 +396,7 @@ static void merge_all(FILE *fh, double **pmodel, ReflItemList **pobserved, int r; rval = fgets(line, 1023, fh); + if ( rval == NULL ) continue; /* And 'break' */ if ( strcmp(line, "\n") == 0 ) { /* Assume a default I0 if we don't have one by now */ @@ -426,14 +427,13 @@ static void merge_all(FILE *fh, double **pmodel, ReflItemList **pobserved, hist_vals, hist_h, hist_k, hist_l, hist_i, devs, tots, means, outfh); + n_patterns++; if ( n_patterns == config_stopafter ) break; + progress_bar(n_patterns, n_total_patterns, "Merging"); /* Reset for the next pattern */ - n_patterns++; clear_items(items); - progress_bar(n_patterns, n_total_patterns-1, "Merging"); - f0_valid = 0; } @@ -501,6 +501,7 @@ static int count_patterns(FILE *fh) char line[1024]; rval = fgets(line, 1023, fh); + if ( rval == NULL ) continue; if ( (strncmp(line, "Reflections from indexing", 25) == 0) || (strncmp(line, "New pattern", 11) == 0) ) { n_total_patterns++; |