aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-06-26 11:22:24 +0200
committerThomas White <taw@physics.org>2014-06-26 11:22:24 +0200
commit19f977c6d62ffca9f13bcdefef32b5b27a326b7a (patch)
treed2abc2503e321c24a74c28ccb232f3785852d2e0 /src
parentf623ac19805a60e0eb9ad58c9132fbc655dfdb98 (diff)
Rationalise counting of filtered eigenvalues
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c11
-rw-r--r--src/post-refinement.c14
-rw-r--r--src/post-refinement.h1
-rw-r--r--src/scaling-report.c3
-rw-r--r--src/scaling-report.h7
5 files changed, 25 insertions, 11 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 8823990f..2ef01dba 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -129,7 +129,10 @@ static void done_image(void *vqargs, void *task)
struct refine_args *pargs = task;
qargs->n_done++;
- qargs->srdata->n_filtered += pargs->prdata.n_filtered;
+ if ( pargs->prdata.refined ) {
+ qargs->srdata->n_refined += pargs->prdata.refined;
+ qargs->srdata->n_filtered += pargs->prdata.n_filtered;
+ }
progress_bar(qargs->n_done, qargs->n_crystals, "Refining");
free(task);
@@ -150,6 +153,7 @@ static void refine_all(Crystal **crystals, int n_crystals,
task_defaults.full = full;
task_defaults.crystal = NULL;
task_defaults.pmodel = pmodel;
+ task_defaults.prdata.refined = 0;
task_defaults.prdata.n_filtered = 0;
qargs.task_defaults = task_defaults;
@@ -164,6 +168,10 @@ static void refine_all(Crystal **crystals, int n_crystals,
run_threads(nthreads, refine_image, get_image, done_image,
&qargs, n_crystals, 0, 0, 0);
+
+ STATUS("%5.2f eigenvalues filtered on final iteration per successfully "
+ "refined crystal\n",
+ (double)srdata->n_filtered/srdata->n_refined);
}
@@ -462,6 +470,7 @@ int main(int argc, char *argv[])
srdata.n = n_crystals;
srdata.full = full;
srdata.n_filtered = 0;
+ srdata.n_refined = 0;
sr = sr_titlepage(crystals, n_crystals, "scaling-report.pdf",
infile, cmdline);
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 535f7cff..5de8a246 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -469,7 +469,7 @@ static gsl_vector *solve_svd(gsl_vector *v, gsl_matrix *M, int *n_filt,
/* Perform one cycle of post refinement on 'image' against 'full' */
static double pr_iterate(Crystal *cr, const RefList *full,
- PartialityModel pmodel, struct prdata *prdata)
+ PartialityModel pmodel, int *n_filtered)
{
gsl_matrix *M;
gsl_vector *v;
@@ -482,6 +482,8 @@ static double pr_iterate(Crystal *cr, const RefList *full,
int nref = 0;
const int verbose = 0;
+ *n_filtered = 0;
+
reflections = crystal_get_reflections(cr);
M = gsl_matrix_calloc(NUM_PARAMS, NUM_PARAMS);
@@ -574,7 +576,7 @@ static double pr_iterate(Crystal *cr, const RefList *full,
}
max_shift = 0.0;
- shifts = solve_svd(v, M, &prdata->n_filtered, verbose);
+ shifts = solve_svd(v, M, n_filtered, verbose);
if ( shifts != NULL ) {
for ( param=0; param<NUM_PARAMS; param++ ) {
@@ -698,6 +700,7 @@ struct prdata pr_refine(Crystal *cr, const RefList *full,
struct prdata prdata;
double mean_p_change = 0.0;
+ prdata.refined = 0;
prdata.n_filtered = 0;
/* Don't refine crystal if scaling was bad */
@@ -727,8 +730,7 @@ struct prdata pr_refine(Crystal *cr, const RefList *full,
cell_get_reciprocal(crystal_get_cell(cr), &asx, &asy, &asz,
&bsx, &bsy, &bsz, &csx, &csy, &csz);
- prdata.n_filtered = 0;
- pr_iterate(cr, full, pmodel, &prdata);
+ pr_iterate(cr, full, pmodel, &prdata.n_filtered);
update_partialities_2(cr, pmodel, &n_gained, &n_lost,
&mean_p_change);
@@ -755,5 +757,9 @@ struct prdata pr_refine(Crystal *cr, const RefList *full,
free_backup_crystal(backup);
+ if ( crystal_get_user_flag(cr) == 0 ) {
+ prdata.refined = 1;
+ }
+
return prdata;
}
diff --git a/src/post-refinement.h b/src/post-refinement.h
index abf2364b..e419c51d 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -63,6 +63,7 @@ enum {
struct prdata
{
+ int refined;
int n_filtered;
};
diff --git a/src/scaling-report.c b/src/scaling-report.c
index 351d2dbd..ca4c5cbc 100644
--- a/src/scaling-report.c
+++ b/src/scaling-report.c
@@ -888,9 +888,6 @@ void sr_iteration(SRContext *sr, int iteration, struct srdata *d)
cairo_restore(sr->cr);
}
-
- STATUS("%i filtered total, %5.2f filtered per crystal\n",
- d->n_filtered, (double)d->n_filtered / d->n);
}
diff --git a/src/scaling-report.h b/src/scaling-report.h
index 5f6e2cb4..55037038 100644
--- a/src/scaling-report.h
+++ b/src/scaling-report.h
@@ -3,11 +3,11 @@
*
* Write a nice PDF of scaling parameters
*
- * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY,
- * a research centre of the Helmholtz Association.
+ * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
*
* Authors:
- * 2011-2012 Thomas White <taw@physics.org>
+ * 2011-2014 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -46,6 +46,7 @@ struct srdata
RefList *full;
int n_filtered;
+ int n_refined;
};
#if defined(HAVE_CAIRO) && defined(HAVE_PANGO) && defined(HAVE_PANGOCAIRO)