|
@@ -0,0 +1,54 @@
|
|
|
+import os
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+results = {}
|
|
|
+
|
|
|
+def errorfill(x, y, yerr, color=None, alpha_fill=0.3, ax=None):
|
|
|
+ ax = ax if ax is not None else plt.gca()
|
|
|
+ if color is None:
|
|
|
+ color = ax._get_lines.color_cycle.next()
|
|
|
+ ymin, ymax = yerr
|
|
|
+ ax.plot(x, y, color=color)
|
|
|
+ ax.fill_between(x, ymax, ymin, color=color, alpha=alpha_fill)
|
|
|
+
|
|
|
+
|
|
|
+def generate(l, la = 0.992, init = 0.01, it = 1000):
|
|
|
+ axis = []
|
|
|
+ resu = []
|
|
|
+ resu_bars_mini = []
|
|
|
+ resu_bars_maxi = []
|
|
|
+ NB_IT = 15
|
|
|
+ for i in range(10, 1000, 25):
|
|
|
+ results[i] = []
|
|
|
+ axis.append(i)
|
|
|
+ mini =10
|
|
|
+ maxi = 0
|
|
|
+ for j in range(NB_IT):
|
|
|
+ os.system('./main '+str(l)+" "+str(i)+ " "+str(it)+ " "+ str(la)+ " "+ str(init)+ " > res")
|
|
|
+ r = open("res", "r")
|
|
|
+ res = float(r.readline())
|
|
|
+ mini = min(res, mini)
|
|
|
+ maxi = max(res, maxi)
|
|
|
+ results[i].append(res)
|
|
|
+ resu.append(sum(results[i])/NB_IT)
|
|
|
+ resu_bars_mini.append(mini)
|
|
|
+ resu_bars_maxi.append(maxi)
|
|
|
+
|
|
|
+ resu_bars = [resu_bars_mini, resu_bars_maxi]
|
|
|
+ print results
|
|
|
+ print axis
|
|
|
+ print resu
|
|
|
+ print resu_bars
|
|
|
+
|
|
|
+ #plt.errorbar(axis, resu, resu_bars, fmt='o')
|
|
|
+
|
|
|
+ errorfill(axis, resu, resu_bars)
|
|
|
+
|
|
|
+
|
|
|
+generate(1, 0.99, 0.1, 100)
|
|
|
+generate(1, 0.99, 0.1, 300)
|
|
|
+generate(1, 0.99, 0.1, 600)
|
|
|
+generate(1, 0.99, 0.1, 1000)
|
|
|
+generate(1, 0.99, 0.1, 1300)
|
|
|
+generate(1, 0.99, 0.1, 1600)
|
|
|
+generate(1, 0.99, 0.1, 2000)
|
|
|
+plt.show()
|