-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_run.py
52 lines (49 loc) · 2.13 KB
/
test_run.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
from causalset import CausalSet
import sys
import numpy as np
import os
import csv
import time
import json
path = 'TestRun/'
if len(sys.argv) > 1:
path = sys.argv[1] + '/'
def main():
tic = time.time()
for BHtype in ['Dynamic']:
if BHtype == 'Rindler':
rho_array = [100, 300, 1000, 3000, 10000]
elif BHtype == 'Dynamic':
rho_array = [0.03]
T = 3
for rho in rho_array:
for dimension in [4]:
#iterations
for _i in range(40):
print('sprinkling density', rho)
print('dimension:', dimension)
print('realisation', _i)
np.random.seed(int.from_bytes(os.urandom(4), byteorder='little'))
if BHtype == 'Rindler':
path2 = ''
with open(path2 + 'min_time.json') as f:
dfTime = json.load(f)
min_time = max(dfTime[f"{rho}_{dimension}d"], -1)
boundsArray = np.array([[-0.5, 0.5] for i in range(dimension)])
boundsArray[1][1] = 1.5
boundsArray[0][0] = 0.5 + min_time
c = CausalSet(sprinkling_density=rho, dimension=dimension, BHtype = BHtype, bounds = boundsArray)
c.find_molecules()
elif BHtype == 'Dynamic':
boundsArray = [0, 2*T, 0, T]
c = CausalSet(sprinkling_density=rho, dimension=dimension, BHtype = 'Dynamic', T=T, bounds = boundsArray)
c.find_molecules()
with open(path + f'test_run_{BHtype}_rho{rho}_{dimension}d.csv', 'a') as f:
writer = csv.writer(f, lineterminator='\n')
writer.writerow(['min_time', c.min_time])
writer.writerow(['min_distance', c.min_distance])
writer.writerow(['max_distance', c.max_distance])
toc= time.time()
print(f'Time taken is {toc - tic}')
if __name__ == "__main__":
main()