diff options
author | Thomas White <taw@physics.org> | 2010-11-22 16:22:36 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:06 +0100 |
commit | db616846b0eb82b1d801c7261eec6fd501a8b763 (patch) | |
tree | 35d889142373c43da6e0459593cca3b4489fd18c | |
parent | c84b3275243f19e6496da6b39766c8b7a8ac435e (diff) |
facetron: Also output bar chart of pattern fits
-rw-r--r-- | scripts/facetron-partiality.gp (renamed from scripts/facetron.gp) | 2 | ||||
-rw-r--r-- | scripts/facetron-patterns.gp | 4 | ||||
-rw-r--r-- | src/facetron.c | 25 |
3 files changed, 24 insertions, 7 deletions
diff --git a/scripts/facetron.gp b/scripts/facetron-partiality.gp index d1d95ac4..914a7478 100644 --- a/scripts/facetron.gp +++ b/scripts/facetron-partiality.gp @@ -4,4 +4,4 @@ set xrange [0:1] set yrange [0:1] unset key set size square -plot "iteration-1.dat" using 7:8 w p ps 1 pt 7 lc -1 +plot "p-iteration-1.dat" using 7:8 w p ps 1 pt 7 lc -1 diff --git a/scripts/facetron-patterns.gp b/scripts/facetron-patterns.gp new file mode 100644 index 00000000..3fdb6b80 --- /dev/null +++ b/scripts/facetron-patterns.gp @@ -0,0 +1,4 @@ +set xlabel "Pattern number" +set ylabel "Mean intensity deviation" +unset key +plot "g-iteration-1.dat" using 1:2 w impulses lw 1 lc -1 diff --git a/src/facetron.c b/src/facetron.c index 663a3236..c3cfcfab 100644 --- a/src/facetron.c +++ b/src/facetron.c @@ -71,6 +71,7 @@ struct refine_args double *i_full; struct image *image; FILE *graph; + FILE *pgraph; }; @@ -112,6 +113,9 @@ static void refine_image(int mytask, void *tasks) } while ( (fabs(last_dev - dev) > 1.0) && (i < MAX_CYCLES) ); mean_partial_dev(image, spots, n, pargs->sym, pargs->i_full, pargs->graph); + if ( pargs->pgraph ) { + fprintf(pargs->pgraph, "%5i %5.2f\n", mytask, dev); + } free(image->data); if ( image->flags != NULL ) free(image->flags); @@ -218,7 +222,7 @@ static void integrate_image(int mytask, void *tasks) static void refine_all(struct image *images, int n_total_patterns, struct detector *det, const char *sym, ReflItemList *obs, double *i_full, int nthreads, - FILE *graph) + FILE *graph, FILE *pgraph) { struct refine_args *tasks; int i; @@ -231,6 +235,7 @@ static void refine_all(struct image *images, int n_total_patterns, tasks[i].i_full = i_full; tasks[i].image = &images[i]; tasks[i].graph = graph; + tasks[i].pgraph = pgraph; } @@ -490,21 +495,29 @@ int main(int argc, char *argv[]) /* Iterate */ for ( i=0; i<n_iter; i++ ) { - FILE *fh; + FILE *fhg; + FILE *fhp; char filename[1024]; STATUS("Post refinement iteration %i of %i\n", i+1, n_iter); - snprintf(filename, 1023, "iteration-%i.dat", i+1); - fh = fopen(filename, "w"); - if ( fh == NULL ) { + snprintf(filename, 1023, "p-iteration-%i.dat", i+1); + fhg = fopen(filename, "w"); + if ( fhg == NULL ) { + ERROR("Failed to open '%s'\n", filename); + /* Nothing will be written later */ + } + + snprintf(filename, 1023, "g-iteration-%i.dat", i+1); + fhp = fopen(filename, "w"); + if ( fhp == NULL ) { ERROR("Failed to open '%s'\n", filename); /* Nothing will be written later */ } /* Refine the geometry of all patterns to get the best fit */ refine_all(images, n_total_patterns, det, sym, obs, i_full, - nthreads, fh); + nthreads, fhg, fhp); /* Re-estimate all the full intensities */ estimate_full(images, n_total_patterns, det, sym, obs, i_full, |