summaryrefslogtreecommitdiff
path: root/avg.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 /avg.py
parentf9a9a51884aadef97b8952b2807541d31b7e9917 (diff)
doc
Diffstat (limited to 'avg.py')
-rw-r--r--avg.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/avg.py b/avg.py
new file mode 100644
index 0000000..bbcb920
--- /dev/null
+++ b/avg.py
@@ -0,0 +1,14 @@
+from sys import argv
+
+#usage: avg.py outfile infile1 infile2 ...
+
+outfile, infiles = open(argv[1],"w"), [open(arg,"r") for arg in argv[2:]]
+
+# hell yea! i f***ing love python :'D
+for lines in zip(*infiles):
+ for columns in zip(*[l.split() for l in lines]):
+ print("%e" % ( sum([float(c) for c in columns])/len(columns) ) ,file=outfile, end="\t")
+ print("", file=outfile)
+
+for f in [outfile]+infiles:
+ f.close()