math-spec-mapping 0.2.4__tar.gz → 0.2.6__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {math_spec_mapping-0.2.4/src/math_spec_mapping.egg-info → math_spec_mapping-0.2.6}/PKG-INFO +5 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/README.md +4 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/pyproject.toml +4 -2
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Block.py +12 -0
- math_spec_mapping-0.2.6/src/Convenience/__init__.py +1 -0
- math_spec_mapping-0.2.6/src/Convenience/documentation.py +49 -0
- math_spec_mapping-0.2.6/src/Load/implementations.py +16 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/load.py +2 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/stateful_metrics.py +4 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/type.py +33 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/html.py +11 -4
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/markdown.py +52 -4
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/__init__.py +2 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6/src/math_spec_mapping.egg-info}/PKG-INFO +5 -1
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/SOURCES.txt +2 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/top_level.txt +0 -2
- math_spec_mapping-0.2.4/src/Convenience/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/LICENSE +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/setup.cfg +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/ActionTransmissionChannel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/BoundaryAction.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/ControlAction.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Entity.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/MathSpec.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Mechanism.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Metric.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Parameter.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Policy.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Space.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/State.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/StateUpdateTransmissionChannel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/StatefulMetric.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/Type.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Convenience/starter.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/action_transmission_channel.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/boundary_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/control_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/displays.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/entities.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/general.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/mechanism.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/metrics.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/parameters.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/policy.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/spaces.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/state_update_transmission_channels.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/states.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Load/wiring.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/__init__.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/boundary_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/control_actions.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/general.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/mechanisms.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/node_map.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/parameters.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/policies.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/spaces.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/state.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/tables.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Reports/wiring.py +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/dependency_links.txt +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/requires.txt +0 -0
- {math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/schema.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: math_spec_mapping
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.6
|
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
|
@@ -23,6 +23,10 @@ It uses block diagram wirings and spaces to represent the actions in complex sys
|
|
23
23
|
|
24
24
|
One good example is the [wiring report](https://github.com/SeanMcOwen/Root-Finding-Simulation/blob/main/MSML/reports/Simulation%20Block.md) for the Root Finding Simulation canonical example.
|
25
25
|
|
26
|
+
## Installing the library
|
27
|
+
|
28
|
+
To install the library, simply pip install by running "pip install math_spec_mapping"
|
29
|
+
|
26
30
|
## Why MSML?
|
27
31
|
|
28
32
|
Writing mathematical specifications can be a difficult process, especially when variable names are changed or new mechanisms are introduced. MSML seeks to streamline the process with automations as well as enhance the abilities of static math specs to deliver deeper insights. Because it is automated, one can write specifications at different levels of details or for different purposes.
|
@@ -8,6 +8,10 @@ It uses block diagram wirings and spaces to represent the actions in complex sys
|
|
8
8
|
|
9
9
|
One good example is the [wiring report](https://github.com/SeanMcOwen/Root-Finding-Simulation/blob/main/MSML/reports/Simulation%20Block.md) for the Root Finding Simulation canonical example.
|
10
10
|
|
11
|
+
## Installing the library
|
12
|
+
|
13
|
+
To install the library, simply pip install by running "pip install math_spec_mapping"
|
14
|
+
|
11
15
|
## Why MSML?
|
12
16
|
|
13
17
|
Writing mathematical specifications can be a difficult process, especially when variable names are changed or new mechanisms are introduced. MSML seeks to streamline the process with automations as well as enhance the abilities of static math specs to deliver deeper insights. Because it is automated, one can write specifications at different levels of details or for different purposes.
|
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
4
4
|
[project]
|
5
5
|
name = "math_spec_mapping"
|
6
|
-
version = "0.2.
|
6
|
+
version = "0.2.6"
|
7
7
|
authors = [
|
8
8
|
{ name="Sean McOwen", email="Sean@Block.Science" },
|
9
9
|
]
|
@@ -19,4 +19,6 @@ classifiers = [
|
|
19
19
|
"Programming Language :: Python :: 3",
|
20
20
|
"License :: OSI Approved :: MIT License",
|
21
21
|
"Operating System :: OS Independent",
|
22
|
-
]
|
22
|
+
]
|
23
|
+
[tool.setuptools.packages.find]
|
24
|
+
where = ["src"]
|
@@ -141,6 +141,18 @@ class Block:
|
|
141
141
|
self.all_updates.extend(x.all_updates)
|
142
142
|
self.all_updates = list(set(self.all_updates))
|
143
143
|
|
144
|
+
def components_full(self):
|
145
|
+
q = [self]
|
146
|
+
out = []
|
147
|
+
while len(q) > 0:
|
148
|
+
cur = q.pop()
|
149
|
+
if hasattr(cur, "components"):
|
150
|
+
q.extend(cur.components)
|
151
|
+
else:
|
152
|
+
out.append(cur)
|
153
|
+
out = list(set(out))
|
154
|
+
return out
|
155
|
+
|
144
156
|
|
145
157
|
class ParallelBlock(Block):
|
146
158
|
def __init__(self, data: Dict):
|
@@ -0,0 +1 @@
|
|
1
|
+
from .documentation import write_top_level_json_description
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from src import schema
|
2
|
+
|
3
|
+
|
4
|
+
def write_json_description(schema, key, name):
|
5
|
+
out = "- **{}**: ".format(name)
|
6
|
+
|
7
|
+
out += schema["definitions"][key]["description"]
|
8
|
+
out += "\n"
|
9
|
+
return out
|
10
|
+
|
11
|
+
|
12
|
+
def write_top_level_json_description(indent_level):
|
13
|
+
|
14
|
+
out = "#{} MSML Components".format("#" * indent_level)
|
15
|
+
out += "\n\n"
|
16
|
+
out += "MSML extends GDS with multiple types of blocks and other enhancements. Below are the definitions of top level components."
|
17
|
+
out += "\n\n"
|
18
|
+
|
19
|
+
out += "##{} Types & Spaces".format("#" * indent_level)
|
20
|
+
out += "\n\n"
|
21
|
+
|
22
|
+
out += write_json_description(schema, "Type", "Type")
|
23
|
+
out += write_json_description(schema, "Space", "Space")
|
24
|
+
|
25
|
+
out += "\n"
|
26
|
+
|
27
|
+
out += "##{} Entities, States, Parameters & Metrics".format("#" * indent_level)
|
28
|
+
out += "\n\n"
|
29
|
+
|
30
|
+
out += write_json_description(schema, "Entity", "Entity")
|
31
|
+
out += write_json_description(schema, "State", "State")
|
32
|
+
out += write_json_description(schema, "StatefulMetric", "Stateful Metric")
|
33
|
+
out += write_json_description(schema, "Parameter", "Parameter")
|
34
|
+
out += write_json_description(schema, "Metric", "Metric")
|
35
|
+
|
36
|
+
out += "\n"
|
37
|
+
|
38
|
+
out += "##{} Blocks & Wiring".format("#" * indent_level)
|
39
|
+
out += "\n\n"
|
40
|
+
|
41
|
+
out += write_json_description(schema, "BoundaryAction", "Boundary Action")
|
42
|
+
out += write_json_description(schema, "ControlAction", "Control Action")
|
43
|
+
out += write_json_description(schema, "Policy", "Policy")
|
44
|
+
out += write_json_description(schema, "Mechanism", "Mechanism")
|
45
|
+
out += write_json_description(schema, "Wiring", "Wiring")
|
46
|
+
|
47
|
+
out += "\n"
|
48
|
+
|
49
|
+
return out
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
|
4
|
+
def load_implementations(ms):
|
5
|
+
implementations = {}
|
6
|
+
python_path = "src/Implementations/Python/__init__.py"
|
7
|
+
if os.path.exists(python_path):
|
8
|
+
implementations["python"] = load_python_implementations()
|
9
|
+
|
10
|
+
ms["Implementations"] = implementations
|
11
|
+
|
12
|
+
|
13
|
+
def load_python_implementations():
|
14
|
+
from src.Implementations.Python import implementation
|
15
|
+
|
16
|
+
return implementation
|
@@ -16,6 +16,7 @@ from .wiring import load_wiring
|
|
16
16
|
from .type import load_types, load_type_keys
|
17
17
|
from .metrics import load_metrics
|
18
18
|
from .displays import load_displays
|
19
|
+
from .implementations import load_implementations
|
19
20
|
|
20
21
|
|
21
22
|
def load_from_json(json: Dict) -> MathSpec:
|
@@ -39,6 +40,7 @@ def load_from_json(json: Dict) -> MathSpec:
|
|
39
40
|
# Do loading one by one to transfer the json
|
40
41
|
|
41
42
|
load_type_keys(ms)
|
43
|
+
load_implementations(ms)
|
42
44
|
load_types(ms, json)
|
43
45
|
load_spaces(ms, json)
|
44
46
|
load_states(ms, json)
|
@@ -55,5 +55,9 @@ def load_stateful_metrics(ms: Dict, json: Dict) -> None:
|
|
55
55
|
"""
|
56
56
|
|
57
57
|
ms["Stateful Metrics"] = {}
|
58
|
+
check = []
|
58
59
|
for sm in json["Stateful Metrics"]:
|
59
60
|
ms["Stateful Metrics"][sm["name"]] = convert_stateful_metric(ms, sm)
|
61
|
+
for x in ms["Stateful Metrics"][sm["name"]].metrics:
|
62
|
+
assert x.name not in check, "{} stateful metric name is repeated"
|
63
|
+
check.append(x)
|
@@ -37,9 +37,14 @@ def convert_type(data, ms):
|
|
37
37
|
data["type_name"]["python"] = data["type"]["python"].__repr__()
|
38
38
|
else:
|
39
39
|
data["type_name"]["python"] = data["type"]["python"].__name__
|
40
|
+
if "typescript" in ms["Type Keys"]:
|
40
41
|
if type_name in ms["Type Keys"]["typescript"]:
|
41
42
|
data["type"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
42
43
|
data["type_name"]["typescript"] = ms["Type Keys"]["typescript"][type_name]
|
44
|
+
if "julia" in ms["Type Keys"]:
|
45
|
+
if type_name in ms["Type Keys"]["julia"]:
|
46
|
+
data["type"]["julia"] = ms["Type Keys"]["julia"][type_name]
|
47
|
+
data["type_name"]["julia"] = ms["Type Keys"]["julia"][type_name]
|
43
48
|
|
44
49
|
# Build the type object
|
45
50
|
return Type(data)
|
@@ -88,13 +93,40 @@ def load_typescript_type_key(path):
|
|
88
93
|
return type_definitions
|
89
94
|
|
90
95
|
|
91
|
-
def
|
96
|
+
def load_julia_type_key(path):
|
97
|
+
with open(path, "r") as file:
|
98
|
+
type_definitions = file.read()
|
99
|
+
type_definitions = type_definitions.split("end")
|
100
|
+
type_definitions = [x.strip() for x in type_definitions]
|
101
|
+
type_definitions = [x for x in type_definitions if len(x) > 0]
|
102
|
+
|
103
|
+
hold = type_definitions[:]
|
104
|
+
type_definitions = {}
|
105
|
+
for x in hold:
|
106
|
+
name = x
|
107
|
+
if x.startswith("abstract type"):
|
108
|
+
name = name[14:]
|
109
|
+
name = name[: name.index("<:")].strip()
|
110
|
+
elif x.startswith("struct"):
|
111
|
+
name = name[7:]
|
112
|
+
name = name[: name.index("\n")].strip()
|
113
|
+
else:
|
114
|
+
assert False
|
115
|
+
|
116
|
+
type_definitions[name] = x
|
117
|
+
return type_definitions
|
118
|
+
|
119
|
+
|
120
|
+
def load_type_keys(ms):
|
92
121
|
type_keys = {}
|
93
122
|
python_path = "src/TypeMappings/types.py"
|
94
123
|
typescript_path = "src/TypeMappings/types.ts"
|
124
|
+
julia_path = "src/TypeMappings/types.jl"
|
95
125
|
if os.path.exists(python_path):
|
96
126
|
type_keys["python"] = load_python_type_key()
|
97
127
|
if os.path.exists(typescript_path):
|
98
128
|
type_keys["typescript"] = load_typescript_type_key(typescript_path)
|
129
|
+
if os.path.exists(julia_path):
|
130
|
+
type_keys["julia"] = load_julia_type_key(julia_path)
|
99
131
|
|
100
132
|
ms["Type Keys"] = type_keys
|
@@ -147,11 +147,18 @@ def write_spec_tree(
|
|
147
147
|
out += symbol1 + "**Stateful Metrics**\n"
|
148
148
|
for name in ms.stateful_metrics.keys():
|
149
149
|
if linking:
|
150
|
-
out += symbol2 + "
|
150
|
+
out += symbol2 + "{}".format(name) + "\n"
|
151
151
|
else:
|
152
152
|
out += symbol2 + name + "\n"
|
153
153
|
for var in ms.stateful_metrics[name].metrics:
|
154
|
-
out += symbol3 + var.name + "\n"
|
154
|
+
out += symbol3 + "[[{}]]".format(var.name) + "\n"
|
155
|
+
|
156
|
+
out += symbol1 + "**Types**\n"
|
157
|
+
for name in ms.types.keys():
|
158
|
+
if linking:
|
159
|
+
out += symbol2 + "[[{}]]".format(name) + "\n"
|
160
|
+
else:
|
161
|
+
out += symbol2 + name + "\n"
|
155
162
|
|
156
163
|
out += symbol1 + "**Spaces**\n"
|
157
164
|
for name in ms.spaces.keys():
|
@@ -162,11 +169,11 @@ def write_spec_tree(
|
|
162
169
|
out += symbol1 + "**Parameters**\n"
|
163
170
|
for name in ms.parameters.data.keys():
|
164
171
|
if linking:
|
165
|
-
out += symbol2 + "
|
172
|
+
out += symbol2 + "{}".format(name) + "\n"
|
166
173
|
else:
|
167
174
|
out += symbol2 + name + "\n"
|
168
175
|
for param in [x.name for x in ms.parameters.data[name].parameters]:
|
169
|
-
out += symbol3 + param + "\n"
|
176
|
+
out += symbol3 + "[[{}]]".format(param) + "\n"
|
170
177
|
|
171
178
|
out += symbol1 + "**Boundary Actions**\n"
|
172
179
|
for name in ms.boundary_actions.keys():
|
@@ -99,6 +99,10 @@ def write_types_markdown_report(ms, path, t, add_metadata=True):
|
|
99
99
|
out += "### Typescript Type\n"
|
100
100
|
out += t.type_name["typescript"]
|
101
101
|
out += "\n"
|
102
|
+
if "julia" in t.type:
|
103
|
+
out += "### Julia Type\n"
|
104
|
+
out += t.type_name["julia"]
|
105
|
+
out += "\n"
|
102
106
|
out += "\n"
|
103
107
|
out += "## Notes"
|
104
108
|
out += "\n\n"
|
@@ -135,6 +139,12 @@ def write_boundary_action_markdown_report(ms, path, boundary_action, add_metadat
|
|
135
139
|
out += "\n"
|
136
140
|
out += "\n"
|
137
141
|
|
142
|
+
out += "## Followed By\n"
|
143
|
+
for i, x in enumerate([x[0] for x in boundary_action.calls]):
|
144
|
+
out += "{}. [[{}]]".format(i + 1, x.label)
|
145
|
+
out += "\n"
|
146
|
+
out += "\n"
|
147
|
+
|
138
148
|
out += "## Constraints"
|
139
149
|
for i, x in enumerate(boundary_action.constraints):
|
140
150
|
out += "{}. {}".format(i + 1, x)
|
@@ -342,6 +352,12 @@ def write_control_action_markdown_report(ms, path, control_action, add_metadata=
|
|
342
352
|
out += control_action.description
|
343
353
|
out += "\n"
|
344
354
|
|
355
|
+
out += "## Followed By\n"
|
356
|
+
for i, x in enumerate([x[0] for x in control_action.calls]):
|
357
|
+
out += "{}. [[{}]]".format(i + 1, x.label)
|
358
|
+
out += "\n"
|
359
|
+
out += "\n"
|
360
|
+
|
345
361
|
out += "## Constraints"
|
346
362
|
for i, x in enumerate(control_action.constraints):
|
347
363
|
out += "{}. {}".format(i + 1, x)
|
@@ -406,7 +422,14 @@ def write_wiring_markdown_report(ms, path, wiring, add_metadata=True):
|
|
406
422
|
|
407
423
|
out += "\n"
|
408
424
|
|
409
|
-
out += "##
|
425
|
+
out += "## All Blocks\n"
|
426
|
+
for i, x in enumerate(wiring.components_full()):
|
427
|
+
out += "{}. [[{}]]".format(i + 1, x.name)
|
428
|
+
out += "\n"
|
429
|
+
|
430
|
+
out += "\n"
|
431
|
+
|
432
|
+
out += "## Constraints\n"
|
410
433
|
for i, x in enumerate(wiring.constraints):
|
411
434
|
out += "{}. {}".format(i + 1, x)
|
412
435
|
out += "\n"
|
@@ -510,7 +533,7 @@ def write_stateful_metrics_markdown_report(ms, path, metric, add_metadata=True):
|
|
510
533
|
|
511
534
|
out += "## Variables Used\n"
|
512
535
|
for i, x in enumerate(metric.variables_used):
|
513
|
-
out += "{}. {}.{}".format(i + 1, x[0], x[1])
|
536
|
+
out += "{}. [[{}]].{}".format(i + 1, x[0], x[1])
|
514
537
|
out += "\n"
|
515
538
|
out += "\n"
|
516
539
|
|
@@ -544,12 +567,18 @@ def write_metrics_markdown_report(ms, path, metric, add_metadata=True):
|
|
544
567
|
out += "## Parameters Used\n"
|
545
568
|
for i, x in enumerate(metric.parameters_used):
|
546
569
|
out += "{}. [[{}]]".format(i + 1, x)
|
570
|
+
var = ms.parameters.parameter_map[x]
|
571
|
+
if var.symbol:
|
572
|
+
out += " , symbol: {}".format(var.symbol)
|
547
573
|
out += "\n"
|
548
574
|
out += "\n"
|
549
575
|
|
550
576
|
out += "## Variables Used\n"
|
551
577
|
for i, x in enumerate(metric.variables_used):
|
552
578
|
out += "{}. {}.{}".format(i + 1, x[0], x[1])
|
579
|
+
var = ms.state[x[0]].variable_map[x[1]]
|
580
|
+
if var.symbol:
|
581
|
+
out += " , symbol: {}".format(var.symbol)
|
553
582
|
out += "\n"
|
554
583
|
out += "\n"
|
555
584
|
|
@@ -603,7 +632,7 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
|
|
603
632
|
out += "\n"
|
604
633
|
|
605
634
|
out += "## Unique Components Used\n"
|
606
|
-
components = [set(x.
|
635
|
+
components = [set(x.components_full()) for x in wirings]
|
607
636
|
components = set().union(*components)
|
608
637
|
for i, x in enumerate(components):
|
609
638
|
out += "{}. [[{}]]".format(i + 1, x.name)
|
@@ -638,7 +667,26 @@ def write_wiring_display_markdown_report(ms, path, wiring, add_metadata=True):
|
|
638
667
|
f.write(out)
|
639
668
|
|
640
669
|
|
641
|
-
def write_all_markdown_reports(ms, path):
|
670
|
+
def write_all_markdown_reports(ms, path, clear_folders=False):
|
671
|
+
if clear_folders:
|
672
|
+
for x in [
|
673
|
+
"Metrics",
|
674
|
+
"Mechanisms",
|
675
|
+
"Types",
|
676
|
+
"Control Actions",
|
677
|
+
"Spaces",
|
678
|
+
".obsidian",
|
679
|
+
"Boundary Actions",
|
680
|
+
"Policies",
|
681
|
+
"Wiring",
|
682
|
+
"States",
|
683
|
+
"Parameters",
|
684
|
+
"Entities",
|
685
|
+
"Stateful Metrics",
|
686
|
+
]:
|
687
|
+
if os.path.exists("{}/{}".format(path, x)):
|
688
|
+
for y in os.listdir("{}/{}".format(path, x)):
|
689
|
+
os.remove("{}/{}/{}".format(path, x, y))
|
642
690
|
|
643
691
|
# Write entities
|
644
692
|
entities = list(ms.entities.keys())
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: math_spec_mapping
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.6
|
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
|
@@ -23,6 +23,10 @@ It uses block diagram wirings and spaces to represent the actions in complex sys
|
|
23
23
|
|
24
24
|
One good example is the [wiring report](https://github.com/SeanMcOwen/Root-Finding-Simulation/blob/main/MSML/reports/Simulation%20Block.md) for the Root Finding Simulation canonical example.
|
25
25
|
|
26
|
+
## Installing the library
|
27
|
+
|
28
|
+
To install the library, simply pip install by running "pip install math_spec_mapping"
|
29
|
+
|
26
30
|
## Why MSML?
|
27
31
|
|
28
32
|
Writing mathematical specifications can be a difficult process, especially when variable names are changed or new mechanisms are introduced. MSML seeks to streamline the process with automations as well as enhance the abilities of static math specs to deliver deeper insights. Because it is automated, one can write specifications at different levels of details or for different purposes.
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/SOURCES.txt
RENAMED
@@ -20,6 +20,7 @@ src/Classes/StatefulMetric.py
|
|
20
20
|
src/Classes/Type.py
|
21
21
|
src/Classes/__init__.py
|
22
22
|
src/Convenience/__init__.py
|
23
|
+
src/Convenience/documentation.py
|
23
24
|
src/Convenience/starter.py
|
24
25
|
src/Load/__init__.py
|
25
26
|
src/Load/action_transmission_channel.py
|
@@ -28,6 +29,7 @@ src/Load/control_actions.py
|
|
28
29
|
src/Load/displays.py
|
29
30
|
src/Load/entities.py
|
30
31
|
src/Load/general.py
|
32
|
+
src/Load/implementations.py
|
31
33
|
src/Load/load.py
|
32
34
|
src/Load/mechanism.py
|
33
35
|
src/Load/metrics.py
|
File without changes
|
File without changes
|
File without changes
|
{math_spec_mapping-0.2.4 → math_spec_mapping-0.2.6}/src/Classes/ActionTransmissionChannel.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.2.4 → math_spec_mapping-0.2.6}/src/Classes/StateUpdateTransmissionChannel.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.2.4 → math_spec_mapping-0.2.6}/src/Load/state_update_transmission_channels.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.2.4 → math_spec_mapping-0.2.6}/src/math_spec_mapping.egg-info/requires.txt
RENAMED
File without changes
|
File without changes
|