aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-02-27 17:06:35 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:42 +0100
commit3684bb0dc691c5b6d7c3f0590737e417295219ee (patch)
tree39055733362684862c7ab221e66ad0050e80fd45
parentcd7a8f580a89dd5ad940a09ea49f10abba675ff4 (diff)
Write spectrum graph at end again
-rw-r--r--src/partialator.c4
-rw-r--r--src/post-refinement.c22
-rw-r--r--src/post-refinement.h10
3 files changed, 21 insertions, 15 deletions
diff --git a/src/partialator.c b/src/partialator.c
index b708bd9f..3b489d74 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -1262,7 +1262,9 @@ int main(int argc, char *argv[])
/* Write final figures of merit (no rejection any more) */
show_all_residuals(crystals, n_crystals, full);
write_pgraph(full, crystals, n_crystals, -1, "");
- STATUS("Final profile radius: %e\n", crystal_get_profile_radius(crystals[0]));
+ for ( i=0; i<n_crystals; i+=20 ) {
+ write_specgraph(crystals[i], full, -1, i);
+ }
/* Output results */
STATUS("Writing overall results to %s\n", outfile);
diff --git a/src/post-refinement.c b/src/post-refinement.c
index e85783fb..939f11b2 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -489,8 +489,8 @@ void try_reindex(Crystal *crin, const RefList *full)
}
-static void write_specgraph(const RefList *full, Crystal *crystal, signed int in,
- const char *suff)
+void write_specgraph(Crystal *crystal, const RefList *full,
+ signed int cycle, int serial)
{
FILE *fh;
char tmp[256];
@@ -502,9 +502,9 @@ static void write_specgraph(const RefList *full, Crystal *crystal, signed int in
struct image *image = crystal_get_image(crystal);
char ins[5];
- snprintf(tmp, 256, "pr-logs/specgraph%s.dat", suff);
+ snprintf(tmp, 256, "pr-logs/specgraph-crystal%i.dat", serial);
- if ( in == 0 ) {
+ if ( cycle == 0 ) {
fh = fopen(tmp, "w");
} else {
fh = fopen(tmp, "a");
@@ -515,7 +515,7 @@ static void write_specgraph(const RefList *full, Crystal *crystal, signed int in
return;
}
- if ( in == 0 ) {
+ if ( cycle == 0 ) {
fprintf(fh, "Image: %s %s\n",
image->filename, get_event_string(image->event));
fprintf(fh, "khalf/m 1/d(m) pcalc pobs iteration\n");
@@ -523,8 +523,8 @@ static void write_specgraph(const RefList *full, Crystal *crystal, signed int in
cell = crystal_get_cell(crystal);
- if ( in >= 0 ) {
- snprintf(ins, 4, "%i", in);
+ if ( cycle >= 0 ) {
+ snprintf(ins, 4, "%i", cycle);
} else {
ins[0] = 'F';
ins[1] = '\0';
@@ -610,8 +610,8 @@ static gsl_multimin_fminimizer *setup_minimiser(Crystal *cr, const RefList *full
}
-static void write_gridscan(Crystal *cr, const RefList *full,
- int cycle, int serial)
+void write_gridscan(Crystal *cr, const RefList *full,
+ signed int cycle, int serial)
{
FILE *fh;
char fn[64];
@@ -713,9 +713,7 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
char fn[64];
write_gridscan(cr, full, cycle, serial);
-
- snprintf(fn, 63, "-crystal%i", serial);
- write_specgraph(full, cr, cycle, fn);
+ write_specgraph(cr, full, cycle, serial);
snprintf(fn, 63, "pr-logs/crystal%i-cycle%i.log", serial, cycle);
fh = fopen(fn, "w");
diff --git a/src/post-refinement.h b/src/post-refinement.h
index 4b48dd57..13382623 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -3,11 +3,11 @@
*
* Post refinement
*
- * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2018 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2010-2015 Thomas White <taw@physics.org>
+ * 2010-2018 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -61,6 +61,12 @@ extern void refine_all(Crystal **crystals, int n_crystals,
RefList *full, int nthreads, PartialityModel pmodel,
int verbose, int cycle);
+extern void write_gridscan(Crystal *cr, const RefList *full,
+ int cycle, int serial);
+
+extern void write_specgraph(Crystal *crystal, const RefList *full,
+ signed int cycle, int serial);
+
/* Exported so it can be poked by tests/pr_p_gradient_check */
extern double gradient(Crystal *cr, int k, Reflection *refl,
PartialityModel pmodel);