aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-03-30 16:51:13 +0200
committerThomas White <taw@physics.org>2015-04-01 09:29:46 +0200
commitb2c5b05c7e8da5a20610c7a7b098a76c9ad9c4e0 (patch)
tree9abe1d80ac3ef908d5d6453cc6998f1da0b2b1bc
parent6edcec50495c2285cf731ef7335e8882c76da1ae (diff)
Add scripts/ave-resolution
-rw-r--r--Makefile.am3
-rwxr-xr-xscripts/ave-resolution35
2 files changed, 37 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index db3d3aac..75d0e98e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ script_DATA = scripts/alternate-stream scripts/cell-please \
scripts/Rsplit_surface scripts/Rsplit_surface.py \
scripts/clean-stream.py scripts/fg-graph scripts/truncate-stream \
scripts/gen-sfs-expand scripts/add-beam-params \
- scripts/find-pairs scripts/plot-cc-and-scale.R
+ scripts/find-pairs scripts/plot-cc-and-scale.R \
+ scripts/ave-resolution
EXTRA_DIST += $(script_DATA)
diff --git a/scripts/ave-resolution b/scripts/ave-resolution
new file mode 100755
index 00000000..ff93ed68
--- /dev/null
+++ b/scripts/ave-resolution
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#
+# Find mean diffracting resolution
+#
+# Copyright © 2014-2015 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
+#
+# Author:
+# 2014-2015 Thomas White <taw@physics.org>
+#
+
+import sys
+import numpy
+
+f = open(sys.argv[1])
+a = []
+
+while True:
+ fline = f.readline()
+ if not fline:
+ break
+ if fline.find("diffraction_resolution_limit") != -1:
+ res = float(fline.split('= ')[1].split(' ')[0].rstrip("\r\n"))
+ a.append(res)
+ continue
+
+f.close()
+
+b = numpy.array(a)
+print " Mean: %.2f nm^-1 = %.2f A" % (numpy.mean(b),10.0/numpy.mean(b))
+print " Best: %.2f nm^-1 = %.2f A" % (numpy.max(b),10.0/numpy.max(b))
+print "Worst: %.2f nm^-1 = %.2f A" % (numpy.min(b),10.0/numpy.min(b))
+print "Std deviation: %.2f nm^-1" % (numpy.std(b))