aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-02-27 17:03:47 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:42 +0100
commit06bf0f4ec243686a14c51b48a6ebd19888a49a6f (patch)
tree64c06227f8a46a8e6c698d5ea888fbd143699681 /src
parentbd5d2ec01be4aef4731498424fe777e3cdb797ef (diff)
Write logs for test program
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c1
-rw-r--r--src/post-refinement.c52
-rw-r--r--src/post-refinement.h3
3 files changed, 56 insertions, 0 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 0d5a8a84..f826bf83 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -788,6 +788,7 @@ static void write_logs(void *vp, int cookie)
struct log_args *args = vp;
write_specgraph(args->cr, args->full, args->iter, args->cnum);
write_gridscan(args->cr, args->full, args->iter, args->cnum);
+ write_test_logs(args->cr, args->full, args->iter, args->cnum);
}
diff --git a/src/post-refinement.c b/src/post-refinement.c
index acafb8aa..007216b9 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -510,6 +510,57 @@ void try_reindex(Crystal *crin, const RefList *full,
}
+void write_test_logs(Crystal *crystal, const RefList *full,
+ signed int cycle, int serial)
+{
+ FILE *fh;
+ struct image *image = crystal_get_image(crystal);
+ char tmp[256];
+ char ins[5];
+
+ snprintf(tmp, 256, "pr-logs/parameters-crystal%i.dat", serial);
+
+ if ( cycle == 0 ) {
+ fh = fopen(tmp, "w");
+ } else {
+ fh = fopen(tmp, "a");
+ }
+
+ if ( fh == NULL ) {
+ ERROR("Failed to open '%s'\n", tmp);
+ return;
+ }
+
+ if ( cycle == 0 ) {
+ fprintf(fh, "Image: %s %s\n",
+ image->filename, get_event_string(image->event));
+ }
+
+ if ( cycle >= 0 ) {
+ snprintf(ins, 4, "%i", cycle);
+ } else {
+ ins[0] = 'F';
+ ins[1] = '\0';
+ }
+
+ fprintf(fh, "%s rlp_size = %e\n", ins, crystal_get_profile_radius(crystal)/1e10);
+ fprintf(fh, "%s mosaicity = %e\n", ins, crystal_get_mosaicity(crystal));
+ fprintf(fh, "%s wavelength = %f A\n", ins, image->lambda*1e10);
+ fprintf(fh, "%s bandwidth = %f\n", ins, image->bw);
+ fprintf(fh, "%s my scale factor = %e\n", ins, crystal_get_osf(crystal));
+
+ double asx, asy, asz, bsx, bsy, bsz, csx, csy, csz;
+ cell_get_reciprocal(crystal_get_cell(crystal), &asx, &asy, &asz,
+ &bsx, &bsy, &bsz,
+ &csx, &csy, &csz);
+ fprintf(fh, "%s %f, %f, %f, %f, %f, %f, %f, %f, %f\n", ins,
+ asx/1e10, bsx/1e10, csx/1e10,
+ asy/1e10, bsy/1e10, csy/1e10,
+ asz/1e10, bsz/1e10, csz/1e10);
+ fclose(fh);
+}
+
+
void write_specgraph(Crystal *crystal, const RefList *full,
signed int cycle, int serial)
{
@@ -870,6 +921,7 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
if ( write_logs ) {
write_gridscan(cr, full, cycle, serial);
write_specgraph(cr, full, cycle, serial);
+ write_test_logs(cr, full, cycle, serial);
}
if ( crystal_get_profile_radius(cr) > 5e9 ) {
diff --git a/src/post-refinement.h b/src/post-refinement.h
index a27127ff..e2416a23 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -76,4 +76,7 @@ extern double gradient(Crystal *cr, int k, Reflection *refl,
extern double residual(Crystal *cr, const RefList *full, int free,
int *pn_used, const char *filename, int complain);
+extern void write_test_logs(Crystal *crystal, const RefList *full,
+ signed int cycle, int serial);
+
#endif /* POST_REFINEMENT_H */