From d001bcca749215e41a79a0de32e4cc049ace8b86 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 1 Aug 2013 16:32:49 +0200 Subject: Use a struct to contain information for scaling report --- src/partialator.c | 11 +++++++++-- src/scaling-report.c | 15 +++++++-------- src/scaling-report.h | 15 +++++++++++---- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/partialator.c b/src/partialator.c index a282744e..6b29a74f 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -333,6 +333,7 @@ int main(int argc, char *argv[]) PartialityModel pmodel = PMODEL_SPHERE; int min_measurements = 2; char *rval; + struct srdata srdata; /* Long options */ const struct option longopts[] = { @@ -611,9 +612,13 @@ int main(int argc, char *argv[]) full = scale_intensities(crystals, n_crystals, reference, nthreads, noscale, pmodel, min_measurements); + srdata.crystals = crystals; + srdata.n = n_crystals; + srdata.full = full; + sr = sr_titlepage(crystals, n_crystals, "scaling-report.pdf", infile, cmdline); - sr_iteration(sr, 0, crystals, n_crystals, full); + sr_iteration(sr, 0, &srdata); /* Iterate */ for ( i=0; icr); cairo_translate(sr->cr, 480.0, 350.0); - scale_factor_histogram(sr->cr, crystals, n, + scale_factor_histogram(sr->cr, d->crystals, d->n, "Distribution of overall scale factors"); cairo_restore(sr->cr); @@ -842,7 +841,7 @@ void sr_iteration(SRContext *sr, int iteration, Crystal **crystals, int n, cairo_save(sr->cr); cairo_translate(sr->cr, 70.0, 330.0); - partiality_graph(sr->cr, crystals, n, full); + partiality_graph(sr->cr, d->crystals, d->n, d->full); cairo_save(sr->cr); cairo_move_to(sr->cr, 0.0, 0.0); @@ -853,7 +852,7 @@ void sr_iteration(SRContext *sr, int iteration, Crystal **crystals, int n, cairo_stroke(sr->cr); cairo_set_dash(sr->cr, NULL, 0, 0.0); cairo_translate(sr->cr, 0.0, -150.0); - partiality_histogram(sr->cr, crystals, n, full, 1, 0); + partiality_histogram(sr->cr, d->crystals, d->n, d->full, 1, 0); cairo_restore(sr->cr); cairo_save(sr->cr); @@ -866,13 +865,13 @@ void sr_iteration(SRContext *sr, int iteration, Crystal **crystals, int n, cairo_set_dash(sr->cr, NULL, 0, 0.0); cairo_translate(sr->cr, 230.0, 200.0); cairo_rotate(sr->cr, -M_PI_2); - partiality_histogram(sr->cr, crystals, n, full, 0, 1); + partiality_histogram(sr->cr, d->crystals, d->n, d->full, 0, 1); cairo_restore(sr->cr); cairo_restore(sr->cr); if ( iteration == 0 ) { - find_most_sampled_reflections(full, 9, + find_most_sampled_reflections(d->full, 9, sr->ms_h, sr->ms_k, sr->ms_l); } @@ -885,7 +884,7 @@ void sr_iteration(SRContext *sr, int iteration, Crystal **crystals, int n, cairo_save(sr->cr); cairo_translate(sr->cr, 400.0+140.0*x, 60.0+80.0*y); - intensity_histogram(sr->cr, crystals, n, full, + intensity_histogram(sr->cr, d->crystals, d->n, d->full, sr->ms_h[i], sr->ms_k[i], sr->ms_l[i]); cairo_restore(sr->cr); diff --git a/src/scaling-report.h b/src/scaling-report.h index 5b153377..473e1759 100644 --- a/src/scaling-report.h +++ b/src/scaling-report.h @@ -38,6 +38,15 @@ typedef struct _srcontext SRContext; /* Opaque */ +/* Information is logged in this structure */ +struct srdata +{ + int n_no_refine; /* Number that couldn't be refined */ + Crystal **crystals; + int n; + RefList *full; +}; + #ifdef HAVE_CAIRO extern SRContext *sr_titlepage(Crystal **crystals, int n, @@ -45,8 +54,7 @@ extern SRContext *sr_titlepage(Crystal **crystals, int n, const char *stream_filename, const char *cmdline); -extern void sr_iteration(SRContext *sr, int iteration, - Crystal **crystals, int n, RefList *full); +extern void sr_iteration(SRContext *sr, int iteration, struct srdata *d); extern void sr_finish(SRContext *sr); @@ -58,8 +66,7 @@ SRContext *sr_titlepage(Crystal **crystals, int n, const char *filename, return NULL; } -void sr_iteration(SRContext *sr, int iteration, Crystal **crystals, int n, - RefList *full) +void sr_iteration(SRContext *sr, int iteration, struct srdata *d) { } -- cgit v1.2.3