aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-04-02 06:38:47 -0700
committerThomas White <taw@physics.org>2015-04-20 15:50:40 +0200
commitd3b1d5d5ed1529c327a5a6048f48d42009dda06d (patch)
tree256a8c9d655547074c5f62b290f03bc504905372 /src
parent43b322bb6f12a92c17510f432c516972acc6d8f0 (diff)
Output paired peaks for testing
Diffstat (limited to 'src')
-rw-r--r--src/predict-refine.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/predict-refine.c b/src/predict-refine.c
index 7ec25a01..e8a7c331 100644
--- a/src/predict-refine.c
+++ b/src/predict-refine.c
@@ -121,6 +121,40 @@ static double y_dev(struct reflpeak *rp, struct detector *det)
}
+static void write_pairs(const char *filename, struct reflpeak *rps, int n,
+ struct detector *det)
+{
+ int i;
+ FILE *fh;
+
+ fh = fopen(filename, "w");
+ if ( fh == NULL ) {
+ ERROR("Failed to open '%s'\n", filename);
+ return;
+ }
+
+ for ( i=0; i<n; i++ ) {
+
+ double write_fs, write_ss;
+ double fs, ss;
+ struct panel *p;
+
+ fs = rps[i].peak->fs;
+ ss = rps[i].peak->ss;
+
+ p = find_panel(det, fs, ss);
+ write_fs = fs - p->min_fs + p->orig_min_fs;
+ write_ss = ss - p->min_ss + p->orig_min_ss;
+ fprintf(fh, "%f %f\n", write_fs, write_ss);
+
+ }
+
+ fclose(fh);
+
+ STATUS("Wrote %i pairs to %s\n", n, filename);
+}
+
+
/* Associate a Reflection with each peak in "image" which is close to Bragg.
* Reflections will be added to "reflist", which can be NULL if this is not
* needed. "rps" must be an array of sufficient size for all the peaks */
@@ -601,6 +635,7 @@ int refine_prediction(struct image *image, Crystal *cr)
return 1;
}
crystal_set_reflections(cr, reflist);
+ write_pairs("pairs.lst", rps, n, image->det);
/* Normalise the intensities to max 1 */
max_I = -INFINITY;