forked from ModECI/MDF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.py
90 lines (87 loc) · 3.43 KB
/
output.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
from neuromllite.utils import _parse_element
from modeci_mdf.mdf import Model
from modeci_mdf.execution_engine import EvaluableGraph
import json
data = json.loads(
"""{
"Simple": {
"format": "ModECI MDF v0.2",
"generating_application": "Python modeci-mdf v0.2.1",
"graphs": {
"simple_example": {
"nodes": {
"input_node": {
"parameters": {
"input_level": {
"value": 0.5
}
},
"output_ports": {
"out_port": {
"value": "input_level"
}
}
},
"processing_node": {
"input_ports": {
"input_port1": {}
},
"parameters": {
"lin_slope": {
"value": 0.5
},
"lin_intercept": {
"value": 0
},
"log_gain": {
"value": 3
},
"linear_1": {
"function": "linear",
"args": {
"variable0": "input_port1",
"slope": "lin_slope",
"intercept": "lin_intercept"
}
},
"logistic_1": {
"function": "logistic",
"args": {
"variable0": "linear_1",
"gain": "log_gain",
"bias": 0,
"offset": 0
}
}
},
"output_ports": {
"output_1": {
"value": "logistic_1"
}
}
}
},
"edges": {
"input_edge": {
"parameters": {
"weight": 0.55
},
"sender": "input_node",
"receiver": "processing_node",
"sender_port": "out_port",
"receiver_port": "input_port1"
}
}
}
}
}
}"""
)
model = Model()
model = _parse_element(data, model)
print("----")
print(model)
graph = model.graphs[0]
egraph = EvaluableGraph(graph, False)
###### TODO: update WebGME import to handle post https://github.com/ModECI/MDF/issues/101 changes!
result = graph # DeepForge requires the concept of interest to be available as "result"