From 4c0971b30a4982c8b4a3be4b6599639ecb1b6695 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 1 Aug 2013 17:33:23 +0200 Subject: Count filtered eigenvalues --- src/partialator.c | 15 ++++++++++++--- src/post-refinement.c | 23 ++++++++++++++++------- src/post-refinement.h | 12 ++++++++++-- src/scaling-report.h | 3 ++- 4 files changed, 40 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/partialator.c b/src/partialator.c index 6b29a74f..88912226 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -92,6 +92,7 @@ struct refine_args RefList *full; Crystal *crystal; PartialityModel pmodel; + struct prdata prdata; }; @@ -101,6 +102,7 @@ struct queue_args int n_done; Crystal **crystals; int n_crystals; + struct srdata *srdata; struct refine_args task_defaults; }; @@ -110,7 +112,7 @@ static void refine_image(void *task, int id) struct refine_args *pargs = task; Crystal *cr = pargs->crystal; - pr_refine(cr, pargs->full, pargs->pmodel); + pargs->prdata = pr_refine(cr, pargs->full, pargs->pmodel); } @@ -133,8 +135,10 @@ static void *get_image(void *vqargs) static void done_image(void *vqargs, void *task) { struct queue_args *qargs = vqargs; + struct refine_args *pargs = task; qargs->n_done++; + qargs->srdata->n_filtered += pargs->prdata.n_filtered; progress_bar(qargs->n_done, qargs->n_crystals, "Refining"); free(task); @@ -143,7 +147,8 @@ static void done_image(void *vqargs, void *task) static void refine_all(Crystal **crystals, int n_crystals, struct detector *det, - RefList *full, int nthreads, PartialityModel pmodel) + RefList *full, int nthreads, PartialityModel pmodel, + struct srdata *srdata) { struct refine_args task_defaults; struct queue_args qargs; @@ -161,6 +166,7 @@ static void refine_all(Crystal **crystals, int n_crystals, qargs.n_done = 0; qargs.n_crystals = n_crystals; qargs.crystals = crystals; + qargs.srdata = srdata; /* Don't have threads which are doing nothing */ if ( n_crystals < nthreads ) nthreads = n_crystals; @@ -629,11 +635,14 @@ int main(int argc, char *argv[]) STATUS("Post refinement cycle %i of %i\n", i+1, n_iter); + srdata.n_filtered = 0; + /* Refine the geometry of all patterns to get the best fit */ comp = (reference == NULL) ? full : reference; select_reflections_for_refinement(crystals, n_crystals, comp, have_reference); - refine_all(crystals, n_crystals, det, comp, nthreads, pmodel); + refine_all(crystals, n_crystals, det, comp, nthreads, pmodel, + &srdata); nobs = 0; for ( j=0; jn_filtered); if ( shifts != NULL ) { for ( param=0; param 50.0) && (i < MAX_CYCLES) ); free_backup_crystal(backup); + + return prdata; } diff --git a/src/post-refinement.h b/src/post-refinement.h index 7e13090b..b964975e 100644 --- a/src/post-refinement.h +++ b/src/post-refinement.h @@ -41,6 +41,7 @@ #include "utils.h" #include "crystal.h" #include "geometry.h" +#include "scaling-report.h" /* Refineable parameters. @@ -55,13 +56,20 @@ enum { REF_CSX, REF_CSY, REF_CSZ, - REF_DIV, NUM_PARAMS, + REF_DIV, REF_R, }; -extern void pr_refine(Crystal *cr, const RefList *full, PartialityModel pmodel); +struct prdata +{ + int n_filtered; +}; + + +extern struct prdata pr_refine(Crystal *cr, const RefList *full, + PartialityModel pmodel); /* Exported so it can be poked by tests/pr_gradient_check */ extern double p_gradient(Crystal *cr, int k, Reflection *refl, diff --git a/src/scaling-report.h b/src/scaling-report.h index 473e1759..1d430042 100644 --- a/src/scaling-report.h +++ b/src/scaling-report.h @@ -41,10 +41,11 @@ 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; + + int n_filtered; }; #ifdef HAVE_CAIRO -- cgit v1.2.3