diff options
Diffstat (limited to 'shift.py')
-rw-r--r-- | shift.py | 17 |
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() |