Example #1
0
def ivwrap (func, label=''):
  wrapper = h.VBox()
  wrapper.intercept(1)
  func()
  wrapper.intercept(0)
  wrapper.map(label)
  return wrapper
Example #2
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]=""
Example #3
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')
Example #4
0
    def show_synapses_PP_LTP(self):
        """Shows a box containing the model shape plot with marked recording sites and synapses."""
        # build dummy current clamps and demarcate locations
        dum_CC = [
            h.IClamp(self.CA1.lm_medium1(0.1)),
            h.IClamp(self.CA1.radTdist2(0.1))
        ]
        for cc in dum_CC:
            cc.dur = 0
            cc.amp = 0

        self.vBoxShape = h.VBox()
        self.vBoxShape.intercept(True)
        self.shplot = h.Shape()

        for sec in self.synapses:
            for syn in self.synapses[sec]:
                if syn.type == 'AMPA':
                    self.shplot.point_mark(syn.synapse, 1, 'O', 6)

        self.shplot.point_mark(dum_CC[0], 2, 'O', 12)
        self.shplot.point_mark(dum_CC[1], 3, 'O', 12)

        self.shplot.label("Large circles: recording sites")
        self.shplot.label("Black: Synapses")
        self.shplot.exec_menu("Whole Scene")
        self.shplot.flush()
        self.vBoxShape.intercept(0)
        self.vBoxShape.map("Spatial distribution of point processes", 1200, 0,
                           500, 900)
        self.shplot.exec_menu("View = plot")
        self.shplot.exec_menu("Show Diam")
Example #5
0
def show_nrnshape():
  global shapebox
  h.load_file("shapebox.hoc")
  if shapebox:
    shapebox.unmap()
    shapebox = None
  shapebox = h.VBox()
  shapebox.intercept(True)
  h.makeMenuExplore()
  shapebox.intercept(False)
  shapebox.map("NEURON ShapeName", 100, 500, -1, -1)
Example #6
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
Example #7
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)
Example #8
0
    # 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)