summaryrefslogtreecommitdiff
path: root/shift.py
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2016-01-07 00:44:01 +0100
committerFlorian Jung <flo@windfisch.org>2016-01-07 00:44:01 +0100
commita7763a22a08117dca62a6e9616ecea33fe7e4c65 (patch)
tree92d0340418bdc9326479f0f01ca58d1226fdd5f6 /shift.py
parentf9a9a51884aadef97b8952b2807541d31b7e9917 (diff)
doc
Diffstat (limited to 'shift.py')
-rw-r--r--shift.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/shift.py b/shift.py
new file mode 100644
index 0000000..7eaae3d
--- /dev/null
+++ b/shift.py
@@ -0,0 +1,17 @@
+from sys import argv
+
+#usage: avg.py infile shift > outfile
+
+infile = open(argv[1],"r")
+shift = int(argv[2])
+
+log = [0]*shift
+
+for line in infile:
+ a,b = line.split()
+ a=int(float(a))
+ b=float(b)
+ log += [b]
+ print("%i\t%e\t%e\t%e" % (a,(b-log[-shift])/shift,b,log[-shift]))
+
+infile.close()