-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis.py
67 lines (53 loc) · 1.24 KB
/
analysis.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
61
62
63
64
65
66
67
import numpy as np
import matplotlib.pyplot as plt
def format(value):
return "%.3f" % value
f = open( 'input.txt', 'r')
content = [x.strip('\n') for x in f.readlines()]
content.pop(0)
content = [ float(x) for x in content]
f.close()
runTotal = int(content[0])
N = int(content[1])
L = content[2]
v = content[3]
print ' '
print runTotal
print N
print L
print v
tMean = [];
tSdev = [];
for i in range(9,N,10):
filename = 'tRun00' + str(i+1) + '.dat'
if (i+1) >= 10:
filename = 'tRun0' + str(i+1) + '.dat'
if (i+1) >= 100:
filename = 'tRun' + str(i+1) + '.dat'
f = open(filename,'r')
tRun = [ float(x.strip('\n')) for x in f.readlines()]
tMean.append(np.mean(tRun))
tSdev.append(np.std(tRun))
f.close()
vStr = '%.0f' % (v*100)
filename = 'fpt_v0_' + vStr + '.dat'
fo = open(filename, 'w')
j = 0
for i in range(9,N,10):
s = str(i+1) + ' ' + str(tMean[j]) + ' ' + str(tSdev[j]) + '\n'
fo.write(s)
j += 1
# fo.write(str(formatted))
fo.close()
# n = [ i+1 for i in range(N)]
# plt.errorbar( n, tMean, yerr=tSdev)
# plt.xlim([min(n)-1, max(n)+1])
# # plt.xticks(n)
# plt.xlabel('N')
# plt.ylabel('FPT')
# plt.show()
#
# plt.errorbar( n, tMean, yerr=tSdev)
# plt.xscale('log')
# plt.yscale('log')
# plt.show()