コード例 #1
0
def chwin ():
  "Launch windows from model list"
  h.xpanel("Izhikevich models")
  # outer lambda returns inner lambda so as to pass arg to winup() -- the innermost routine
  for c in ch:
    h.xbutton(c, (lambda f, arg1: lambda: f(arg1))(winup,c)) 
  h.xpanel()
コード例 #2
0
 def paramPanel(self):
     self.box = h.VBox()
     self.box.intercept(1)
     h.xpanel('')
     h.xlabel('Likelihood numerical parameters')
     h.xlabel('    Measurement noise')
     c = self.Eve.Obs.C
     for o in c:
         h.xvalue('sigma: ' + o.hpt.s(), (o, 'sigma'), 1)
     h.xlabel('    Process noise')
     h.xvalue('Injection interval', (self, 'inj_invl'), 1,
              self.inj_invl_changed)
     s = h.Vector()
     cvodewrap.states(s)
     sref = h.ref('')
     for i in range(len(s)):
         cvodewrap.statename(i, sref, 1)
         h.xvalue('Diffusion Coeff[%d,%d]: ' % (i, i) + sref[0],
                  (self.processNoise[i], 'x'), 1, (self.fillPB, i))
     h.xcheckbox('Fox & Lu Diffusion (for Hodgkin-Huxley)?', (self, 'hhB'),
                 self.hhBButton)
     h.xvalue('  Fox & Lu: Number Na Channels', (self, 'nNa'), 1,
              self.hhBButton)
     h.xvalue('  Fox & Lu: Number K Channels', (self, 'nK'), 1,
              self.hhBButton)
     h.xlabel('    Initial Uncertainty')
     for i in range(len(s)):
         print i
         cvodewrap.statename(i, sref, 1)
         h.xvalue('Initial Stand Dev[%d]: ' % i + sref[0],
                  (self.Sdiag[i], 'x'), 1, (self.fillS, i))
     h.xbutton('Show state funnels', self.show_state_funnels)
     h.xpanel()
     self.box.intercept(0)
     self.box.map('Likelihood parameters')
コード例 #3
0
 def build(self):
     self.box = h.HBox()
     self.box.intercept(1)
     self.box.ref(self)
     h.xpanel("")
     h.xbutton("Button 1", (self.bact, 1))
     h.xbutton("Button 2", (self.bact, (2, )))
     h.xbutton("Button 3", self.bact_noarg)
     h.xbutton("Button 4", (self.bact_2arg, ("hello", 4)))
     for i in range(3):
         h.xradiobutton("Radio " + str(i), (self.bact, i))
     h.xmenu("Menu")
     for i in range(3):
         h.xbutton("Item " + str(i), (self.bact, i))
     for i in range(3):
         h.xradiobutton("Radio " + str(i), (self.bact, i))
     h.xcheckbox('checkbox', (self, 'cbstate'), self.cb)
     h.xstatebutton('state', (self, 'sbut'), self.st)
     h.xmenu()
     h.xpanel()
     self.g = h.Graph()
     self.g.menu_tool('graph menu tool 1', self.gcb, (self.gsel, 1))
     h.xpanel("")
     h.xvalue("x", (self, "x"), 1, self.chgx)
     h.xcheckbox('checkbox', (self, 'cbstate'), self.cb)
     h.xstatebutton('state', (self, 'sbut'), self.st)
     h.xlabel('fixed label')
     h.xvarlabel((self, 'ss'))
     h.xslider((self, 'x'), 0, 20, self.slide)
     self.g.menu_tool('graph menu tool 2', self.gcb, (self.gsel, 2))
     h.xpanel()
     self.box.intercept(0)
コード例 #4
0
def bld(x, y):
    global g, tt, ttstr, grp, sgrp, pras
    tt = 0.0
    ttstr = h.ref('tt=0.000000000')
    v = h.VBox()
    v.intercept(1)
    g = h.Graph()
    g.size(0, x, 0, y)
    h.xpanel("", 1)
    h.xvarlabel(ttstr)
    h.xvalue("group", (this_module, "grp"), 1, ttcallback)
    h.xslider((this_module, "sgrp"), 0, 100, ttscallback)
    h.xpanel()
    v.intercept(0)
    v.map("wave front", 100, 100, 700, 500)
    return v
コード例 #5
0
    def __init__(self, cell):
        def show_val():
            print("Spacer Ra of the model: {}".format(cell.spacer.Ra))
            print(
                'The starting point is {}, end point is {} with increasing steps of {}'
                .format(min_current_var[0], max_current_var[0],
                        step_current_var[0]))

        #Contorl Panel
        sim_control = h.HBox()
        sim_control.intercept(1)
        h.nrncontrolmenu()
        attach_current_clamp(cell)
        h.xpanel('TEST')
        h.xlabel('Choose a  simulation to run')
        h.xbutton('Spike Protocol', (spike_fig, cell))
        h.xbutton('Rheobase Protocol', (fig_rheobase_check, cell))
        h.xbutton('Multiple Rheobase Protocol',
                  (multiple_rheobase_plots_new, cell))
        h.xbutton('Increasing Ra Protocol', (fig_ra_rheobase_spacerL, cell))
        h.xbutton('Increasing spacer_gpas Protocol',
                  (fig_g_rheobase_spacerL, cell))
        h.xbutton('Increasing cell c_m Protcol',
                  (fig_cm_rheobase_spacerL, cell))
        h.xbutton('Combined Protocol Run', (Combined_Protocol, cell))
        h.xpvalue('Rheobase protocol start', min_current_var, 1)
        h.xpvalue('Rheobase protocol end', max_current_var, 1)
        h.xpvalue('Rheobase step size', step_current_var, 1)
        h.xbutton('show value', show_val)
        # h.xvalue('enter value', (this_module, 'val'))
        h.xpanel()
        #Output panel
        g = h.Graph()
        g.addvar('soma(0.5).v', cell.soma(0.5)._ref_v)
        g.addvar('AIS(0.5).v', cell.AIS(0.5)._ref_v)
        g.size(0, 1000, -90, 90)
        h.graphList[0].append(g)
        h.MenuExplore()
        sim_control.intercept(0)
        sim_control.map()
        input()
コード例 #6
0
ファイル: testgui.py プロジェクト: nrnhines/bfilt
 def build(self):
     self.box = h.HBox()
     self.box.intercept(1)
     self.box.ref(self)
     h.xpanel("")
     h.xlabel('0<=')
     h.xcheckbox('', (self, 'Vg'), self.button)
     h.xcheckbox('', (self, 'mg'), self.button)
     h.xcheckbox('', (self, 'ng'), self.button)
     h.xcheckbox('', (self, 'hg'), self.button)
     h.xcheckbox('', (self, 'Cag'), self.button)
     h.xcheckbox('', (self, 'Og'), self.button)
     h.xcheckbox('', (self, 'C1g'), self.button)
     h.xcheckbox('', (self, 'C2g'), self.button)
     h.xpanel()
     h.xpanel("")
     h.xlabel('<=1')
     h.xcheckbox('V', (self, 'Vl'), self.button)
     h.xcheckbox('m', (self, 'ml'), self.button)
     h.xcheckbox('n', (self, 'nl'), self.button)
     h.xcheckbox('h', (self, 'hl'), self.button)
     h.xcheckbox('[Ca2+]', (self, 'Cal'), self.button)
     h.xcheckbox('O', (self, 'Ol'), self.button)
     h.xcheckbox('C1', (self, 'C1l'), self.button)
     h.xcheckbox('C2', (self, 'C2l'), self.button)
     h.xpanel()
     h.xpanel("")
     h.xlabel('S0')
     h.xcheckbox('', (self, 'Vs0'), self.button)
     h.xcheckbox('', (self, 'ms0'), self.button)
     h.xcheckbox('', (self, 'ns0'), self.button)
     h.xcheckbox('', (self, 'hs0'), self.button)
     h.xcheckbox('', (self, 'Cas0'), self.button)
     h.xcheckbox('', (self, 'Os0'), self.button)
     h.xcheckbox('', (self, 'C1s0'), self.button)
     h.xcheckbox('', (self, 'C2s0'), self.button)
     h.xpanel()
     h.xpanel("")
     h.xlabel('S1')
     h.xcheckbox('V', (self, 'Vs1'), self.button)
     h.xcheckbox('m', (self, 'ms1'), self.button)
     h.xcheckbox('n', (self, 'ns1'), self.button)
     h.xcheckbox('h', (self, 'hs1'), self.button)
     h.xcheckbox('[Ca2+]', (self, 'Cas1'), self.button)
     h.xcheckbox('O', (self, 'Os1'), self.button)
     h.xcheckbox('C1', (self, 'C1s1'), self.button)
     h.xcheckbox('C2', (self, 'C2s1'), self.button)
     h.xpanel()
     h.xpanel("")
     h.xbutton("Add S2", self.button)
     h.xbutton("Remove Empty", self.button)
     h.xbutton("Close", self.button)
     h.xlabel('QP Solver:')
     h.xstatebutton('cvxopt', (self, 'cvxopt_sel'), self.button)
     h.xstatebutton('custom', (self, 'custom_sel'), self.button)
     h.xpanel()
     self.box.intercept(0)
コード例 #7
0
 def xpvalue (self,name,ptr,runner=pr):
   "Doesn't work currently"
   h.xpanel("")
   h.xpvalue(name,ptr,1,runner)
   h.xpanel()
コード例 #8
0
 def xvalue (self,name,var,obj=py,runner=pr):
   h.xpanel("")
   h.xvalue(name,(obj, var),0,runner)
   h.xpanel()
コード例 #9
0
ファイル: vardomain.py プロジェクト: neuronsimulator/nrntest
from neuron import h

h('foo = 2')
h.variable_domain('foo', 1, 5)
h.units('foo', 'cm')

h.xpanel("test")
h.xvalue("foo", "foo", 1)
h.xpvalue("foo", h._ref_foo, 1)
h.xpanel()
コード例 #10
0
ファイル: cvodewrap.py プロジェクト: nrnhines/bfilt
 def panel(self):
     h.xpanel("Variable or Fixed step")
     h.xcheckbox('use_fixed_step', (self, 'use_fixed_step'))
     h.xpanel()
コード例 #11
0
def make_Vpanel():                    # make panel
    h.xpanel("Brette-Gerstner network")
    h.xbutton("Run simulation", "py.run_sim(1)")
    h.xpanel()
コード例 #12
0
        # def on_button_press():
        #     print('you pressed the button')
<<<<<<< HEAD
        def show_val():
            print('The starting point is {}, end point is {} with increasing steps of {}'.format(min_current_var[0],max_current_var[0],step_current_var[0]))
=======
        val = h.ref(42)
        def show_val():
            print('value is: %g' % val[0])
>>>>>>> faea529 (TEST)
        #Contorl Panel
        sim_control = h.HBox()
        sim_control.intercept(1)
        h.nrncontrolmenu()
        attach_current_clamp(cell)
        h.xpanel('TEST')
        h.xlabel('Choose a  simulation to run')
        h.xbutton('Spike Protocol',(spike_fig, cell))
        h.xbutton('Rheobase Protocol',(fig_rheobase_check, cell))
        h.xbutton('Multiple Rheobase Protocol', (multiple_rheobase_plots_new, cell))
<<<<<<< HEAD
        h.xbutton('Increasing Ra Protocol', (fig_ra_rheobase_spacerL, cell))
        h.xbutton('Increasing spacer_gpas Protocol', (fig_g_rheobase_spacerL, cell))
        h.xbutton('Increasing cell c_m Protcol', (fig_cm_rheobase_spacerL, cell))
        h.xbutton('Combined Protocol Run', (temp_stack_ra_scatter, cell))
        h.xpvalue('Rheobase protocol start', min_current_var, 1)
        h.xpvalue('Rheobase protocol end', max_current_var, 1)
        h.xpvalue('Rheobase step size', step_current_var, 1)
=======
        h.xbutton('Fig 1', (fig1_rheobase_spacer_dend, cell))
        h.xbutton('Fig 2', (fig2_rheobase_spacer_cm, cell))
コード例 #13
0
 def constraintsPanel(self):
     self.box = h.HBox()
     self.box.intercept(1)
     self.box.ref(self)
     s = h.Vector()
     cvodewrap.states(s)
     nstates = len(s)
     sref = h.ref('')
     h.xpanel("")
     h.xlabel('0<=')
     for i in range(nstates):
         h.xcheckbox('', (self.geq0[i], 'x'), self.constraintsButton)
     h.xpanel()
     h.xpanel("")
     h.xlabel('>=1')
     for i in range(nstates):
         cvodewrap.statename(i, sref, 1)
         h.xcheckbox(sref[0], (self.leq1[i], 'x'), self.constraintsButton)
     h.xpanel()
     for j in range(self.nsums):
         h.xpanel("")
         h.xlabel("S%d" % j)
         for i in range(nstates):
             h.xcheckbox('', (self.sumto1[j][i], 'x'),
                         self.constraintsButton)
         h.xpanel()
     h.xpanel("")
     h.xbutton("Add Sum-to-1", self.constraintsButton)
     h.xbutton("Remove Empty", self.constraintsButton)
     h.xbutton("Close", self.constraintsButton)
     h.xlabel('QP Solver:')
     h.xstatebutton('cvxopt', (self, 'cvxopt_sel'), self.constraintsButton)
     h.xstatebutton('custom', (self, 'custom_sel'), self.constraintsButton)
     h.xpanel()
     self.box.intercept(0)
     self.box.map("Constraints")
コード例 #14
0
  printf("enter %g %s %s\\n", $&1, $o2, $s3) \
  $&1 = 2 \
  $o2 = new List() \
  $s3 = "goodbye" \
}''')
h('strdef hs')
h('objref ho')
h('hx = 0')

h.hs = 'hello'
h.hx = 1

h('change(&hx, ho, hs)')
print(h.hx, h.ho, h.hs)




h('load_file("nrngui.hoc")')
h('obfunc hocstring() { return new String($s1) }')
s = h.hocstring('hello world')
h.xpanel("test1")
h.xvarlabel(s.s)
h.xpanel()

h('strdef ss')
h('ss = "hello world"')
h.xpanel("test2")
h.xvarlabel(h.ss)
h.xpanel()
コード例 #15
0
    shapebox = None
  shapebox = h.VBox()
  shapebox.intercept(True)
  h.makeMenuExplore()
  shapebox.intercept(False)
  shapebox.map("NEURON ShapeName", 100, 500, -1, -1)

def show(tdat):
  global ig
  cleanup()
  ig = mkswc(tdat)
  show_nrnshape()
  
if __name__ == "__main__":
  ig = None
  h.xpanel("Choose an swc example")
  for i, dat in enumerate(tst_data):
    s = str(i) + dat.split('\n')[1]
    h.xradiobutton(s, (show, dat))
  h.xpanel(80, 200)
    
tst_result=['''
soma[0] L=20  
 0   -10 0 0 20
 1   0 0 0 20
 2   10 0 0 20
dend[0] L=10 [0.0, 0.0, 0.0] parent soma[0](0.5)
 0   0 10 0 2
 1   0 20 0 2
dend[1] L=10 [0.0, 0.0, 0.0] parent soma[0](0.5)
 0   0 -10 0 4
コード例 #16
0
from neuron import h

h.load_file('stdrun.hoc')

soma = h.Section(name='soma')
seg = soma(0.5)
soma.insert('hh')

ic = h.IClamp(seg)
ic.amp = 40  # since by default a very large section
ic.delay = 1
ic.dur = 1


h.xpanel("neuron")
h.xlabel("voltage graph")
g = h.Graph()
g.addvar("v", "v(0.5)")   #hoc string example
g.addvar("m", seg.hh._ref_m)   #pointer example
#g.addvar("v", soma(0.5)._ref_v) #pointer
#g.addvar("v(0.5)")   #no label (not yet)

h.xpanel()

h.finitialize(-65)

コード例 #17
0
from neuron import h

a = h.Vector([1])
b = h.Vector([2])
s = h.Section(name='section1')
ell = h.List('Vector')

ell.browser()

h.xpanel('mywindow', 4, h.ref(5))

myvbox = h.VBox('Neuron')
print('myvbox.ismapped() =', myvbox.ismapped())
print('mapping...')
myvbox.map()
print('myvbox.ismapped() =', myvbox.ismapped())

h('preference = boolean_dialog("Do you prefer HOC or Python", "Python", "HOC")'
  )
print('h.preference =', h.preference)
コード例 #18
0
def xspikeres():
    h.xpanel("Spike results")
    h.xbutton("Write out", "spikeout()")
    h.xbutton("Plot", "spikeplot()")
    h.xpanel()
コード例 #19
0
 def __init__ (self, type, li) :
   self.izhtype = type
   vbox, hbox, hbox1 = h.VBox(), h.HBox(), h.HBox()
   self.vbox = vbox
   lil = len(li)
   self.cols, self.rows = {20:(4,5), 8:(4,2), 9:(3,3)}[lil]
   self.label=h.ref('================================================================================')
   vbox.intercept(1)
   h.xpanel("")
   h.xvarlabel(self.label)
   if newmodel(self.izhtype):
     h.xlabel("V' = (k*(V-vr)*(V-vt) - u + Iin)/C     if (V>vpeak) V=c  [reset]")
     h.xlabel("u' = a*(b*(V-vr) - u)                  if (V>vpeak) u=u+d")
   else: 
     h.xlabel("v' = 0.04*v*v + f*v + g - u + Iin;     if (v>thresh) v=c [reset]")
     h.xlabel("u' = a*(b*v - u);                    if (v>thresh) u=u+d")
   h.xpanel()
   hbox1.intercept(1)
   h.xpanel(""); h.xbutton("RUN",h.run); h.xpanel()
   self.xvalue('I0','I0')
   self.xvalue('I1','I1')
   self.xvalue('T1','T1')
   hbox1.intercept(0); hbox1.map("")
   hbox.intercept(1)
   for ii,(k,v) in enumerate(li.iteritems()):
     if ii%self.rows==0: h.xpanel("")
     h.xbutton(k, (lambda f, arg1, arg2: lambda: f(arg1,arg2))(p, k, v)) # alternative is to use functools.partial
     if ii%self.rows==self.rows-1: h.xpanel()
   hbox.intercept(0); hbox.map("")
   vbox.intercept(0); vbox.map("Spike patterns")
   self.label[0]=""
コード例 #20
0
    print("button test worked!")
    print(thing1)
    print(thing2)
    return


is_checked2 = h.ref(0)
my_str = h.ref('yay!')

h("""
proc onpress() {
    print "The HOC onpress function was called"
}
""")

h.xpanel("Hello world")
h.xlabel("Here is some text")
h.xvalue("h.t", "t")
h.xcheckbox("a checkbox", is_checked_ref, "onpress()")
h.xcheckbox("a checkbox", (is_checked, 'checked'), onpress)
h.xstatebutton("Toggle", is_checked2, onpress2)
hb = h.HBox()
hb.intercept(True)
h.xbutton("finitialize", "finitialize(-65)")
h.xbutton("run", "run()")
h.xbutton("test", (buttontest, ("hallo", "goodbye")))
hb.intercept(False)
hb.map()
h.xvarlabel(my_str)
#g = h.Graph()
#g.addvar("v", "seg.v")
コード例 #21
0
ファイル: fliedervish.py プロジェクト: camrobjones/spyke
    # create a current clamp and add it to the cell
    cell.ic = h.IClamp(cell.soma(0.5))
    cell.ic.dur = 3       # ms
    cell.ic.amp = 1.5     # nA

    # setup graphs needed by both simulations
    concentration_graph = h.Graph(False)
    concentration_graph.size(0, 3000, 4, 4.4)
    voltage_graph = h.Graph(False)
    voltage_graph.size(0, 3000, -90, 60)
    h.graphList[0].append(voltage_graph)
    h.graphList[1].append(concentration_graph)

    # pop up the run control
    h.nrncontrolmenu()

    # call the funciton which actually sets up the specific simulation
    simulation(cell, voltage_graph, concentration_graph)

if __name__ == '__main__':
    # display a control panel to allow users to choose a simulation
    sim_control = h.VBox()
    sim_control.intercept(True)
    h.xpanel('')
    h.xlabel('Choose a simulation to run')
    h.xbutton('Fig 3A', lambda: do_sim(fig3a, sim_control))
    h.xbutton('Fig 6B', lambda: do_sim(fig6b, sim_control))
    h.xpanel()
    sim_control.intercept(False)
    sim_control.map('Choose simulation', 100, 100, 200, 100)