-
Notifications
You must be signed in to change notification settings - Fork 2
/
getDall.py
60 lines (50 loc) · 1.59 KB
/
getDall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#sample file for compiling ACFCalculator output; works in tandem w/ setup.sh
#see documentation.md for more info
import os
import numpy
import sys
import math
lin=numpy.array([])
ds=[]
d=[]
x=[]
p=[]
temp=numpy.array([])
for j in range(39, -1, -1):
fh=open(os.path.expanduser('~/out_up/out_up_sim_'+str(j)+'.out'), 'r')
lines=fh.readlines()
fh.close()
for l in lines:
f=l.split();
if(f[0]=='#avg'):
x.append(float(f[-1]))
if(f[0]=='#D'):
d.append(float(f[-2]))
if(f[0]=='#Ds'):
ds.append(float(f[-2]))
p.append(int(-j))
for k in range(0, 40):
fh=open(os.path.expanduser('~/out_down/out_down_sim_'+str(k)+'.out'), 'r')
lines=fh.readlines()
fh.close()
for l in lines:
f=l.split();
if(f[0]=='#avg'):
x.append(float(f[-1]))
if(f[0]=='#D'):
d.append(float(f[-2]))
if(f[0]=='#Ds'):
ds.append(float(f[-2]))
p.append(int(k))
if len(lin)==0:
lin = [x, d, d, ds, ds]
else:
temp = numpy.dstack((lin, [x, d, d, ds, ds]))
lin = temp
f_out = open(os.path.expanduser('~/out_ds.out'), 'w')
for l in range(0, len(ds)):
f_out.write(str(p[l])+'\t'+str(ds[l])+ '\n')
f_out.close()
sys.stdout.write('{:16} {:15} {:20} {:15} {:20} \n'.format('x', 'Dacf', '+-','Dvacf', '+-'))
for i in range(0, len(lin[0])):
sys.stdout.write('{:16} {:15} {:20} {:15} {:20} \n'.format(str(numpy.average(lin[0][i])), str(numpy.average(lin[1][i])), str(numpy.std(lin[2][i])), str(numpy.average(lin[3][i])), str(numpy.std(lin[4][i]))))