예제 #1
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)
예제 #2
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)
예제 #3
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]=""
예제 #4
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')
예제 #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
 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")
예제 #7
0
    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")
h.xpanel()
예제 #8
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)

예제 #9
0
        #     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))
        h.xbutton('Fig 3', (fig3_rheobase_spacer_rm, cell))