-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #279 from cadCAD-org/dev
Pre-Release: ver. 0.4.26
- Loading branch information
Showing
12 changed files
with
172 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,44 @@ | ||
from pprint import pprint | ||
|
||
from cadCAD import logo, version | ||
from cadCAD.utils import flatten | ||
|
||
|
||
def print_exec_info(exec_context, configs): | ||
print(logo) | ||
print(f'cadCAD Version: {version}') | ||
print(f'Execution Mode: {exec_context}') | ||
models = len(configs) | ||
first_sim = configs[0].sim_config | ||
n_t = len(first_sim['T']) | ||
n_m = len(first_sim['M']) | ||
n_n = first_sim['N'] | ||
n_s = len(configs[0].initial_state) | ||
sim_strs, run_vals, timestep_vals, params, sub_states = [], [], [], [], set() | ||
for i, config in enumerate(configs): | ||
sim_config = config.sim_config | ||
n_n = sim_config['N'] | ||
n_t = len(sim_config['T']) | ||
n_m = len(sim_config['M']) | ||
n_s = len(config.initial_state) | ||
run_vals.append(n_n) | ||
for timestep in [*sim_config['T']]: | ||
timestep_vals.append(timestep) | ||
if type(sim_config['M']) is dict: | ||
params.append(n_m) | ||
else: | ||
n_m = 0 | ||
for state_key in list(config.initial_state.keys()): | ||
sub_states.add(state_key) | ||
|
||
sim_strs.append(f' Simulation {i}: (Timesteps, Params, Runs, Sub-States) = ({n_t}, {n_m}, {n_n}, {n_s})') | ||
|
||
timesteps = len(timestep_vals) | ||
if sum(params) != 0: | ||
param_count = sum(params) | ||
else: | ||
param_count = 0 | ||
runs = sum(run_vals) | ||
init_states = len(sub_states) | ||
|
||
print("Simulation Dimensions:") | ||
print( | ||
f'Dimensions of the first simulation: (Models, Timesteps, Params, Runs, Vars) = ({models}, {n_t}, {n_m}, {n_n}, {n_s})' | ||
f'Entire Simulation: (Models, Unique Timesteps, Params, Total Runs, Sub-States) = ({models}, {timesteps}, {param_count}, {runs}, {init_states})' | ||
) | ||
for sim_str in sim_strs: | ||
print(sim_str) |
Binary file not shown.
Binary file renamed
BIN
+55.3 KB
dist/cadCAD-0.4.25-py3-none-any.whl → dist/cadCAD-0.4.26-py3-none-any.whl
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<table> | ||
<tr> | ||
<th> | ||
Feature | ||
</th> | ||
<th> | ||
ver. 0.4.26 | ||
</th> | ||
<th> | ||
ver. 0.4.23 | ||
</th> | ||
</tr> | ||
<tr> | ||
<td> | ||
<h5> | ||
Experiments & System Model Configurations | ||
</h5> | ||
</td> | ||
<td> | ||
<pre lang="python"> | ||
from cadCAD.configuration import Experiment | ||
|
||
exp = Experiment() | ||
exp.append_model( | ||
model_id = 'sys_model_1', # System Model | ||
initial_state = ..., # System Model | ||
partial_state_update_blocks = ..., # System Model | ||
policy_ops = ..., # System Model | ||
sim_configs = ..., # Simulation Properties | ||
) | ||
exp.append_model( | ||
model_id = 'sys_model_2', # System Model | ||
... | ||
) | ||
|
||
configs = exp.configs | ||
</pre> | ||
</td> | ||
<td> | ||
<pre lang="python"> | ||
from cadCAD import configs | ||
from cadCAD.configuration import Experiment | ||
exp = Experiment() | ||
exp.append_configs(...) | ||
</pre> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<h5> | ||
cadCAD Post-Processing Modifications | ||
</h5> | ||
</td> | ||
<td> | ||
<pre lang="python"> | ||
import pandas as pd | ||
from tabulate import tabulate | ||
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor | ||
from simulations.regression_tests.experiments import multi_exp | ||
from simulations.regression_tests.models import config_multi_1, config_multi_2 | ||
|
||
exec_mode = ExecutionMode() | ||
|
||
local_proc_ctx = ExecutionContext(context=exec_mode.local_mode) | ||
run = Executor(exec_context=local_proc_ctx, configs=multi_exp.configs) | ||
|
||
raw_result, tensor_fields, _ = run.execute() | ||
result = pd.DataFrame(raw_result) | ||
print(tabulate(tensor_fields[0], headers='keys', tablefmt='psql')) | ||
print(tabulate(result, headers='keys', tablefmt='psql')) | ||
</pre> | ||
</td> | ||
<td> | ||
<pre lang="python"> | ||
import pandas as pd | ||
from tabulate import tabulate | ||
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor | ||
import system_model_A, system_model_B | ||
|
||
from cadCAD import configs | ||
exec_mode = ExecutionMode() | ||
|
||
local_ctx = ExecutionContext(context=exec_mode.local_mode) | ||
simulation = Executor(exec_context=local_ctx, configs=configs) | ||
raw_result, sys_model, _ = simulation.execute() | ||
result = pd.DataFrame(raw_result) | ||
print(tabulate(result, headers='keys', tablefmt='psql')) | ||
</pre> | ||
</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
""" | ||
|
||
name = "cadCAD" | ||
version = "0.4.25" | ||
version = "0.4.26" | ||
|
||
setup(name=name, | ||
version=version, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from tabulate import tabulate | ||
from pprint import pprint | ||
import pandas as pd | ||
|
||
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor | ||
from simulations.regression_tests.experiments import multi_exp | ||
from simulations.regression_tests.models import config_multi_1, sweep_config | ||
|
||
exec_mode = ExecutionMode() | ||
|
||
local_proc_ctx = ExecutionContext(context=exec_mode.local_mode) | ||
run = Executor(exec_context=local_proc_ctx, configs=multi_exp.configs) | ||
|
||
raw_result, tensor_fields, sessions = run.execute() | ||
result = pd.DataFrame(raw_result) | ||
print(tabulate(tensor_fields[0], headers='keys', tablefmt='psql')) | ||
# pprint(sessions) | ||
print(tabulate(result, headers='keys', tablefmt='psql')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters