aboutsummaryrefslogtreecommitdiff
path: root/src/facetron.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-22 16:22:36 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:06 +0100
commitdb616846b0eb82b1d801c7261eec6fd501a8b763 (patch)
tree35d889142373c43da6e0459593cca3b4489fd18c /src/facetron.c
parentc84b3275243f19e6496da6b39766c8b7a8ac435e (diff)
facetron: Also output bar chart of pattern fits
Diffstat (limited to 'src/facetron.c')
-rw-r--r--src/facetron.c25
1 files changed, 19 insertions, 6 deletions
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,