-
-
Notifications
You must be signed in to change notification settings - Fork 273
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 #300 from cadCAD-org/staging
ver. 0.4.28
- Loading branch information
Showing
15 changed files
with
271 additions
and
23 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
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
Binary file not shown.
Binary file renamed
BIN
+56.2 KB
dist/cadCAD-0.4.27-py3-none-any.whl → dist/cadCAD-0.4.28-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,88 @@ | ||
<table> | ||
<tr> | ||
<th> | ||
Feature | ||
</th> | ||
<th> | ||
ver. 0.4.28 | ||
</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 - OPTIONAL | ||
initial_state = ..., # System Model | ||
partial_state_update_blocks = ..., # System Model | ||
policy_ops = ..., # System Model | ||
sim_configs = ..., # Simulation Properties | ||
) | ||
exp.append_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.27" | ||
version = "0.4.28" | ||
|
||
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,3 @@ | ||
from cadCAD.configuration import Experiment | ||
|
||
exp = Experiment() |
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,78 @@ | ||
import unittest | ||
from copy import deepcopy | ||
|
||
from testing.models import exp | ||
from testing.models.param_sweep import sim_config as sim_config_a | ||
from testing.models.param_sweep import genesis_states as genesis_states_a | ||
from testing.models.param_sweep import env_process as env_process_a | ||
from testing.models.param_sweep import partial_state_update_blocks as psubs_a | ||
|
||
|
||
def append_model_id(model_ids, sim_config, genesis_states, env_process, psubs): | ||
exp_copy = deepcopy(exp) | ||
for mod_id in model_ids: | ||
exp_copy.append_model( | ||
model_id=mod_id, | ||
sim_configs=sim_config, | ||
initial_state=genesis_states, | ||
env_processes=env_process, | ||
partial_state_update_blocks=psubs, | ||
policy_ops=[lambda a, b: a + b] | ||
) | ||
return exp_copy | ||
|
||
|
||
class AppendModelTest(unittest.TestCase): | ||
def test_index_model_ids(self): | ||
no_id_exp = append_model_id( | ||
model_ids=[None] * 10, | ||
sim_config=sim_config_a, | ||
genesis_states=genesis_states_a, | ||
env_process=env_process_a, | ||
psubs=psubs_a | ||
) | ||
expected = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] | ||
self.assertEqual(no_id_exp.model_ids == expected, True, "Incorrect Indexing of System Model IDs") | ||
|
||
def test_same_model_ids(self): | ||
same_id_exp = append_model_id( | ||
model_ids=['sys_model'] * 10, | ||
sim_config=sim_config_a, | ||
genesis_states=genesis_states_a, | ||
env_process=env_process_a, | ||
psubs=psubs_a | ||
) | ||
expected = [ | ||
'sys_model', 'sys_model@1', 'sys_model@2', 'sys_model@3', 'sys_model@4', 'sys_model@5', | ||
'sys_model@6', 'sys_model@7', 'sys_model@8', 'sys_model@9' | ||
] | ||
self.assertEqual(same_id_exp.model_ids == expected, True, "Incorrect Duplicate Indexing of System Model IDs") | ||
|
||
def test_different_model_ids(self): | ||
diff_id_exp = append_model_id( | ||
model_ids=[f'sys_model_{i}' for i in list(range(10))], | ||
sim_config=sim_config_a, | ||
genesis_states=genesis_states_a, | ||
env_process=env_process_a, | ||
psubs=psubs_a | ||
) | ||
expected = [ | ||
'sys_model_0', 'sys_model_1', 'sys_model_2', 'sys_model_3', 'sys_model_4', 'sys_model_5', | ||
'sys_model_6', 'sys_model_7', 'sys_model_8', 'sys_model_9' | ||
] | ||
self.assertEqual(diff_id_exp.model_ids == expected, True, "Incorrect Unique System Model IDs") | ||
|
||
def test_mix_model_ids(self): | ||
mix_exp = append_model_id( | ||
model_ids=[None, 'sys_model_A', None, 'sys_model_B', 'model@3', 'model@3'], | ||
sim_config=sim_config_a, | ||
genesis_states=genesis_states_a, | ||
env_process=env_process_a, | ||
psubs=psubs_a | ||
) | ||
expected = ['0', 'sys_model_A', '2', 'sys_model_B', 'model@3', 'model@3@5'] | ||
self.assertEqual(mix_exp.model_ids == expected, True, "Incorrect System Model ID Mix") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.