-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunSimulation.py
More file actions
20 lines (14 loc) · 826 Bytes
/
runSimulation.py
File metadata and controls
20 lines (14 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from src.Cells import Cells
from src.HexGrid import HexGrid
from src.Logging import myLogger as Logger
from src.Metrics import calculateOutputs
# Function to run the simulation with given parameters
def run_simulation(params, writeLogs=False, createGif=False, has_voronoi_analysis=False, has_NN_analysis=False):
grid = HexGrid(size=params['grid_size'])
cells = Cells(grid, params)
logger = Logger(cells, params) if writeLogs else None
while cells.stopSignal is False:
cells.move_cell_bfs(savePlot=createGif)
logger.log_running_metrics(cells, has_voronoi_analysis, has_NN_analysis) if writeLogs else None
calculateOutputs(cells, createGif=createGif, has_voronoi_analysis=has_voronoi_analysis, has_NN_analysis=has_NN_analysis, logger=logger)
logger.write_logs() if logger else None