当前位置: 首页>>代码示例>>Python>>正文


Python h.pop_section函数代码示例

本文整理汇总了Python中neuron.h.pop_section函数的典型用法代码示例。如果您正苦于以下问题:Python pop_section函数的具体用法?Python pop_section怎么用?Python pop_section使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pop_section函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_mayavi

    def draw_mayavi(self, x, y, z, d, edges):
        "Draw the surface the first time"

        # rendering disabled
        self.mayavi.visualization.scene.disable_render = True

        points = mlab.pipeline.scalar_scatter(x, y, z, d / 2.0)
        dataset = points.mlab_source.dataset
        dataset.point_data.get_array(0).name = "diameter"
        dataset.lines = np.vstack(edges)
        dataset.point_data.update()
        self.dataset = dataset

        # The tube
        src = mlab.pipeline.set_active_attribute(points, point_scalars="diameter")
        stripper = mlab.pipeline.stripper(src)
        tube = mlab.pipeline.tube(stripper, tube_sides=6, tube_radius=1)
        tube.filter.capping = True
        #        tube.filter.use_default_normal = False
        tube.filter.vary_radius = "vary_radius_by_absolute_scalar"
        self.tube = tube

        # Setting the voltage
        # Making room for the voltage
        v = []
        for sec in h.allsec():
            sec.push()
            v.extend(np.repeat(0.0, h.n3d()))
            h.pop_section()

        v = np.array(v)
        self.draw_surface(v, "v")

        # ReEnable the rendering
        self.mayavi.visualization.scene.disable_render = False
开发者ID:pgleeson,项目名称:neuronvisio,代码行数:35,代码来源:visio.py

示例2: mkmitral

def mkmitral(gid):
  nrn = getmitral(gid)
  
  m = h.Mitral()
  m.createsec(len(nrn.dend), len(nrn.tuft))
  m.subsets()
  m.topol(0) # need to connect secondary dendrites explicitly

  for i, d in enumerate(nrn.dend):
    
    # <<< check my changed if
    if(d.parent == nrn.soma): # <<< changed name
      m.secden[i].connect(m.soma(.5))
    else:
      m.secden[i].connect(m.secden[d.parent.index](1)) # <<< changed name
  
  m.geometry()
  m.segments() # depends on geometry
  m.geometry() # again to get the hillock stylized shape

  fillall(nrn, m)
  
  m.segments() # again to get the proper number of segments for tuft and secden
  m.soma.push()
  m.x = h.x3d(0)
  m.y = h.y3d(0)
  m.z = h.z3d(0)
  h.pop_section()
  m.memb()
  return m
开发者ID:JustasB,项目名称:Mig3DTest,代码行数:30,代码来源:mkmitral.py

示例3: retrieve_coordinate

    def retrieve_coordinate(self, sec):
        """Retrieve the coordinates of the section avoiding duplicates"""
        
        sec.push()
        x, y, z, d = [],[],[],[]

        tot_points = 0
        connect_next = False
        for i in range(int(h.n3d())):
            present = False
            x_i = h.x3d(i)
            y_i = h.y3d(i)
            z_i = h.z3d(i)
            d_i = h.diam3d(i)
            # Avoiding duplicates in the sec
            if x_i in x:
                ind = len(x) - 1 - x[::-1].index(x_i) # Getting the index of last value
                if y_i == y[ind]:
                    if z_i == z[ind]:
                        present = True
                    
            if not present:
                k =(x_i, y_i, z_i)
                x.append(x_i)
                y.append(y_i)
                z.append(z_i)
                d.append(d_i)                
        h.pop_section()
        #adding num 3d points per section
        self.n3dpoints_per_sec[sec.name()] = len(d)
        return (np.array(x),np.array(y),np.array(z),np.array(d))
开发者ID:torbjone,项目名称:ProjectBedlewo,代码行数:31,代码来源:visio.py

示例4: build_sec_scalar

 def build_sec_scalar(self, sec, var_value):
     
     sec.push()
     npoints = self.n3dpoints_per_sec[sec.name()]
     sec_scalar = np.repeat(var_value, npoints)
     h.pop_section()
     return sec_scalar
开发者ID:torbjone,项目名称:ProjectBedlewo,代码行数:7,代码来源:visio.py

示例5: _addSynapses

 def _addSynapses(self):
     """
     Adds all synapses to the neuron. Being this model composed by just a single
     compartment, all synapses are added to the soma.
     """
     if self.verbose:
         print('>>> Adding synapses to the model.')
     # TODO: take synapse parameters from:
     # Jaeger, D., De Schutter, E., & Bower, J. M. (1997).
     # The role of synaptic and voltage-gated currents in the control of Purkinje cell
     # spiking: a modeling study.
     # The Journal of Neuroscience, 17(1), 91-106.
     self.soma.push()
     for i in range(self.nSynapses):
         if self.synapseProperties['name'].lower() == 'ampa':
             syn = h.AMPA_S(self.soma(0.5))
             h.Erev_AMPA_S = self.synapseProperties['Erev']
         elif self.synapseProperties['name'].lower() == 'biexp':
             syn = h.Exp2Syn(self.soma(0.5))
             syn.tau1 = self.synapseProperties['tauRise']
             syn.tau2 = self.synapseProperties['tauDecay']
             syn.e = self.synapseProperties['Erev']
         else:
             raise Exception('Unknown synaptic model [%s]' % synapseProps['name'])
             return
         self.synapses.append(syn)
     h.pop_section()
开发者ID:jcouto,项目名称:neuron,代码行数:27,代码来源:CommonInput.py

示例6: retrieve_coordinate

def retrieve_coordinate(sec):
    sec.push()
    x, y, z, d = [],[],[],[]
    area = 0
    tot_points = 0
    connect_next = False
    for i in range(int(h.n3d())):
        present = False
	x_i = h.x3d(i)
	y_i = h.y3d(i)
	z_i = h.z3d(i)
	d_i = h.diam3d(i)
	a_i = h.area(0.5)
	if x_i in x:
            ind = len(x) - 1 - x[::-1].index(x_i) # Getting the index of last value
	    if y_i == y[ind]:
                if z_i == z[ind]:
                    present = True
                    
	if not present:
            k =(x_i, y_i, z_i)
	    x.append(x_i)
	    y.append(y_i)
	    z.append(z_i)
	    d.append(d_i)                
	    area += np.sum(a_i)
    h.pop_section()
        #adding num 3d points per section
    n3dpoints[sec.name()] = [np.array(x),np.array(y),np.array(z),np.array(d)]
    return (np.array(x),np.array(y),np.array(z),np.array(d),area)
开发者ID:ccluri,项目名称:L5Pyr,代码行数:30,代码来源:morph_compare.py

示例7: append_v

        def append_v(sec, v):
            """ Append data to v """
            sec.push()
            for ii in xrange(1, int(nrn.n3d())):
                v.append(sec.v)
            nrn.pop_section()

            return v
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:8,代码来源:neuron3d.py

示例8: accumulate_density

def accumulate_density(sec, density, domain):
  sec.push()
  for i in range(int(h.n3d())):
    x,y = (h.x3d(i), h.y3d(i))
    r = (round(x, domain[0]),round(y, domain[1]))
    if not False in r:
      density[r] += 1
  h.pop_section()
开发者ID:JustasB,项目名称:Mig3DTest,代码行数:8,代码来源:mitral_dend_density.py

示例9: pr

def pr(sec):
  sec.push()
  for seg in sec:
    print '%s   x=%g   r=%g   t2.p=%g   p_t2=%g' % (sec.name(), seg.x, seg.t2.r, seg.t2.p, seg.p_t2),
    h.setdata_t2(seg.x)
    print '   f()=%g\n' % (h.f_t2()),
  print('\n')
  h.pop_section()
开发者ID:hugh-osborne,项目名称:org.geppetto.testbackend,代码行数:8,代码来源:tstpnt2.py

示例10: recurse_compartments

 def recurse_compartments(index, branches):
     for ii in xrange(int(h.s[index].nchild())):
         h.s[index].child[ii].push()
         child_index = cas_index()
         #print index,',',child_index
         branches.append([index,child_index])
         h.pop_section()
         branches = recurse_compartments(child_index, branches)
     return branches
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:9,代码来源:functions.py

示例11: append_children_voltage

 def append_children_voltage(parent, v):
     parent.push()
     sref = nrn.SectionRef()
     nrn.pop_section()
     if sref.child:
         for child in sref.child:
             v = append_v(child, v)
             v = append_children_voltage(parent = child,
                                         v = v)
     return v
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:10,代码来源:neuron3d.py

示例12: retrieve_coordinates

 def retrieve_coordinates(self, sec):
     xyzds = []
     sec.push()
     for ii in xrange(int(nrn.n3d())):
         xyzds.append([nrn.x3d(ii),
                      nrn.y3d(ii),
                      nrn.z3d(ii),
                      nrn.diam3d(ii)])
     nrn.pop_section()
     return xyzds
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:10,代码来源:neuron3d.py

示例13: connect

def connect(v1, syn2, v3, syn4):
    l = list()
    print h.cas().name()
    l.append(h.NetCon(v1, syn2, 0, 0, 0.5))
    soma3.push()
    print h.cas().name()
    l.append(h.NetCon(v3, syn4, 0, 0, 1))
    h.pop_section()
    print h.cas().name()
    return l
开发者ID:homerobse,项目名称:sfn,代码行数:10,代码来源:hh_net_connected.py

示例14: build_tree

    def build_tree(self):
        print "-"*100
        def append_data(sec, xyzdv, parent_id, connections):
            """ Append data to xyzdv """

            if self.var is 'v':
                v = sec.v
            else:
                raise AttributeError('Variable %s not implemented' % self.var)


            sec.push()
            for ii in xrange(1, int(nrn.n3d())):
                x = nrn.x3d(ii)
                y = nrn.y3d(ii)
                z = nrn.z3d(ii)
                d = nrn.diam3d(ii)
                xyzdv.append([x,y,z,d,v])
                child_id = len(xyzdv)-1
                if len(xyzdv)>1:
                    connections.append([child_id, parent_id])
                parent_id = child_id
            nrn.pop_section()

            return xyzdv, connections

        def append_children_data(parent, parent_id, xyzdv, connections):
            parent.push()
            sref = nrn.SectionRef()
            nrn.pop_section()
            if sref.child:
                for child in sref.child:
                    xyzdv, connections = append_data(child, xyzdv, parent_id, connections)
                    xyzdv, connections = append_children_data(parent = child,
                                                              parent_id = len(xyzdv)-1,
                                                              xyzdv = xyzdv,
                                                              connections = connections)
            return xyzdv, connections

        # Find data and connections
        root_section = self.root_section()
        root_section.push()
        xyzdv = [[nrn.x3d(0),
                 nrn.y3d(0),
                 nrn.z3d(0),
                 nrn.diam3d(0),
                 root_section.v]]
        nrn.pop_section()
        xyzdv, connections = append_data(root_section, xyzdv, 0, [])
        xyzdv, connections = append_children_data(root_section,
                                                  len(xyzdv)-1,
                                                  xyzdv,
                                                  connections)
        self.xyzdv = array(xyzdv)
        self.connections = array(connections)
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:55,代码来源:neuron3d.py

示例15: basic_shape

 def basic_shape(self):
     self.soma.push()
     h.pt3dclear()
     h.pt3dadd(0, 0, 0, 1)
     h.pt3dadd(20, 0, 0, 1)
     h.pop_section()
     self.dend.push()
     h.pt3dclear()
     h.pt3dadd(15, 0, 0, 1)
     h.pt3dadd(215, 0, 0, 1)
     h.pop_section()
开发者ID:a1eko,项目名称:lampy,代码行数:11,代码来源:cell2.py


注:本文中的neuron.h.pop_section函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。