math-spec-mapping 0.3.5__tar.gz → 0.3.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {math_spec_mapping-0.3.5/src/math_spec_mapping.egg-info → math_spec_mapping-0.3.7}/PKG-INFO +4 -3
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/README.md +3 -2
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/pyproject.toml +1 -1
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Block.py +5 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/MathSpec.py +151 -4
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/StatefulMetric.py +1 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/stateful_metrics.py +9 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/markdown.py +1 -1
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7/src/math_spec_mapping.egg-info}/PKG-INFO +4 -3
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/LICENSE +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/setup.cfg +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/ActionTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/BoundaryAction.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/ControlAction.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Entity.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Mechanism.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Metric.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Parameter.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Policy.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Space.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/State.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/StateUpdateTransmissionChannel.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Type.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/__init__.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Convenience/__init__.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Convenience/documentation.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Convenience/starter.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/__init__.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/action_transmission_channel.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/control_actions.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/displays.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/entities.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/general.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/implementations.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/load.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/mechanism.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/metrics.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/parameters.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/policy.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/spaces.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/state_update_transmission_channels.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/states.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/type.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/wiring.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/__init__.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/boundary_actions.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/control_actions.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/general.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/html.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/mechanisms.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/node_map.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/parameters.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/policies.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/spaces.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/state.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/tables.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/wiring.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/__init__.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/schema.py +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/schema.schema.json +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/SOURCES.txt +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/requires.txt +0 -0
- {math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: math-spec-mapping
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.7
|
4
4
|
Summary: A library for easy mapping of mathematical specifications.
|
5
5
|
Author-email: Sean McOwen <Sean@Block.Science>
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
@@ -45,8 +45,9 @@ Writing mathematical specifications can be a difficult process, especially when
|
|
45
45
|
```mermaid
|
46
46
|
graph TD
|
47
47
|
A[JSON Object \n\n Each spec has a repo for tracking changes \n Must conform to the json specification \n Defines all aspects of the spec including blocks, spaces and actions] -->B[MSML Object \n\n JSON file is parsed, with validations and mappings along the way \n Can show different views on the fly]
|
48
|
-
B --> C[Report Outputs \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ]
|
49
|
-
|
48
|
+
B --> C[Report Outputs & Obsidian Directory \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ\n Also builds an entire Obsidian directory of all components as linked notes]
|
49
|
+
D[Python Function Implementations \n\n Optional enhancement to actually execute code\n Done for each referenced policy option, mechanism, etc. \n Just needs a function definition for each] --> B
|
50
|
+
B --> E[Python Wirings & Simulations \n\n MSML can be used to run blocks \n Wirings automatically work to pass between domain/codomains \n Entire simulations can be built up as composed wirings]
|
50
51
|
```
|
51
52
|
|
52
53
|
## MSML in the Engineering Lifecycle
|
@@ -30,8 +30,9 @@ Writing mathematical specifications can be a difficult process, especially when
|
|
30
30
|
```mermaid
|
31
31
|
graph TD
|
32
32
|
A[JSON Object \n\n Each spec has a repo for tracking changes \n Must conform to the json specification \n Defines all aspects of the spec including blocks, spaces and actions] -->B[MSML Object \n\n JSON file is parsed, with validations and mappings along the way \n Can show different views on the fly]
|
33
|
-
B --> C[Report Outputs \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ]
|
34
|
-
|
33
|
+
B --> C[Report Outputs & Obsidian Directory \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ\n Also builds an entire Obsidian directory of all components as linked notes]
|
34
|
+
D[Python Function Implementations \n\n Optional enhancement to actually execute code\n Done for each referenced policy option, mechanism, etc. \n Just needs a function definition for each] --> B
|
35
|
+
B --> E[Python Wirings & Simulations \n\n MSML can be used to run blocks \n Wirings automatically work to pass between domain/codomains \n Entire simulations can be built up as composed wirings]
|
35
36
|
```
|
36
37
|
|
37
38
|
## MSML in the Engineering Lifecycle
|
@@ -37,6 +37,7 @@ class Block:
|
|
37
37
|
)
|
38
38
|
]
|
39
39
|
)
|
40
|
+
self.domain_blocks2 = self.domain_blocks[:]
|
40
41
|
self.codomain_blocks = tuple(
|
41
42
|
[
|
42
43
|
self
|
@@ -191,6 +192,9 @@ class ParallelBlock(Block):
|
|
191
192
|
self.domain_blocks = tuple(
|
192
193
|
[i for x in self.components for i in x.domain_blocks]
|
193
194
|
)
|
195
|
+
self.domain_blocks2 = tuple(
|
196
|
+
[x for x in self.components for i in x.domain_blocks2]
|
197
|
+
)
|
194
198
|
self.codomain_blocks = tuple(
|
195
199
|
[i for x in self.components for i in x.codomain_blocks]
|
196
200
|
)
|
@@ -320,6 +324,7 @@ class StackBlock(Block):
|
|
320
324
|
)
|
321
325
|
|
322
326
|
self.domain_blocks = self.components[0].domain_blocks
|
327
|
+
self.domain_blocks2 = self.components[0].domain_blocks2
|
323
328
|
self.codomain_blocks = self.components[-1].codomain_blocks
|
324
329
|
self.domain_blocks_empty = self.components[0].domain_blocks_empty
|
325
330
|
self.codomain_blocks_empty = self.components[-1].codomain_blocks_empty
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/MathSpec.py
RENAMED
@@ -7,6 +7,7 @@ from .BoundaryAction import BoundaryAction
|
|
7
7
|
import os
|
8
8
|
from copy import deepcopy
|
9
9
|
import shutil
|
10
|
+
import pandas as pd
|
10
11
|
|
11
12
|
|
12
13
|
class MathSpec:
|
@@ -45,6 +46,7 @@ class MathSpec:
|
|
45
46
|
self._check_dictionary_names()
|
46
47
|
self._build_functional_parameters()
|
47
48
|
self._build_parameter_types()
|
49
|
+
self._crawl_spaces()
|
48
50
|
|
49
51
|
def _check_dictionary_names(self):
|
50
52
|
for key in self.boundary_actions:
|
@@ -406,6 +408,18 @@ class MathSpec:
|
|
406
408
|
self.behavioral_parameters_types = behavioral_parameters_types
|
407
409
|
self.functional_parameters_types = functional_parameters_types
|
408
410
|
|
411
|
+
def _crawl_spaces(self):
|
412
|
+
self._used_spaces = []
|
413
|
+
self._used_spaces.extend([x.codomain for x in self.control_actions.values()])
|
414
|
+
self._used_spaces.extend([x.codomain for x in self.boundary_actions.values()])
|
415
|
+
self._used_spaces.extend([x.domain for x in self.policies.values()])
|
416
|
+
self._used_spaces.extend([x.codomain for x in self.policies.values()])
|
417
|
+
self._used_spaces.extend([x.domain for x in self.mechanisms.values()])
|
418
|
+
|
419
|
+
self._used_spaces = list(set().union(*self._used_spaces))
|
420
|
+
us_names = [y.name for y in self._used_spaces]
|
421
|
+
self._unused_spaces = [self.spaces[x] for x in self.spaces if x not in us_names]
|
422
|
+
|
409
423
|
def metaprogramming_python_types(self, model_directory, overwrite=False):
|
410
424
|
path = model_directory + "/types.py"
|
411
425
|
if not overwrite:
|
@@ -456,6 +470,75 @@ class MathSpec:
|
|
456
470
|
with open(path, "w") as f:
|
457
471
|
f.write(out)
|
458
472
|
|
473
|
+
def run_experiment(
|
474
|
+
self,
|
475
|
+
experiment,
|
476
|
+
params_base,
|
477
|
+
state_base,
|
478
|
+
post_processing_function,
|
479
|
+
state_preperation_functions=None,
|
480
|
+
metrics_functions=None,
|
481
|
+
):
|
482
|
+
if experiment["Param Modifications"]:
|
483
|
+
params_base = deepcopy(params_base)
|
484
|
+
for key in experiment["Param Modifications"]:
|
485
|
+
params_base[key] = experiment["Param Modifications"][key]
|
486
|
+
msi = self.build_implementation(params_base)
|
487
|
+
state, params = msi.prepare_state_and_params(
|
488
|
+
state_base,
|
489
|
+
params_base,
|
490
|
+
state_preperation_functions=state_preperation_functions,
|
491
|
+
)
|
492
|
+
|
493
|
+
state = msi.execute_blocks(state, params, experiment["Blocks"])
|
494
|
+
df = post_processing_function(state, params)
|
495
|
+
|
496
|
+
if metrics_functions:
|
497
|
+
metrics = {}
|
498
|
+
for metrics_function in metrics_functions:
|
499
|
+
metrics_function(metrics, state, params, df)
|
500
|
+
metrics = pd.Series(metrics)
|
501
|
+
else:
|
502
|
+
metrics = None
|
503
|
+
|
504
|
+
return state, params, msi, df, metrics
|
505
|
+
|
506
|
+
def run_experiments(
|
507
|
+
self,
|
508
|
+
experiments,
|
509
|
+
params_base,
|
510
|
+
state_base,
|
511
|
+
post_processing_function,
|
512
|
+
state_preperation_functions=None,
|
513
|
+
metrics_functions=None,
|
514
|
+
):
|
515
|
+
state_l = []
|
516
|
+
params_l = []
|
517
|
+
df_l = []
|
518
|
+
metrics_l = []
|
519
|
+
for experiment in experiments:
|
520
|
+
for i in range(experiment["Monte Carlo Runs"]):
|
521
|
+
state, params, msi, df, metrics = self.run_experiment(
|
522
|
+
experiment,
|
523
|
+
params_base,
|
524
|
+
state_base,
|
525
|
+
post_processing_function,
|
526
|
+
state_preperation_functions=state_preperation_functions,
|
527
|
+
metrics_functions=metrics_functions,
|
528
|
+
)
|
529
|
+
df["Monte Carlo Run"] = i + 1
|
530
|
+
df["Experiment"] = experiment["Name"]
|
531
|
+
metrics.loc["Monte Carlo Run"] = i + 1
|
532
|
+
metrics.loc["Experiment"] = experiment["Name"]
|
533
|
+
metrics.name = "{}-{}".format(experiment["Name"], i + 1)
|
534
|
+
state_l.append(state)
|
535
|
+
params_l.append(params)
|
536
|
+
df_l.append(df)
|
537
|
+
metrics_l.append(metrics)
|
538
|
+
df = pd.concat(df_l)
|
539
|
+
metrics = pd.concat(metrics_l, axis=1).T
|
540
|
+
return df, metrics, state_l, params_l
|
541
|
+
|
459
542
|
def metaprogramming_python_states(
|
460
543
|
self, model_directory, overwrite=False, default_values=None
|
461
544
|
):
|
@@ -683,7 +766,9 @@ class MathSpecImplementation:
|
|
683
766
|
self.boundary_actions = self.load_boundary_actions()
|
684
767
|
self.policies = self.load_policies()
|
685
768
|
self.mechanisms = self.load_mechanisms()
|
769
|
+
self.stateful_metrics = self.load_stateful_metrics()
|
686
770
|
self.load_wiring()
|
771
|
+
self.load_components()
|
687
772
|
|
688
773
|
def load_control_actions(self):
|
689
774
|
control_actions = {}
|
@@ -761,6 +846,10 @@ class MathSpecImplementation:
|
|
761
846
|
return mechanisms
|
762
847
|
|
763
848
|
def load_single_wiring(self, wiring):
|
849
|
+
hold = wiring
|
850
|
+
domain_sizes = {}
|
851
|
+
for x in wiring.components:
|
852
|
+
domain_sizes[x.name] = len(x.domain)
|
764
853
|
components = [x.name for x in wiring.components]
|
765
854
|
if wiring.block_type == "Stack Block":
|
766
855
|
|
@@ -772,16 +861,32 @@ class MathSpecImplementation:
|
|
772
861
|
elif wiring.block_type == "Parallel Block":
|
773
862
|
|
774
863
|
spaces_mapping = {}
|
775
|
-
for x in wiring.components:
|
776
|
-
spaces_mapping[x.name] = []
|
777
864
|
|
778
|
-
for
|
865
|
+
for y in [x.name for x in wiring.domain_blocks2]:
|
866
|
+
spaces_mapping[y] = []
|
867
|
+
|
868
|
+
for i, x in enumerate([x.name for x in wiring.domain_blocks2]):
|
779
869
|
spaces_mapping[x].append(i)
|
780
870
|
|
781
871
|
def wiring(state, params, spaces):
|
872
|
+
spaces_mapping_temp = deepcopy(spaces_mapping)
|
782
873
|
codomain = []
|
783
874
|
for component in components:
|
784
|
-
|
875
|
+
if component in spaces_mapping_temp:
|
876
|
+
spaces_i = [spaces[i] for i in spaces_mapping_temp[component]][
|
877
|
+
: domain_sizes[component]
|
878
|
+
]
|
879
|
+
# Fix for repeated block names
|
880
|
+
spaces_mapping_temp[component] = spaces_mapping_temp[component][
|
881
|
+
domain_sizes[component] :
|
882
|
+
]
|
883
|
+
else:
|
884
|
+
assert component in [
|
885
|
+
x.name for x in hold.domain_blocks_empty
|
886
|
+
], "{} not in domain_blocks_empty of wiring {}".format(
|
887
|
+
component, hold
|
888
|
+
)
|
889
|
+
spaces_i = []
|
785
890
|
spaces_i = self.blocks[component](state, params, spaces_i)
|
786
891
|
if spaces_i:
|
787
892
|
codomain.extend(spaces_i)
|
@@ -822,6 +927,22 @@ class MathSpecImplementation:
|
|
822
927
|
policies[p.name] = opt.implementations["python"]
|
823
928
|
return policies
|
824
929
|
|
930
|
+
def load_stateful_metrics(self):
|
931
|
+
stateful_metrics = {}
|
932
|
+
|
933
|
+
for sm in self.ms.stateful_metrics_map:
|
934
|
+
sm = self.ms.stateful_metrics_map[sm]
|
935
|
+
if "python" not in sm.implementations:
|
936
|
+
print(
|
937
|
+
"No python implementation for {}. To fix this, go to Implementations/Python/StatefulMetrics and add {}".format(
|
938
|
+
sm.name, sm.name
|
939
|
+
)
|
940
|
+
)
|
941
|
+
else:
|
942
|
+
stateful_metrics[sm.name] = sm.implementations["python"]
|
943
|
+
|
944
|
+
return stateful_metrics
|
945
|
+
|
825
946
|
def load_wiring(
|
826
947
|
self,
|
827
948
|
):
|
@@ -885,3 +1006,29 @@ class MathSpecImplementation:
|
|
885
1006
|
assert (
|
886
1007
|
len(shouldnt_be_in_params) == 0
|
887
1008
|
), "The following parameters are extra: {}".format(shouldnt_be_in_params)
|
1009
|
+
|
1010
|
+
def prepare_state_and_params(self, state, params, state_preperation_functions=None):
|
1011
|
+
self.validate_state_and_params(state, params)
|
1012
|
+
state = deepcopy(state)
|
1013
|
+
params = deepcopy(params)
|
1014
|
+
state["Stateful Metrics"] = self.stateful_metrics
|
1015
|
+
if state_preperation_functions:
|
1016
|
+
for f in state_preperation_functions:
|
1017
|
+
state = f(state)
|
1018
|
+
assert (
|
1019
|
+
state is not None
|
1020
|
+
), "A state must be returned from the state preperation functions"
|
1021
|
+
return state, params
|
1022
|
+
|
1023
|
+
def load_components(self):
|
1024
|
+
self.components = {}
|
1025
|
+
self.components.update(self.control_actions)
|
1026
|
+
self.components.update(self.boundary_actions)
|
1027
|
+
self.components.update(self.policies)
|
1028
|
+
self.components.update(self.mechanisms)
|
1029
|
+
self.components.update(self.wiring)
|
1030
|
+
|
1031
|
+
def execute_blocks(self, state, params, blocks):
|
1032
|
+
for block in blocks:
|
1033
|
+
self.components[block](state, params, [])
|
1034
|
+
return state
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/stateful_metrics.py
RENAMED
@@ -39,6 +39,15 @@ def convert_stateful_metric(ms, data: Dict) -> StatefulMetricSet:
|
|
39
39
|
), "Variable '{}' not in variable map for stateful metrics variables used".format(
|
40
40
|
x[1]
|
41
41
|
)
|
42
|
+
|
43
|
+
var["implementations"] = {}
|
44
|
+
|
45
|
+
if "python" in ms["Implementations"]:
|
46
|
+
if "stateful_metrics" in ms["Implementations"]["python"]:
|
47
|
+
if var["name"] in ms["Implementations"]["python"]["stateful_metrics"]:
|
48
|
+
var["implementations"]["python"] = ms["Implementations"]["python"][
|
49
|
+
"stateful_metrics"
|
50
|
+
][var["name"]]
|
42
51
|
new_variables.append(StatefulMetric(var))
|
43
52
|
data["metrics"] = new_variables
|
44
53
|
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/markdown.py
RENAMED
@@ -538,7 +538,7 @@ def write_stateful_metrics_markdown_report(ms, path, metric, add_metadata=True):
|
|
538
538
|
out += "Domain: {}\n\n".format(metric.domain)
|
539
539
|
|
540
540
|
out += "## Parameters Used\n"
|
541
|
-
for i, x in enumerate(sorted(metric.parameters_used, key=lambda x: x
|
541
|
+
for i, x in enumerate(sorted(metric.parameters_used, key=lambda x: x)):
|
542
542
|
out += "{}. [[{}]]".format(i + 1, x)
|
543
543
|
out += "\n"
|
544
544
|
out += "\n"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: math-spec-mapping
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.7
|
4
4
|
Summary: A library for easy mapping of mathematical specifications.
|
5
5
|
Author-email: Sean McOwen <Sean@Block.Science>
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
@@ -45,8 +45,9 @@ Writing mathematical specifications can be a difficult process, especially when
|
|
45
45
|
```mermaid
|
46
46
|
graph TD
|
47
47
|
A[JSON Object \n\n Each spec has a repo for tracking changes \n Must conform to the json specification \n Defines all aspects of the spec including blocks, spaces and actions] -->B[MSML Object \n\n JSON file is parsed, with validations and mappings along the way \n Can show different views on the fly]
|
48
|
-
B --> C[Report Outputs \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ]
|
49
|
-
|
48
|
+
B --> C[Report Outputs & Obsidian Directory \n\n Automatically build reports for the full spec or subviews \n Example: all blocks with an effect on variable XYZ\n Also builds an entire Obsidian directory of all components as linked notes]
|
49
|
+
D[Python Function Implementations \n\n Optional enhancement to actually execute code\n Done for each referenced policy option, mechanism, etc. \n Just needs a function definition for each] --> B
|
50
|
+
B --> E[Python Wirings & Simulations \n\n MSML can be used to run blocks \n Wirings automatically work to pass between domain/codomains \n Entire simulations can be built up as composed wirings]
|
50
51
|
```
|
51
52
|
|
52
53
|
## MSML in the Engineering Lifecycle
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/BoundaryAction.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/ControlAction.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Mechanism.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/Parameter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Classes/__init__.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Convenience/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Convenience/starter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/boundary_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/control_actions.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/implementations.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Load/parameters.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/__init__.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/control_actions.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/general.py
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/mechanisms.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/node_map.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/parameters.py
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/Reports/policies.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping/schema.schema.json
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/requires.txt
RENAMED
File without changes
|
{math_spec_mapping-0.3.5 → math_spec_mapping-0.3.7}/src/math_spec_mapping.egg-info/top_level.txt
RENAMED
File without changes
|