neuropercolation/examples/Simulate4Layers.py

58 lines
1.7 KiB
Python
Raw Normal View History

2023-08-23 14:25:27 +00:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 19:05:04 2023
@author: astral
"""
2023-09-30 17:53:06 +00:00
import os
2023-08-23 14:25:27 +00:00
from datetime import datetime
import numpy as np
from neuropercolation import Simulate4Layers
2023-09-30 17:53:06 +00:00
def new_folder(path):
if not os.path.exists(path):
os.makedirs(path)
2023-08-23 14:25:27 +00:00
eps_space = np.linspace(0.005,0.5,100)
#eps_space = np.linspace(0.135,0.15,4)
stp = 1000100
2023-12-10 21:47:15 +00:00
dims = range(25,26)
2023-09-30 17:53:06 +00:00
batches = 1
path = f'/cloud/Public/_data/neuropercolation/4lay/cons=27-knight_steps=1000100_diares/dim=09/batch=0/'
2023-08-23 14:25:27 +00:00
2023-09-30 17:53:06 +00:00
for dim in dims:
con_gap = 3
cons = [(n,(2*n+m)%dim) for n in range(dim) for m in range(0,dim-2,con_gap)]
dimpath = path + f'dim={dim:02}_cons={len(cons)}/'
max_bat=0
# for file in os.listdir(dimpath):
# f = os.path.join(dimpath, file)
# if not os.path.isfile(f):
# bat = file.replace('batch=','')
# if bat != file and int(bat)+1 > max_bat:
# max_bat = int(bat)+1
for batch in range(max_bat, max_bat+batches):
savepath = dimpath + f'batch={batch}'
new_folder(savepath)
2023-12-10 21:47:15 +00:00
for eps in [0.05]:#list(eps_space[61::2]):
2023-08-23 14:25:27 +00:00
eps = round(eps,3)
2023-08-27 19:12:43 +00:00
initstate = [[0,0],[0,0]]
2023-08-23 14:25:27 +00:00
sim = Simulate4Layers(dim,
eps,
coupling=cons,
2023-08-27 19:12:43 +00:00
init=initstate,
2023-08-23 14:25:27 +00:00
steps=stp,
2023-09-30 17:53:06 +00:00
noeffect=-1,
2023-12-10 21:47:15 +00:00
fps=60,
draw='pygame',
res=10,
save=None,
2023-09-30 17:53:06 +00:00
path=path,
2023-08-23 14:25:27 +00:00
)
print(f'Done eps={eps:.3f} with dim={dim} at {datetime.now()}')