help="Number of tests", dest="T", default=50) (options, args) = parser.parse_args() p = Percolation(options.L, options.R, options.N, options.O, (options.I, options.I)) print(p.run()) p.draw() if options.T: p.N = options.L * options.L for _ in range(options.T): p.run() tests = sorted(p.tests) pace = max(options.T // 100, 1) stats = {} for i in range(0, options.T, pace): stats[tests[i]] = float(i) / options.T l = list(zip(*list(stats.items()))) import matplotlib.pyplot as plt plt.plot(l[0], l[1], 'ro') plt.axis([0, options.L * options.L, 0, 1]) plt.show() print("Mean: ", Stats.mean(l[0])) print("Deviation: ", Stats.stddev(l[0])) print("95 percent confidence interval: ", Stats.confidence(l[0]))