forked from jonescompneurolab/hnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hnn_nrnui.py
51 lines (39 loc) · 1.48 KB
/
hnn_nrnui.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
import logging
from neuron import h
from jupyter_geppetto.geppetto_comm import GeppettoCoreAPI as G
from neuron_ui import neuron_utils
from neuron_ui import neuron_geometries_utils
import params_default
from paramrw import quickreadprm
from conf import fcfg,dconf
from simdat import *
class HNN:
def __init__ (self):
logging.debug('Loading HNN')
neuron_utils.createProject(name='HNN')
import run
self.t_vec = h.Vector()
self.t_vec.record(h._ref_t)
neuron_utils.createStateVariable(id='time', name='time',
units='ms', python_variable={"record_variable": self.t_vec,
"segment": None})
neuron_geometries_utils.extractGeometries()
logging.debug('HNN loaded')
self.RunSimButton = neuron_utils.add_button('Run', extraData={'commands':[]})
self.StopSimButton = neuron_utils.add_button('Stop',extraData={'commands':[]})
self.SetParams = neuron_utils.add_button('Set Parameters')
self.BasePanel = neuron_utils.add_panel('HNN Control', items=[self.RunSimButton,self.StopSimButton,self.SetParams],widget_id='hnnBasePanel')
self.BasePanel.on_close(self.close)
self.BasePanel.display()
def close (self):
self.BasePanel.close()
del self.BasePanel
"""
to start (first 2 commands from console)
./NEURON-UI/NEURON-UI &
jupyter console --existing
import os
os.chdir('/u/samn/hnn/NEURON-UI/neuron_ui/models/hnn')
import hnn_nrnui
net=hnn_nrnui.HNN()
"""