neuropercolation/examples/Simulate4Layers.py
2023-09-30 19:53:06 +02:00

58 lines
1.7 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 19:05:04 2023
@author: astral
"""
import os
from datetime import datetime
import numpy as np
from neuropercolation import Simulate4Layers
def new_folder(path):
if not os.path.exists(path):
os.makedirs(path)
eps_space = np.linspace(0.005,0.5,100)
#eps_space = np.linspace(0.135,0.15,4)
stp = 1000100
dims = range(9,10)
batches = 1
path = f'/cloud/Public/_data/neuropercolation/4lay/cons=27-knight_steps=1000100_diares/dim=09/batch=0/'
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)
for eps in [0.3]:#list(eps_space[61::2]):
eps = round(eps,3)
initstate = [[0,0],[0,0]]
sim = Simulate4Layers(dim,
eps,
coupling=cons,
init=initstate,
steps=stp,
noeffect=-1,
#fps=20,
draw=None,
res=6,
save='all',
path=path,
)
print(f'Done eps={eps:.3f} with dim={dim} at {datetime.now()}')