• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python h.pop_section函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: retreive_coordinates

def retreive_coordinates(sec):
    ''' Only works with cell which have an xtra mechanism '''
    # Make sure to run h.setpointers() before running
    from neuron import h
    x=sec.sec(.5).x_xtra
    y=sec.sec(.5).y_xtra
    z=sec.sec(.5).z_xtra
    sec.sec.push()
    diam = h.diam3d(0)
    h.pop_section()
    return [x, y, z, diam]
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:11,代码来源:functions.py


示例17: __get_parent

 def __get_parent(self, sec, tree):
     """Recursive function used to create the tree list of section"""
     sec.push()
     secRef = h.SectionRef()
     if secRef.has_parent():
         parentSeg = secRef.parent()
         parentSec = parentSeg.sec
         tree.append(parentSec)
         tree = self.__get_parent(parentSec, tree)
     h.pop_section()
     return tree
开发者ID:pgleeson,项目名称:neuronvisio,代码行数:11,代码来源:manager.py


示例18: append_children_data

 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
开发者ID:tfoutz99,项目名称:Neuron3D,代码行数:12,代码来源:neuron3d.py


示例19: connectWithTMGSynapse

def connectWithTMGSynapse(pre, post, E, taus, U, delay=1, weight=0.01):
    pre.sec.push()
    syn = h.tmgsyn(post)
    syn.e = E
    syn.tau_1 = taus['1']
    syn.tau_rec = taus['rec']
    syn.tau_facil = taus['facil']
    syn.U = U
    conn = h.NetCon(pre._ref_v, syn)
    conn.weight[0] = weight
    conn.delay = delay
    conn.threshold = 0
    h.pop_section()
    return syn,conn
开发者ID:David--Hunt,项目名称:CA3project,代码行数:14,代码来源:nrnutils.py


示例20: find_middle_coordinates

 def find_middle_coordinates(self) :
     cell_list = []
     self.m_coordinates = []
     for n in range(self.num_neurons) :
         cell = []
         print "Neuron ", n
         for i in range(self.NSize[n]):
             exec "cell.append(h.neuron"+str(n)+"_tree["+str(i)+"])";
             cell[i].push()
             middle = int(h.n3d()/2)# It has to be integer!!
             self.m_coordinates.append((h.x3d(middle),h.y3d(middle),h.z3d(middle)))
             #print "Yo(", i, ") Middle is ", middle, Coordinates[i]
             h.pop_section()
         cell_list.append(cell)
     self.m_coordinates 
开发者ID:cpsnowden,项目名称:anisopter,代码行数:15,代码来源:cstmd.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python h.run函数代码示例发布时间:2022-05-27
下一篇:
Python h.n3d函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap