Skip to content

Commit

Permalink
Add gamma tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
chenghuzi committed Jan 22, 2023
1 parent 2e53827 commit 75d3833
Show file tree
Hide file tree
Showing 2 changed files with 878 additions and 12 deletions.
857 changes: 857 additions & 0 deletions doc/gui/tutorial_gamma.ipynb

Large diffs are not rendered by default.

33 changes: 21 additions & 12 deletions hnn_core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def _init_ui_components(self):
style='background:{self.layout['theme_color']};
text-align:center;color:white;'>
HUMAN NEOCORTICAL NEUROSOLVER</div>""")

self._connectivity_tab = {}

@property
def analysis_config(self):
Expand Down Expand Up @@ -370,7 +372,8 @@ def _on_upload_connectivity(change):
return on_upload_change(change, self.params, self.widget_tstop,
self.widget_dt, self._log_out,
self.drive_boxes, self.drive_widgets,
self._drives_out, self._connectivity_out,
self._drives_out, self._connectivity_tab,
self._connectivity_out,
self.connectivity_widgets,
self.layout['drive_textbox'],
"connectivity")
Expand All @@ -379,7 +382,8 @@ def _on_upload_drives(change):
return on_upload_change(change, self.params, self.widget_tstop,
self.widget_dt, self._log_out,
self.drive_boxes, self.drive_widgets,
self._drives_out, self._connectivity_out,
self._drives_out, self._connectivity_tab,
self._connectivity_out,
self.connectivity_widgets,
self.layout['drive_textbox'],
"drives")
Expand Down Expand Up @@ -484,11 +488,10 @@ def compose(self, return_layout=True):
# self.simulation_data[self.widget_simulation_name.value]

# initialize drive and connectivity ipywidgets
load_drive_and_connectivity(self.params, self._log_out,
self._drives_out, self.drive_widgets,
self.drive_boxes, self._connectivity_out,
self.connectivity_widgets,
self.widget_tstop, self.layout)
self._connectivity_tab['content'] = load_drive_and_connectivity(
self.params, self._log_out, self._drives_out, self.drive_widgets,
self.drive_boxes, self._connectivity_out,
self.connectivity_widgets, self.widget_tstop, self.layout)

if not return_layout:
return
Expand Down Expand Up @@ -1081,7 +1084,7 @@ def add_connectivity_tab(params, connectivity_out,
with connectivity_out:
display(cell_connectivity)

return net
return net, cell_connectivity


def add_drive_tab(params, drives_out, drive_widgets, drive_boxes, tstop,
Expand Down Expand Up @@ -1128,15 +1131,19 @@ def load_drive_and_connectivity(params, log_out, drives_out,
log_out.clear_output()
with log_out:
# Add connectivity
add_connectivity_tab(params, connectivity_out, connectivity_sliders)
_, connectivity_tab = add_connectivity_tab(params, connectivity_out,
connectivity_sliders)
# Add drives
add_drive_tab(params, drives_out, drive_widgets, drive_boxes, tstop,
layout)

return connectivity_tab


def on_upload_change(change, params, tstop, dt, log_out, drive_boxes,
drive_widgets, drives_out, connectivity_out,
connectivity_sliders, layout, load_type):
drive_widgets, drives_out, connectivity_tab,
connectivity_out, connectivity_sliders, layout,
load_type):
if len(change['owner'].value) == 0:
logger.info("Empty change")
return
Expand All @@ -1163,7 +1170,9 @@ def on_upload_change(change, params, tstop, dt, log_out, drive_boxes,
params.update(params_network)
# init network, add drives & connectivity
if load_type == 'connectivity':
add_connectivity_tab(params, connectivity_out, connectivity_sliders)
_, _connectivity_tab = add_connectivity_tab(params, connectivity_out,
connectivity_sliders)
connectivity_tab['content'] = _connectivity_tab
elif load_type == 'drives':
add_drive_tab(params, drives_out, drive_widgets, drive_boxes, tstop,
layout)
Expand Down

0 comments on commit 75d3833

Please sign in to comment.