aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakanori Nakane <nakane.t@gmail.com>2014-08-14 14:58:45 +0100
committerThomas White <taw@physics.org>2014-09-18 16:50:00 +0200
commit1000cd8a44b8943e6c248d16a7ef1a5f49dcb147 (patch)
treecfd317d44835a0e0e530bf9e100bf26850939a71
parent944c01964d87e9f3830a5079a78e0e5d4903a12e (diff)
Added scripts/plot-cc-and-scale.R to show how to plot
frame-wise statistics from process_hkl.
-rw-r--r--scripts/plot-cc-and-scale.R23
-rw-r--r--src/process_hkl.c2
2 files changed, 24 insertions, 1 deletions
diff --git a/scripts/plot-cc-and-scale.R b/scripts/plot-cc-and-scale.R
new file mode 100644
index 00000000..75850e85
--- /dev/null
+++ b/scripts/plot-cc-and-scale.R
@@ -0,0 +1,23 @@
+# Example R script to plot scale factor and CC
+#
+# by Takanori Nakane (nakane.t@gmail.com)
+
+scale_cc <- read.table("scale.csv", sep=",", col.names=c("ImageName", "ScaleFactor", "CC"))
+
+# scatter plot
+# FIXME: sometimes white lines appear on the plot.
+# seems to be a bug in smoothScatter
+
+smoothScatter(scale_cc$ScaleFactor, scale_cc$CC,
+ nbin=200, xlim=c(0, 2), ylim=c(0, 1),
+ xlab="Scale Factor", ylab="CC", main="Scale factor & CC")
+
+# histogram
+
+par(mfrow=c(2,1))
+plot(scale_cc$ScaleFactor, type='h', ylab="Scale Factor", xlab="#Crystal")
+abline(h=mean(sf[,2])+(-5:5)*sd(sf[,2]), col=2)
+
+hist(scale_cc$ScaleFactor, breaks=100, main="Distribution of Scale Factor", xlab="Scale Factor")
+abline(v=mean(sf[,2])+(-5:5)*sd(sf[,2]), col=2)
+par(mfrow=c(1,1)) \ No newline at end of file
diff --git a/src/process_hkl.c b/src/process_hkl.c
index b72b84f1..fba37183 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -274,7 +274,7 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
crystal_get_reflections(cr), sym);
cc = cc_intensities(reference, crystal_get_reflections(cr), sym);
if (stat != NULL) {
- fprintf(stat, "%s,%f,%f\n",image->filename, scale, cc);
+ fprintf(stat, "%s,%f,%f\n",image->filename, scale, cc);
}
if (cc < min_cc || scale <= 0) return 1;
} else {