-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
34 lines (27 loc) · 906 Bytes
/
main.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
import src.burning as bd
import src.hoshen_kopelman as hk
import src.percolation_plot as plot
import argparse
import json
import sys
def parameters(filename):
with open(filename, "r+") as config_file:
config = json.loads(config_file.read())
return config
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--method", type=str, help="burning or clustering", required=True)
args = parser.parse_args()
filename = "config.json"
kwargs = parameters(filename)
if args.method == "burning":
bd.main_burning(**kwargs)
elif args.method == "clustering":
hk.main_hoshen_kopelman(**kwargs)
elif args.method == "plot":
trials = 1000
lattice_size = [10]
plot.plot_burning(trials, lattice_size)
plot.plot_clustering(trials, lattice_size)
else:
sys.exit("Wrong method")