-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGOL_time_analyse.py
56 lines (35 loc) · 1.17 KB
/
GOL_time_analyse.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
import numpy as np
import matplotlib.pyplot as plt
from GOL_Lattice import GOL_Lattice
import sys
def main(N, num_reps):
"""
Function to run a basic Game Of Life
Parameters
----------
N: int
Size of lattice. Assumes square NxN lattice.
num_reps: int
number of times to run GOL in order to build histogram data
Returns
-------
"""
end_points = []
for i in range(num_reps):
L = GOL_Lattice(N)
L.run(wait_sweeps=0, num_tot_sweeps=5000, plot_anim=False)
end_points.append(L.sweep_list[-1])
#plt.plot(L.sweep_list, L.num_activ_sites)
#plt.show()
if i%10 == 0:
print(i)
np.savetxt("GOL_hist_data.txt", end_points, delimiter=",")
if __name__ == "__main__":
#if incorrect umbe rof arguments are given, state what arguments are expected for which process
if len(sys.argv) != 3:
print("Usage: \n N (int), num_reps (int)")
print("For further usage instructions, see README or documentation")
sys.exit(1)
#if only one Temperature is to be evaluated
elif len(sys.argv) == 3:
main(int(sys.argv[1]), int(sys.argv[2]))