-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
101 lines (94 loc) · 2.3 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import click
from click_loglevel import LogLevel
import datetime
import logging
from cell import initialize_cells
from column_packer import (
create_random_column,
establish_connections,
normalize_io_biases,
populate_column
)
from data_structures import Column, Grid
from simulation_voltage import (
are_grids_different,
run_simulation,
save_combined_vti_files
)
@click.command()
@click.option(
"--io-number",
"-i",
default=10,
show_default=True,
help="number of unidirectional (input|output) connections to establish",
)
@click.option(
"--ro-number",
"-r",
default=5,
show_default=True,
help="number of bidirectional connections to establish",
)
@click.option(
"--drid-number",
"-d",
default=10,
show_default=True,
help="number of drids per column",
)
@click.option(
"--grid-dimension",
"-g",
default=3,
show_default=True,
help="dimensionality of each grid",
)
@click.option(
"--grid-size",
"-s",
default=10,
show_default=True,
help="range of each dimension within a grid",
)
@click.option(
"--frame-number",
"-f",
default=100,
show_default=True,
help="number of frames to run the simulation",
)
@click.option(
"--rendering-offset",
"-o",
default=10,
show_default=True,
help="size offset to use for rendering results to vti files",
)
@click.option(
"--log-level",
"-l",
type=LogLevel(),
default=logging.INFO
)
def main(io_number, ro_number, drid_number, grid_dimension, grid_size, frame_number, rendering_offset, log_level):
logging.basicConfig(
format="[%(levelname)-8s] %(message)s",
level=log_level,
)
logging.info("Run at: %s", datetime.datetime.now())
logging.info("Log level set to: %r", log_level)
logging.info(f"{io_number = }, {ro_number = }, {drid_number = }, {grid_dimension = }, {grid_size = }, {frame_number = }, {rendering_offset = }")
random_column = create_random_column(
io_number, ro_number, drid_number, grid_dimension, grid_size
)
initialize_cells(random_column)
result_column = run_simulation(random_column, frame_number)
save_combined_vti_files(
result_column,
frame_number,
"output",
rendering_offset
)
if __name__ == "__main__":
main()