Rimjhim Mittal commited on
Commit
7ebed01
·
1 Parent(s): 4f65f95

Izhikevich Test model added

Browse files
app.py CHANGED
@@ -10,8 +10,6 @@ st.set_page_config(layout="wide", page_icon="logo.png", page_title="Model Descri
10
  'About': "ModECI (Model Exchange and Convergence Initiative) is a multi-investigator collaboration that aims to develop a standardized format for exchanging computational models across diverse software platforms and domains of scientific research and technology development, with a particular focus on neuroscience, Machine Learning and Artificial Intelligence. Refer to https://modeci.org/ for more."
11
  })
12
 
13
- # models: Purpose: To store the state of the model and update the model
14
- import numpy as np
15
  def reset_simulation_state():
16
  """Reset simulation-related session state variables."""
17
  if 'simulation_results' in st.session_state:
@@ -22,102 +20,67 @@ def reset_simulation_state():
22
  def run_simulation(param_inputs, mdf_model):
23
  mod_graph = mdf_model.graphs[0]
24
  nodes = mod_graph.nodes
25
- with st.spinner('Plotting the curve...'):
26
- for node in nodes:
27
- parameters = node.parameters
28
- outputs = node.output_ports
29
- eg = EvaluableGraph(mod_graph, verbose=False)
30
- duration = param_inputs["Simulation Duration (s)"]
31
- dt = param_inputs["Time Step (s)"]
32
- t = 0
33
- times = []
34
- output_values = {op.value: [] for op in outputs}
35
- while t <= duration:
36
- times.append(t)
37
- if t == 0:
38
- eg.evaluate()
 
 
 
 
 
 
 
 
 
 
 
 
39
  else:
40
- eg.evaluate(time_increment=dt)
41
-
42
- for param in output_values:
43
- if any(operator in param for operator in "+-/*"):
44
- eval_param = eg.enodes[node.id].evaluable_outputs[param]
45
- else:
46
- eval_param = eg.enodes[node.id].evaluable_parameters[param]
47
- output_value = eval_param.curr_value
48
- if isinstance(output_value, (list, np.ndarray)):
49
- # Extract the scalar value from the list or array
50
- scalar_value = output_value[0] if len(output_value) > 0 else np.nan
51
- output_values[param].append(float(scalar_value)) # Convert to Python float
52
- else:
53
- output_values[param].append(float(output_value)) # Convert to Python float
54
- t += dt
55
 
56
- chart_data = pd.DataFrame(output_values)
57
- chart_data['Time'] = times
58
- chart_data.set_index('Time', inplace=True)
59
- return chart_data
60
- # print(chart_data)
61
- # show_simulation_results(chart_data)
62
- # return None
63
-
64
- # def show_simulation_results(chart_data):
65
- # try:
66
- # if 'selected_columns' not in st.session_state:
67
- # st.session_state.selected_columns = {col: True for col in chart_data.columns}
68
-
69
- # def handle_checkbox_change():
70
- # st.session_state.selected_columns[column] = st.session_state[f"checkbox_{column}"]
71
-
72
- # columns = chart_data.columns
73
- # for column in columns:
74
- # if f"checkbox_{column}" not in st.session_state:
75
- # st.session_state[f"checkbox_{column}"] = st.session_state.selected_columns[column]
76
- # st.checkbox(
77
- # f"Show {column}",
78
- # value=st.session_state.selected_columns[column],
79
- # key=f"checkbox_{column}",
80
- # on_change=handle_checkbox_change
81
- # )
82
-
83
- # # Filter the data based on selected checkboxes
84
- # filtered_data = chart_data[[col for col, selected in st.session_state.selected_columns.items() if selected]]
85
-
86
- # # Display the line chart with filtered data
87
- # st.line_chart(filtered_data, use_container_width=True, height=400)
88
- # except Exception as e:
89
- # st.error(f"Error plotting chart: {e}")
90
- # st.write("Chart data types:")
91
- # st.write(chart_data.dtypes)
92
- # st.write("Chart data head:")
93
- # st.write(chart_data.head())
94
- # st.write("Chart data description:")
95
- # st.write(chart_data.describe())
96
-
97
- def show_simulation_results(chart_data):
98
- if chart_data is not None:
99
- if 'selected_columns' not in st.session_state:
100
- st.session_state.selected_columns = {col: True for col in chart_data.columns}
101
-
102
- columns = chart_data.columns
103
- for column in columns:
104
- st.checkbox(
105
- f"{column}",
106
- value=st.session_state.selected_columns[column],
107
- key=f"checkbox_{column}",
108
- on_change=update_selected_columns,
109
- args=(column,)
110
- )
111
-
112
- # Filter the data based on selected checkboxes
113
- filtered_data = chart_data[[col for col, selected in st.session_state.selected_columns.items() if selected]]
114
-
115
- # Display the line chart with filtered data
116
- st.line_chart(filtered_data, use_container_width=True, height=400)
117
-
118
- def update_selected_columns(column):
119
- st.session_state.selected_columns[column] = st.session_state[f"checkbox_{column}"]
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  def show_mdf_graph(mdf_model):
123
  st.subheader("MDF Graph")
@@ -237,56 +200,6 @@ def parameter_form_to_update_model_and_view(mdf_model, parameters, param_inputs,
237
 
238
  view_tabs(mdf_model, param_inputs)
239
 
240
- # def upload_file_and_load_to_model():
241
- # st.write("Choose how to load the model:")
242
- # load_option = st.radio("", ("Upload File", "GitHub URL", "Example Models"), )
243
- # st.write("Choose how to load the model:")
244
- # if load_option == "Upload File":
245
- # uploaded_file = st.file_uploader("Choose a JSON/YAML/BSON file", type=["json", "yaml", "bson"])
246
- # if uploaded_file is not None:
247
- # file_content = uploaded_file.getvalue()
248
- # file_extension = uploaded_file.name.split('.')[-1].lower()
249
- # return load_model_from_content(file_content, file_extension)
250
-
251
- # elif load_option == "GitHub URL":
252
- # st.write("sample_github_url = https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/NewtonCoolingModel.json")
253
- # github_url = st.text_input("Enter GitHub raw file URL:", placeholder="Enter GitHub raw file URL")
254
- # if github_url:
255
- # try:
256
- # response = requests.get(github_url)
257
- # response.raise_for_status()
258
- # file_content = response.content
259
- # file_extension = github_url.split('.')[-1].lower()
260
- # return load_model_from_content(file_content, file_extension)
261
- # except requests.RequestException as e:
262
- # st.error(f"Error loading file from GitHub: {e}")
263
- # return None
264
-
265
- # elif load_option == "Example Models":
266
- # example_models = {
267
- # "Newton Cooling Model": "https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/NewtonCoolingModel.json",
268
- # "ABCD": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/ABCD.json",
269
- # "FN": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/FN.mdf.json",
270
- # "States": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/States.json",
271
- # "Other Model 4": "https://example.com/other_model_4.json"
272
- # }
273
-
274
- # selected_model = st.selectbox("Choose an example model", list(example_models.keys()))
275
- # if selected_model:
276
- # example_url = example_models[selected_model]
277
- # try:
278
- # response = requests.get(example_url)
279
- # response.raise_for_status()
280
- # file_content = response.content
281
- # file_extension = example_url.split('.')[-1].lower()
282
- # return load_model_from_content(file_content, file_extension)
283
- # except requests.RequestException as e:
284
- # st.error(f"Error loading example model: {e}")
285
- # return None
286
-
287
- # st.write("Try out example files:")
288
- # return None
289
-
290
  def upload_file_and_load_to_model():
291
 
292
 
@@ -308,28 +221,7 @@ def upload_file_and_load_to_model():
308
  except requests.RequestException as e:
309
  st.error(f"Error loading file from GitHub: {e}")
310
  return None
311
- # with col2:
312
- # example_models = {
313
- # "Newton Cooling Model": "https://raw.githubusercontent.com/ModECI/MDF/development/examples/MDF/NewtonCoolingModel.json",
314
- # "ABCD": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/ABCD.json",
315
- # "FN": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/FN.mdf.json",
316
- # "States": "https://raw.githubusercontent.com/ModECI/MDF/main/examples/MDF/States.json",
317
- # "Other Model 4": "https://example.com/other_model_4.json"
318
- # }
319
- # selected_model = st.selectbox("Choose an example model", list(example_models.keys()), index=None)
320
- # if selected_model:
321
- # example_url = example_models[selected_model]
322
- # try:
323
- # response = requests.get(example_url)
324
- # response.raise_for_status()
325
- # file_content = response.content
326
- # file_extension = example_url.split('.')[-1].lower()
327
- # return load_model_from_content(file_content, file_extension)
328
- # except requests.RequestException as e:
329
- # st.error(f"Error loading example model: {e}")
330
- # return None
331
- # # st.button("Newton Cooling Model", on_click=load_mdf_json(""))
332
- # return None
333
  example_models = {
334
  "Newton Cooling Model": "./examples/NewtonCoolingModel.json",
335
  # "ABCD": "./examples/ABCD.json",
@@ -339,6 +231,7 @@ def upload_file_and_load_to_model():
339
  # "Arrays":"./examples/Arrays.json",
340
  # "RNN":"./examples/RNNs.json",
341
  # "IAF":"./examples/IAFs.json"
 
342
  }
343
  with col3:
344
  selected_model = st.selectbox("Choose an example model", list(example_models.keys()), index=None, placeholder="Dont have an MDF Model? Try some sample examples here!")
 
10
  'About': "ModECI (Model Exchange and Convergence Initiative) is a multi-investigator collaboration that aims to develop a standardized format for exchanging computational models across diverse software platforms and domains of scientific research and technology development, with a particular focus on neuroscience, Machine Learning and Artificial Intelligence. Refer to https://modeci.org/ for more."
11
  })
12
 
 
 
13
  def reset_simulation_state():
14
  """Reset simulation-related session state variables."""
15
  if 'simulation_results' in st.session_state:
 
20
  def run_simulation(param_inputs, mdf_model):
21
  mod_graph = mdf_model.graphs[0]
22
  nodes = mod_graph.nodes
23
+ duration = param_inputs["Simulation Duration (s)"]
24
+ dt = param_inputs["Time Step (s)"]
25
+
26
+ all_node_results = {}
27
+
28
+ for node in nodes:
29
+ eg = EvaluableGraph(mod_graph, verbose=False)
30
+ t = 0
31
+ times = []
32
+ node_outputs = {op.id: [] for op in node.output_ports}
33
+ node_outputs['Time'] = []
34
+
35
+ while t <= duration:
36
+ times.append(t)
37
+ if t == 0:
38
+ eg.evaluate()
39
+ else:
40
+ eg.evaluate(time_increment=dt)
41
+
42
+ node_outputs['Time'].append(t)
43
+ for op in node.output_ports:
44
+ eval_param = eg.enodes[node.id].evaluable_outputs[op.id]
45
+ output_value = eval_param.curr_value
46
+ if isinstance(output_value, (list, np.ndarray)):
47
+ scalar_value = output_value[0] if len(output_value) > 0 else np.nan
48
+ node_outputs[op.id].append(float(scalar_value))
49
  else:
50
+ node_outputs[op.id].append(float(output_value))
51
+ t += dt
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ all_node_results[node.id] = pd.DataFrame(node_outputs).set_index('Time')
54
+
55
+ return all_node_results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ def show_simulation_results(all_node_results):
58
+ if all_node_results is not None:
59
+ for node_id, chart_data in all_node_results.items():
60
+ st.subheader(f"Simulation Results for Node: {node_id}")
61
+
62
+ if 'selected_columns' not in st.session_state:
63
+ st.session_state.selected_columns = {node_id: {col: True for col in chart_data.columns}}
64
+ elif node_id not in st.session_state.selected_columns:
65
+ st.session_state.selected_columns[node_id] = {col: True for col in chart_data.columns}
66
+
67
+ columns = chart_data.columns
68
+ for column in columns:
69
+ st.checkbox(
70
+ f"{column}",
71
+ value=st.session_state.selected_columns[node_id][column],
72
+ key=f"checkbox_{node_id}_{column}",
73
+ on_change=update_selected_columns,
74
+ args=(node_id, column,)
75
+ )
76
+
77
+ # Filter the data based on selected checkboxes
78
+ filtered_data = chart_data[[col for col, selected in st.session_state.selected_columns[node_id].items() if selected]]
79
+
80
+ # Display the line chart with filtered data
81
+ st.line_chart(filtered_data, use_container_width=True, height=400)
82
+ def update_selected_columns(node_id, column):
83
+ st.session_state.selected_columns[node_id][column] = st.session_state[f"checkbox_{node_id}_{column}"]
84
 
85
  def show_mdf_graph(mdf_model):
86
  st.subheader("MDF Graph")
 
200
 
201
  view_tabs(mdf_model, param_inputs)
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  def upload_file_and_load_to_model():
204
 
205
 
 
221
  except requests.RequestException as e:
222
  st.error(f"Error loading file from GitHub: {e}")
223
  return None
224
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  example_models = {
226
  "Newton Cooling Model": "./examples/NewtonCoolingModel.json",
227
  # "ABCD": "./examples/ABCD.json",
 
231
  # "Arrays":"./examples/Arrays.json",
232
  # "RNN":"./examples/RNNs.json",
233
  # "IAF":"./examples/IAFs.json"
234
+ "Izhikevich Test":"./examples/IzhikevichTest.mdf.json"
235
  }
236
  with col3:
237
  selected_model = st.selectbox("Choose an example model", list(example_models.keys()), index=None, placeholder="Dont have an MDF Model? Try some sample examples here!")
examples/ABCD.mdf.json ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "ABCD": {
3
+ "format": "ModECI MDF v0.4",
4
+ "graphs": {
5
+ "ABCD": {
6
+ "notes": "Example of a simplified network",
7
+ "nodes": {
8
+ "A_input": {
9
+ "metadata": {
10
+ "color": "0.2 0.2 0.2",
11
+ "radius": 3,
12
+ "region": "region1"
13
+ },
14
+ "parameters": {
15
+ "variable": {
16
+ "value": [
17
+ 2.0
18
+ ]
19
+ },
20
+ "spike": {
21
+ "default_initial_value": [
22
+ 0
23
+ ],
24
+ "conditions": {
25
+ "condition_0_on": {
26
+ "test": "OUTPUT < 0",
27
+ "value": 1
28
+ },
29
+ "condition_0_off": {
30
+ "test": "spike > 0",
31
+ "value": 0
32
+ }
33
+ }
34
+ },
35
+ "V": {
36
+ "value": 0
37
+ },
38
+ "OUTPUT": {
39
+ "value": "variable"
40
+ }
41
+ },
42
+ "input_ports": {
43
+ "INPUT": {}
44
+ },
45
+ "output_ports": {
46
+ "spike": {
47
+ "value": "spike"
48
+ },
49
+ "V": {
50
+ "value": "V"
51
+ },
52
+ "OUTPUT": {
53
+ "value": "OUTPUT"
54
+ }
55
+ },
56
+ "notes": "Cell: [Cell(notes=None, id='a_input', parameters={'variable': 'A_initial'}, neuroml2_source_file=None, lems_source_file='PNL.xml', neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in PNL.xml and in Lems is: Component, id: a_input, type: inputNode,\n parameters: {'variable': '2'}\n parent: None\n"
57
+ },
58
+ "A": {
59
+ "metadata": {
60
+ "color": "0 0.9 0",
61
+ "radius": 5,
62
+ "region": "region1"
63
+ },
64
+ "parameters": {
65
+ "slope": {
66
+ "value": [
67
+ 2.0
68
+ ]
69
+ },
70
+ "intercept": {
71
+ "value": [
72
+ 2.0
73
+ ]
74
+ },
75
+ "spike": {
76
+ "default_initial_value": [
77
+ 0
78
+ ],
79
+ "conditions": {
80
+ "condition_0_on": {
81
+ "test": "OUTPUT < 0",
82
+ "value": 1
83
+ },
84
+ "condition_0_off": {
85
+ "test": "spike > 0",
86
+ "value": 0
87
+ }
88
+ }
89
+ },
90
+ "V": {
91
+ "value": 0
92
+ },
93
+ "OUTPUT": {
94
+ "value": "INPUT*slope + intercept"
95
+ }
96
+ },
97
+ "input_ports": {
98
+ "INPUT": {}
99
+ },
100
+ "output_ports": {
101
+ "spike": {
102
+ "value": "spike"
103
+ },
104
+ "V": {
105
+ "value": "V"
106
+ },
107
+ "OUTPUT": {
108
+ "value": "OUTPUT"
109
+ }
110
+ },
111
+ "notes": "Cell: [Cell(notes=None, id='a', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in PNL.xml and in Lems is: Component, id: a, type: pnlLinearFunctionTM,\n parameters: {'slope': '2', 'intercept': '2'}\n parent: None\n"
112
+ },
113
+ "B": {
114
+ "metadata": {
115
+ "color": ".8 .8 .8",
116
+ "radius": 5,
117
+ "region": "region1"
118
+ },
119
+ "parameters": {
120
+ "gain": {
121
+ "value": [
122
+ 1.0
123
+ ]
124
+ },
125
+ "bias": {
126
+ "value": [
127
+ 0.0
128
+ ]
129
+ },
130
+ "x_0": {
131
+ "value": [
132
+ 0.0
133
+ ]
134
+ },
135
+ "offset": {
136
+ "value": [
137
+ 0.0
138
+ ]
139
+ },
140
+ "spike": {
141
+ "default_initial_value": [
142
+ 0
143
+ ],
144
+ "conditions": {
145
+ "condition_0_on": {
146
+ "test": "OUTPUT < 0",
147
+ "value": 1
148
+ },
149
+ "condition_0_off": {
150
+ "test": "spike > 0",
151
+ "value": 0
152
+ }
153
+ }
154
+ },
155
+ "V": {
156
+ "value": 0
157
+ },
158
+ "OUTPUT": {
159
+ "value": "1/(1+numpy.exp(-1*gain*(INPUT + bias - x_0)+offset))"
160
+ }
161
+ },
162
+ "input_ports": {
163
+ "INPUT": {}
164
+ },
165
+ "output_ports": {
166
+ "spike": {
167
+ "value": "spike"
168
+ },
169
+ "V": {
170
+ "value": "V"
171
+ },
172
+ "OUTPUT": {
173
+ "value": "OUTPUT"
174
+ }
175
+ },
176
+ "notes": "Cell: [Cell(notes=None, id='b', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in PNL.xml and in Lems is: Component, id: b, type: pnlLogisticFunctionTM,\n parameters: {'gain': '1.0', 'bias': '0.0', 'x_0': '0.0', 'offset': '0.0'}\n parent: None\n"
177
+ },
178
+ "C": {
179
+ "metadata": {
180
+ "color": "0.7 0.7 0.7",
181
+ "radius": 5,
182
+ "region": "region1"
183
+ },
184
+ "parameters": {
185
+ "rate": {
186
+ "value": [
187
+ 1.0
188
+ ]
189
+ },
190
+ "bias": {
191
+ "value": [
192
+ 0.0
193
+ ]
194
+ },
195
+ "scale": {
196
+ "value": [
197
+ 1.0
198
+ ]
199
+ },
200
+ "offset": {
201
+ "value": [
202
+ 0.0
203
+ ]
204
+ },
205
+ "spike": {
206
+ "default_initial_value": [
207
+ 0
208
+ ],
209
+ "conditions": {
210
+ "condition_0_on": {
211
+ "test": "OUTPUT < 0",
212
+ "value": 1
213
+ },
214
+ "condition_0_off": {
215
+ "test": "spike > 0",
216
+ "value": 0
217
+ }
218
+ }
219
+ },
220
+ "V": {
221
+ "value": 0
222
+ },
223
+ "OUTPUT": {
224
+ "value": "scale * numpy.exp((rate * INPUT) + bias) + offset"
225
+ }
226
+ },
227
+ "input_ports": {
228
+ "INPUT": {}
229
+ },
230
+ "output_ports": {
231
+ "spike": {
232
+ "value": "spike"
233
+ },
234
+ "V": {
235
+ "value": "V"
236
+ },
237
+ "OUTPUT": {
238
+ "value": "OUTPUT"
239
+ }
240
+ },
241
+ "notes": "Cell: [Cell(notes=None, id='c', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in PNL.xml and in Lems is: Component, id: c, type: pnlExponentialFunctionTM,\n parameters: {'rate': '1.0', 'bias': '0.0', 'scale': '1.0', 'offset': '0.0'}\n parent: None\n"
242
+ },
243
+ "D": {
244
+ "metadata": {
245
+ "color": "0.7 0 0",
246
+ "radius": 5,
247
+ "region": "region1"
248
+ },
249
+ "parameters": {
250
+ "rate": {
251
+ "value": [
252
+ 0.05
253
+ ]
254
+ },
255
+ "time_step_size": {
256
+ "value": [
257
+ 0.1
258
+ ]
259
+ },
260
+ "spike": {
261
+ "default_initial_value": [
262
+ 0
263
+ ],
264
+ "conditions": {
265
+ "condition_0_on": {
266
+ "test": "OUTPUT < 0",
267
+ "value": 1
268
+ },
269
+ "condition_0_off": {
270
+ "test": "spike > 0",
271
+ "value": 0
272
+ }
273
+ }
274
+ },
275
+ "OUTPUT": {
276
+ "time_derivative": "(rate * INPUT) / time_step_size",
277
+ "default_initial_value": [
278
+ 0
279
+ ]
280
+ },
281
+ "V": {
282
+ "value": 0
283
+ }
284
+ },
285
+ "input_ports": {
286
+ "INPUT": {}
287
+ },
288
+ "output_ports": {
289
+ "spike": {
290
+ "value": "spike"
291
+ },
292
+ "OUTPUT": {
293
+ "value": "OUTPUT"
294
+ },
295
+ "V": {
296
+ "value": "V"
297
+ }
298
+ },
299
+ "notes": "Cell: [Cell(notes=None, id='d', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in PNL.xml and in Lems is: Component, id: d, type: pnlSimpleIntegratorMechanism,\n parameters: {'rate': '0.05', 'time_step_size': '0.1s'}\n parent: None\n"
300
+ },
301
+ "proj_input_rsDL": {
302
+ "parameters": {
303
+ "weight": {
304
+ "value": [
305
+ 1.0
306
+ ]
307
+ },
308
+ "SEC": {
309
+ "value": [
310
+ 1.0
311
+ ]
312
+ },
313
+ "rpeer": {
314
+ "value": "peer_OUTPUT"
315
+ },
316
+ "I": {
317
+ "value": "weight * rpeer"
318
+ }
319
+ },
320
+ "input_ports": {
321
+ "peer_OUTPUT": {}
322
+ },
323
+ "output_ports": {
324
+ "I": {
325
+ "value": "I"
326
+ }
327
+ },
328
+ "notes": "Cell: [Synapse(notes=None, id='rsDL', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', pynn_synapse_type=None, pynn_receptor_type=None)] is defined in PNL.xml and in Lems is: Component, id: rsDL, type: synapseDL,\n parameters: {}\n parent: None\n"
329
+ },
330
+ "proj0_rsDL": {
331
+ "parameters": {
332
+ "weight": {
333
+ "value": [
334
+ 1.0
335
+ ]
336
+ },
337
+ "SEC": {
338
+ "value": [
339
+ 1.0
340
+ ]
341
+ },
342
+ "rpeer": {
343
+ "value": "peer_OUTPUT"
344
+ },
345
+ "I": {
346
+ "value": "weight * rpeer"
347
+ }
348
+ },
349
+ "input_ports": {
350
+ "peer_OUTPUT": {}
351
+ },
352
+ "output_ports": {
353
+ "I": {
354
+ "value": "I"
355
+ }
356
+ },
357
+ "notes": "Cell: [Synapse(notes=None, id='rsDL', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', pynn_synapse_type=None, pynn_receptor_type=None)] is defined in PNL.xml and in Lems is: Component, id: rsDL, type: synapseDL,\n parameters: {}\n parent: None\n"
358
+ },
359
+ "proj1_rsDL": {
360
+ "parameters": {
361
+ "weight": {
362
+ "value": [
363
+ 1.0
364
+ ]
365
+ },
366
+ "SEC": {
367
+ "value": [
368
+ 1.0
369
+ ]
370
+ },
371
+ "rpeer": {
372
+ "value": "peer_OUTPUT"
373
+ },
374
+ "I": {
375
+ "value": "weight * rpeer"
376
+ }
377
+ },
378
+ "input_ports": {
379
+ "peer_OUTPUT": {}
380
+ },
381
+ "output_ports": {
382
+ "I": {
383
+ "value": "I"
384
+ }
385
+ },
386
+ "notes": "Cell: [Synapse(notes=None, id='rsDL', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', pynn_synapse_type=None, pynn_receptor_type=None)] is defined in PNL.xml and in Lems is: Component, id: rsDL, type: synapseDL,\n parameters: {}\n parent: None\n"
387
+ },
388
+ "proj2_rsDL": {
389
+ "parameters": {
390
+ "weight": {
391
+ "value": [
392
+ 1.0
393
+ ]
394
+ },
395
+ "SEC": {
396
+ "value": [
397
+ 1.0
398
+ ]
399
+ },
400
+ "rpeer": {
401
+ "value": "peer_OUTPUT"
402
+ },
403
+ "I": {
404
+ "value": "weight * rpeer"
405
+ }
406
+ },
407
+ "input_ports": {
408
+ "peer_OUTPUT": {}
409
+ },
410
+ "output_ports": {
411
+ "I": {
412
+ "value": "I"
413
+ }
414
+ },
415
+ "notes": "Cell: [Synapse(notes=None, id='rsDL', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', pynn_synapse_type=None, pynn_receptor_type=None)] is defined in PNL.xml and in Lems is: Component, id: rsDL, type: synapseDL,\n parameters: {}\n parent: None\n"
416
+ },
417
+ "proj3_rsDL": {
418
+ "parameters": {
419
+ "weight": {
420
+ "value": [
421
+ 1.0
422
+ ]
423
+ },
424
+ "SEC": {
425
+ "value": [
426
+ 1.0
427
+ ]
428
+ },
429
+ "rpeer": {
430
+ "value": "peer_OUTPUT"
431
+ },
432
+ "I": {
433
+ "value": "weight * rpeer"
434
+ }
435
+ },
436
+ "input_ports": {
437
+ "peer_OUTPUT": {}
438
+ },
439
+ "output_ports": {
440
+ "I": {
441
+ "value": "I"
442
+ }
443
+ },
444
+ "notes": "Cell: [Synapse(notes=None, id='rsDL', parameters=None, neuroml2_source_file=None, lems_source_file='PNL.xml', pynn_synapse_type=None, pynn_receptor_type=None)] is defined in PNL.xml and in Lems is: Component, id: rsDL, type: synapseDL,\n parameters: {}\n parent: None\n"
445
+ }
446
+ },
447
+ "edges": {
448
+ "A_TO_proj_input_rsDL": {
449
+ "name": "A_TO_proj_input_rsDL",
450
+ "sender_port": "OUTPUT",
451
+ "receiver_port": "peer_OUTPUT",
452
+ "sender": "A",
453
+ "receiver": "proj_input_rsDL"
454
+ },
455
+ "proj_input_rsDL_TO_B": {
456
+ "name": "proj_input_rsDL_TO_B",
457
+ "sender_port": "I",
458
+ "receiver_port": "INPUT",
459
+ "sender": "proj_input_rsDL",
460
+ "receiver": "B"
461
+ },
462
+ "A_input_TO_proj0_rsDL": {
463
+ "name": "A_input_TO_proj0_rsDL",
464
+ "sender_port": "OUTPUT",
465
+ "receiver_port": "peer_OUTPUT",
466
+ "sender": "A_input",
467
+ "receiver": "proj0_rsDL"
468
+ },
469
+ "proj0_rsDL_TO_A": {
470
+ "name": "proj0_rsDL_TO_A",
471
+ "sender_port": "I",
472
+ "receiver_port": "INPUT",
473
+ "sender": "proj0_rsDL",
474
+ "receiver": "A"
475
+ },
476
+ "A_TO_proj1_rsDL": {
477
+ "name": "A_TO_proj1_rsDL",
478
+ "sender_port": "OUTPUT",
479
+ "receiver_port": "peer_OUTPUT",
480
+ "sender": "A",
481
+ "receiver": "proj1_rsDL"
482
+ },
483
+ "proj1_rsDL_TO_C": {
484
+ "name": "proj1_rsDL_TO_C",
485
+ "sender_port": "I",
486
+ "receiver_port": "INPUT",
487
+ "sender": "proj1_rsDL",
488
+ "receiver": "C"
489
+ },
490
+ "B_TO_proj2_rsDL": {
491
+ "name": "B_TO_proj2_rsDL",
492
+ "sender_port": "OUTPUT",
493
+ "receiver_port": "peer_OUTPUT",
494
+ "sender": "B",
495
+ "receiver": "proj2_rsDL"
496
+ },
497
+ "proj2_rsDL_TO_D": {
498
+ "name": "proj2_rsDL_TO_D",
499
+ "sender_port": "I",
500
+ "receiver_port": "INPUT",
501
+ "sender": "proj2_rsDL",
502
+ "receiver": "D"
503
+ },
504
+ "C_TO_proj3_rsDL": {
505
+ "name": "C_TO_proj3_rsDL",
506
+ "sender_port": "OUTPUT",
507
+ "receiver_port": "peer_OUTPUT",
508
+ "sender": "C",
509
+ "receiver": "proj3_rsDL"
510
+ },
511
+ "proj3_rsDL_TO_D": {
512
+ "name": "proj3_rsDL_TO_D",
513
+ "sender_port": "I",
514
+ "receiver_port": "INPUT",
515
+ "sender": "proj3_rsDL",
516
+ "receiver": "D"
517
+ }
518
+ }
519
+ }
520
+ }
521
+ }
522
+ }
examples/IzhikevichTest.mdf.json ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "IzhikevichTest": {
3
+ "format": "ModECI MDF v0.4",
4
+ "metadata": {
5
+ "preferred_duration": 0.7,
6
+ "preferred_dt": 0.0005
7
+ },
8
+ "graphs": {
9
+ "IzhikevichTest": {
10
+ "notes": "Example Izhikevich",
11
+ "nodes": {
12
+ "izhPop": {
13
+ "parameters": {
14
+ "v0": {
15
+ "value": [
16
+ -0.08
17
+ ]
18
+ },
19
+ "C": {
20
+ "value": [
21
+ 1e-10
22
+ ]
23
+ },
24
+ "k": {
25
+ "value": [
26
+ 7e-07
27
+ ]
28
+ },
29
+ "vr": {
30
+ "value": [
31
+ -0.06
32
+ ]
33
+ },
34
+ "vt": {
35
+ "value": [
36
+ -0.04
37
+ ]
38
+ },
39
+ "vpeak": {
40
+ "value": [
41
+ 0.035
42
+ ]
43
+ },
44
+ "a": {
45
+ "value": [
46
+ 30.0
47
+ ]
48
+ },
49
+ "b": {
50
+ "value": [
51
+ -2e-09
52
+ ]
53
+ },
54
+ "c": {
55
+ "value": [
56
+ -0.05
57
+ ]
58
+ },
59
+ "d": {
60
+ "value": [
61
+ 1e-10
62
+ ]
63
+ },
64
+ "spike": {
65
+ "default_initial_value": [
66
+ 0
67
+ ],
68
+ "conditions": {
69
+ "condition_0_on": {
70
+ "test": "v > vpeak",
71
+ "value": 1
72
+ },
73
+ "condition_0_off": {
74
+ "test": "spike > 0",
75
+ "value": 0
76
+ }
77
+ }
78
+ },
79
+ "v": {
80
+ "default_initial_value": "v0",
81
+ "conditions": {
82
+ "condition_0": {
83
+ "test": "v > vpeak",
84
+ "value": "c"
85
+ }
86
+ },
87
+ "time_derivative": "iMemb / C"
88
+ },
89
+ "u": {
90
+ "default_initial_value": "0",
91
+ "conditions": {
92
+ "condition_0": {
93
+ "test": "v > vpeak",
94
+ "value": "u + d"
95
+ }
96
+ },
97
+ "time_derivative": "a * (b * (v-vr) - u)"
98
+ },
99
+ "iSyn": {
100
+ "value": "synapses_i"
101
+ },
102
+ "iMemb": {
103
+ "value": "k * (v-vr) * (v-vt) + iSyn - u"
104
+ }
105
+ },
106
+ "input_ports": {
107
+ "synapses_i": {}
108
+ },
109
+ "output_ports": {
110
+ "spike": {
111
+ "value": "spike"
112
+ },
113
+ "v": {
114
+ "value": "v"
115
+ },
116
+ "u": {
117
+ "value": "u"
118
+ },
119
+ "iMemb": {
120
+ "value": "iMemb"
121
+ }
122
+ },
123
+ "notes": "Cell: [Cell(notes=None, id='izhCell', parameters={'v0': 'v0', 'C': 'C', 'k': 'k', 'vr': 'vr', 'vt': 'vt', 'vpeak': 'vpeak', 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd'}, neuroml2_source_file=None, lems_source_file=None, neuroml2_cell='izhikevich2007Cell', pynn_cell=None, arbor_cell=None, bindsnet_node=None)] is defined in None and in Lems is: Component, id: izhCell, type: izhikevich2007Cell,\n parameters: {'v0': '-80mV', 'C': '100 pF', 'k': '0.7 nS_per_mV', 'vr': '-60 mV', 'vt': '-40 mV', 'vpeak': '35 mV', 'a': '0.03 per_ms', 'b': '-2 nS', 'c': '-50 mV', 'd': '100 pA'}\n parent: None\n"
124
+ },
125
+ "InputList_stim": {
126
+ "parameters": {
127
+ "amplitude": {
128
+ "value": [
129
+ 1e-10
130
+ ]
131
+ },
132
+ "delay": {
133
+ "value": [
134
+ 0.1
135
+ ]
136
+ },
137
+ "duration": {
138
+ "value": [
139
+ 0.5
140
+ ]
141
+ },
142
+ "weight": {
143
+ "value": [
144
+ 1
145
+ ]
146
+ },
147
+ "i": {
148
+ "conditions": {
149
+ "condition_0": {
150
+ "test": "t < delay",
151
+ "value": "0"
152
+ },
153
+ "condition_1": {
154
+ "test": "t >= delay and t < duration + delay",
155
+ "value": "weight * amplitude"
156
+ },
157
+ "condition_2": {
158
+ "test": "t >= duration + delay",
159
+ "value": "0"
160
+ }
161
+ }
162
+ },
163
+ "t": {
164
+ "default_initial_value": 0,
165
+ "time_derivative": "1"
166
+ }
167
+ },
168
+ "input_ports": {
169
+ "spike_input": {
170
+ "shape": [
171
+ 1
172
+ ],
173
+ "reduce": "add"
174
+ }
175
+ },
176
+ "output_ports": {
177
+ "i": {
178
+ "value": "i"
179
+ }
180
+ },
181
+ "notes": "Cell: [InputSource(notes=None, id='iclamp_0', parameters={'amplitude': 'stim_amp', 'delay': 'delay', 'duration': 'duration'}, neuroml2_source_file=None, neuroml2_input='pulseGenerator', lems_source_file=None, pynn_input=None)] is defined in None and in Lems is: Component, id: iclamp_0, type: pulseGenerator,\n parameters: {'amplitude': '100pA', 'delay': '100ms', 'duration': '500ms'}\n parent: None\n"
182
+ }
183
+ },
184
+ "edges": {
185
+ "Edge InputList_stim to izhPop": {
186
+ "name": "Edge InputList_stim to izhPop",
187
+ "sender_port": "i",
188
+ "receiver_port": "synapses_i",
189
+ "sender": "InputList_stim",
190
+ "receiver": "izhPop"
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
examples/inception.json ADDED
The diff for this file is too large to render. See raw diff