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

Python moose.vec函数代码示例

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

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



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

示例1: find_max_voxel

def find_max_voxel(): #added by Chaitanya
    spineCa = len(moose.vec( '/model/chem/spine/Ca' ))
    dendCa = len(moose.vec( '/model/chem/dend/DEND/Ca' ))
    Ca = len([ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ])
    spineCaM = len(moose.vec( '/model/chem/spine/Ca_CaM' ))
    psdCaM = len(moose.vec( '/model/chem/psd/Ca_CaM' ))
    return max(spineCa, dendCa, Ca, spineCaM, psdCaM)
开发者ID:dilawar,项目名称:nsdf,代码行数:7,代码来源:multi1.py


示例2: create_population

def create_population(container, size):
    """Create a population of `size` single compartmental neurons with Na+
    and K+ channels. Also create SpikeGen objects and SynChan objects
    connected to these which can act as plug points for setting up
    synapses later.

    This uses ..ref::`ionchannel.create_1comp_neuron`.

    """
    path = container.path
    print((path, size, type(path)))
    comps = create_1comp_neuron('{}/neuron'.format(path), number=size)
    synpath = path+'/synchan'
    print((synpath, size, type(size)))
    synchan = moose.vec(synpath, n=size, dtype='SynChan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    m = moose.connect(comps, 'channel', synchan, 'channel', 'OneToOne')
    synhandler = moose.vec('{}/synhandler'.format(path), n=size,
                           dtype='SimpleSynHandler')
    moose.connect(synhandler, 'activationOut', synchan, 'activation', 'OneToOne')
    spikegen = moose.vec('{}/spikegen'.format(path), n=size, dtype='SpikeGen')
    spikegen.threshold = 0.0
    m = moose.connect(comps, 'VmOut', spikegen, 'Vm', 'OneToOne')
    return {'compartment': comps, 'spikegen': spikegen, 'synchan':
            synchan, 'synhandler': synhandler}
开发者ID:asiaszmek,项目名称:moose,代码行数:27,代码来源:compartment_net.py


示例3: create_population

def create_population(container, size):
    """Create a population of `size` single compartmental neurons with Na+
    and K+ channels. Also create SpikeGen objects and SynChan objects
    connected to these which can act as plug points for setting up
    synapses later.

    This uses ..ref::`ionchannel.create_1comp_neuron`.

    """
    path = container.path
    print path, size, type(path)
    comps = create_1comp_neuron("{}/neuron".format(path), number=size)
    synpath = path + "/synchan"
    print synpath, size, type(size)
    synchan = moose.vec(synpath, n=size, dtype="SynChan")
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    m = moose.connect(comps, "channel", synchan, "channel", "OneToOne")
    synhandler = moose.vec("{}/synhandler".format(path), n=size, dtype="SimpleSynHandler")
    moose.connect(synhandler, "activationOut", synchan, "activation", "OneToOne")
    spikegen = moose.vec("{}/spikegen".format(path), n=size, dtype="SpikeGen")
    spikegen.threshold = 0.0
    m = moose.connect(comps, "VmOut", spikegen, "Vm", "OneToOne")
    return {"compartment": comps, "spikegen": spikegen, "synchan": synchan, "synhandler": synhandler}
开发者ID:BhallaLab,项目名称:moose,代码行数:25,代码来源:compartment_net.py


示例4: showVisualization

def showVisualization():
    makeModel()
    elec = moose.element( '/model/elec' )
    elec.setSpineAndPsdMesh( moose.element('/model/chem/spine'), moose.element('/model/chem/psd') )

    eHead = moose.wildcardFind( '/model/elec/#head#' )
    oldDia = [ i.diameter for i in eHead ]
    graphs = moose.Neutral( '/graphs' )
    #makePlot( 'psd_x', moose.vec( '/model/chem/psd/x' ), 'getN' )
    #makePlot( 'head_x', moose.vec( '/model/chem/spine/x' ), 'getN' )
    makePlot( 'dend_x', moose.vec( '/model/chem/dend/x' ), 'getN' )
    dendZ = makePlot( 'dend_z', moose.vec( '/model/chem/dend/z' ), 'getN' )
    makePlot( 'head_z', moose.vec( '/model/chem/spine/z' ), 'getN' )
    psdZ = makePlot( 'psd_z', moose.vec( '/model/chem/psd/z' ), 'getN' )
    diaTab = makePlot( 'headDia', eHead, 'getDiameter' )
    # print diaTab[0].vector[-1]
    # return
    dendrite = moose.element("/model/elec/dend")
    dendrites = [dendrite.path + "/" + str(i) for i in range(len(dendZ))]
    # print dendrites
    moose.reinit()

    spineHeads = moose.wildcardFind( '/model/elec/#head#')
    # print moose.wildcardFind( '/model/elec/##')

    # print "dendZ", readValues(dendZ)
    # print dendrite

    app = QtGui.QApplication(sys.argv)
    viewer = create_viewer("/model/elec", dendrite, dendZ, diaTab, psdZ)
    viewer.showMaximized()
    viewer.start()
    return app.exec_()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:33,代码来源:rxdSpineSize.py


示例5: saveNeuronPlots

def saveNeuronPlots( fig, rdes ):
    #fig = plt.figure( figsize=(12, 10), facecolor='white' )
    #fig.subplots_adjust( left = 0.18 )
    plt.figure(1)

    ax = plt.subplot(222)
    cleanAx( ax, 'C' )
    plt.ylabel( 'Vm (mV)', fontsize = 16 )
    vtab = moose.element( '/graphs/vtab' )
    t = np.arange( 0, len( vtab.vector ), 1 ) * vtab.dt
    plt.plot( t, vtab.vector * 1000, label="Vm" )
    #plt.legend()
    
    ax = plt.subplot(223)
    cleanAx( ax, 'D', showXlabel = True )
    pcatab = list( moose.vec( '/graphs/pcatab' ) )[0::50]
    t = np.arange( 0, len( pcatab[0].vector ), 1 ) * pcatab[0].dt
    for i in pcatab:
        plt.plot( t, i.vector * 1000 )
    plt.ylabel( '[Ca] (uM)', fontsize = 16 )
    plt.xlabel( 'Time (s)', fontsize = 16 )

    ax = plt.subplot(224)
    cleanAx( ax, 'E', showXlabel = True )
    rtab = list( moose.vec( '/graphs/rtab' ) )[0::50]
    t = np.arange( 0, len( rtab[0].vector ), 1 ) * rtab[0].dt
    for i in rtab:
        plt.plot( t, i.vector )
    plt.ylabel( '# of inserted GluRs', fontsize = 16 )
    plt.xlabel( 'Time (s)', fontsize = 16 )
    '''
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:31,代码来源:Fig6BCDE.py


示例6: makeGraphics

def makeGraphics( cPlotDt, ePlotDt ):
        plt.ion()
        fig = plt.figure( figsize=(10,16) )
        chem = fig.add_subplot( 411 )
        chem.set_ylim( 0, 0.006 )
        plt.ylabel( 'Conc (mM)' )
        plt.xlabel( 'time (seconds)' )
        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
            line1, = chem.plot( pos, x.vector, label=x.name )
        plt.legend()

        elec = fig.add_subplot( 412 )
        plt.ylabel( 'Vm (V)' )
        plt.xlabel( 'time (seconds)' )
        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
            line1, = elec.plot( pos, x.vector, label=x.name )
        plt.legend()

        ca = fig.add_subplot( 413 )
        plt.ylabel( '[Ca] (mM)' )
        plt.xlabel( 'time (seconds)' )
        for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
            line1, = ca.plot( pos, x.vector, label=x.name )
        plt.legend()

        lenplot = fig.add_subplot( 414 )
        plt.ylabel( 'Ca (mM )' )
        plt.xlabel( 'Voxel#)' )

	spineCa = moose.vec( '/model/chem/spine/Ca' )
	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )

        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
        line3, = lenplot.plot( range( len( ca ) ), ca, label='elec' )

	spineCaM = moose.vec( '/model/chem/spine/CaM_dash_Ca4' )
        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
	psdCaM = moose.vec( '/model/chem/psd/CaM_dash_Ca4' )
        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
        plt.legend()


        fig.canvas.draw()
        raw_input()
                
        '''
        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
            t = numpy.arange( 0, x.vector.size, 1 )
            pylab.plot( t, x.vector, label=x.name )
        pylab.legend()
        pylab.show()
        '''

	print 'All done'
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:59,代码来源:multi3.py


示例7: main

def main():
    """
    transportBranchingNeuron:
    This example illustrates bidirectional transport 
    embedded in the branching pseudo 1-dimensional geometry of a neuron. 
    This means that diffusion and transport only happen along the axis of 
    dendritic segments, not radially from inside to outside a dendrite, 
    nor tangentially around the dendrite circumference. 
    In this model there is a molecule **a** starting at the soma, which is
    transported out to the dendrites. There is another molecule, **b**,
    which is initially present at the dendrite tips, and is transported
    toward the soma.
    This example uses an external model file to specify a binary branching 
    neuron. This model does not have any spines. The electrical model is 
    used here purely for the geometry and is not part of the computations.
    In this example we build trival chemical model just having
    molecules **a** and **b** throughout the neuronal geometry, using 
    the makeChemModel function.
    The model is set up to run using the Ksolve for integration and the
    Dsolve for handling diffusion.

    The display has three parts:

        a. Animated pseudo-3D plot of neuronal geometry, where each point
           represents a diffusive voxel and moves in the y-axis to show
           changes in concentration of molecule a.
        b. Similar animated pseudo-3D plot for molecule b.
        c. Time-series plot that appears after the simulation has 
           ended. The plots are for the first and last diffusive voxel,
           that is, the soma and the tip of one of the apical dendrites.

    """
    chemdt = 0.1 # Tested various dts, this is reasonable.
    diffdt = 0.01
    plotdt = 1
    animationdt = 5
    runtime = 600 

    makeModel()
    plotlist = makeDisplay()

    # Schedule the whole lot
    for i in range( 11, 17 ):
        moose.setClock( i, chemdt ) # for the chem objects
    moose.setClock( 10, diffdt ) # for the diffusion
    moose.setClock( 18, plotdt ) # for the output tables.
    moose.reinit()
    a = moose.vec( '/model/chem/compt0/a' )
    b = moose.vec( '/model/chem/compt0/b' )
    a0 = sum( a.n )
    b0 = sum( b.n )
    for i in range( 0, runtime, animationdt ):
        moose.start( animationdt )
        plotlist[4].set_text( "time = %d" % i )
        updateDisplay( plotlist )

    print 'mass consv a = ', a0, sum( a.n ), ', b = ', b0, sum( b.n )

    finalizeDisplay( plotlist, plotdt )
开发者ID:saeedsh,项目名称:async_gpu,代码行数:59,代码来源:transportBranchingNeuron.py


示例8: testRename

 def testRename(self):
     """Rename an element in a Id and check if that was effective. This
     tests for setting values also."""
     id1 = moose.vec(path='/alpha', n=1, dtype='Neutral')
     id2 = moose.vec('alpha')
     id1[0].name = 'bravo'
     self.assertEqual(id1.path, '/bravo')
     self.assertEqual(id2.path, '/bravo')
开发者ID:asiaszmek,项目名称:moose-core,代码行数:8,代码来源:test_pymoose.py


示例9: main

def main():
    numpy.random.seed( 1234 )
    rdes = buildRdesigneur()
    rdes.buildModel( '/model' )
    assert( moose.exists( '/model' ) )
    moose.element( '/model/elec/hsolve' ).tick = -1
    for i in range( 0, 10 ):
        moose.setClock( i, 100 )
    for i in range( 10, 18 ):
        moose.setClock( i, dt )
    moose.setClock( 18, plotdt )
    moose.reinit()
    buildPlots()
    # Run for baseline, tetanus, and post-tetanic settling time 
    print 'starting...'
    t1 = time.time()
    moose.start( baselineTime )
    caPsd = moose.vec( '/model/chem/psd/Ca_input' )
    caDend = moose.vec( '/model/chem/dend/DEND/Ca_input' )
    castim = (numpy.random.rand( len( caPsd.concInit ) ) * 0.8 + 0.2) * psdTetCa
    caPsd.concInit = castim
    caDend.concInit = numpy.random.rand( len( caDend.concInit ) ) * dendTetCa
    moose.start( tetTime )
    caPsd.concInit = basalCa
    caDend.concInit = basalCa
    moose.start( interTetTime )
    caPsd.concInit = castim
    caDend.concInit = numpy.random.rand( len( caDend.concInit ) ) * dendTetCa
    moose.start( tetTime )
    caPsd.concInit = basalCa
    caDend.concInit = basalCa
    moose.start( postTetTime )
    caPsd.concInit = ltdCa
    caDend.concInit = ltdCa
    moose.start( ltdTime )
    caPsd.concInit = basalCa
    caDend.concInit = basalCa
    moose.start( postLtdTime )
    print 'real time = ', time.time() - t1

    if do3D:
        app = QtGui.QApplication(sys.argv)
        compts = moose.wildcardFind( "/model/elec/#[ISA=compartmentBase]" )
        ecomptPath = map( lambda x : x.path, compts )
        morphology = moogli.read_morphology_from_moose(name = "", path = "/model/elec")
        morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
            [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] )
        viewer = moogli.DynamicMorphologyViewerWidget(morphology)
        def callback( morphology, viewer ):
            moose.start( 0.1 )
            return True
        viewer.set_callback( callback, idletime = 0 )
        viewer.showMaximized()
        viewer.show()
        app.exec_()

    displayPlots()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:57,代码来源:Fig4CDEF.py


示例10: testCompareId

 def testCompareId(self):
     """Test the rich comparison between ids"""
     id1 = moose.vec('A', n=2, dtype='Neutral')
     id2 = moose.vec('B', n=4, dtype='Neutral')
     id3 = moose.vec('A')
     self.assertTrue(id1 < id2)
     self.assertEqual(id1, id3)
     self.assertTrue(id2 > id1)
     self.assertTrue(id2 >= id1)
     self.assertTrue(id1 <= id2)
开发者ID:asiaszmek,项目名称:moose-core,代码行数:10,代码来源:test_pymoose.py


示例11: updatePlots

def updatePlots( plotlist, time ):
    a = moose.vec( '/model/compartment/a' )
    b = moose.vec( '/model/compartment/b' )
    c = moose.vec( '/model/compartment/c' )
    d = moose.vec( '/model/compartment/d' )

    plotlist[2].set_text( "time = %g" % time )
    plotlist[3].set_ydata( a.conc )
    plotlist[4].set_ydata( b.conc )
    plotlist[5].set_ydata( c.conc )
    plotlist[6].set_ydata( d.conc )
开发者ID:NeuroArchive,项目名称:moose,代码行数:11,代码来源:gssaCylinderDiffusion.py


示例12: updateGraphics

def updateGraphics( plotlist ):
	spineCa = moose.vec( '/model/chem/spine/Ca' )
	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
        plotlist[5].set_ydata( spineCa.conc )
        plotlist[6].set_ydata( dendCa.conc )

        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
        plotlist[7].set_ydata( ca )
	spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
        plotlist[8].set_ydata( spineCaM.conc )
	psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
        plotlist[9].set_ydata( psdCaM.conc )
        plotlist[4].canvas.draw()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:13,代码来源:multi1.py


示例13: updateDisplay

def updateDisplay( plotlist ):
    Ca = moose.vec( '/model/chem/compt0/Ca' )
    Ca_input = moose.vec( '/model/chem/compt0/Ca_input' )
    plotlist[5].set_ydata( Ca.conc )
    plotlist[6].set_ydata( Ca_input.conc )

    Ca = moose.vec( '/model/chem/compt1/Ca' )
    plotlist[7].set_ydata( Ca.conc )

    Ca = moose.vec( '/model/chem/compt2/Ca' )
    Ca_input = moose.vec( '/model/chem/compt2/Ca_input' )
    plotlist[8].set_ydata( Ca.conc )
    plotlist[9].set_ydata( Ca_input.conc )
    plotlist[4].canvas.draw()
开发者ID:dilawar,项目名称:moose-examples,代码行数:14,代码来源:diffSpinyNeuron.py


示例14: loadChem

def loadChem( neuroCompt, spineCompt, psdCompt ):
	# We need the compartments to come in with a volume of 1 to match the
	# original CubeMesh.
	assert( neuroCompt.volume == 1.0 )
	assert( spineCompt.volume == 1.0 )
	assert( psdCompt.volume == 1.0 )
	assert( neuroCompt.mesh.num == 1 )
	print 'volume = ', neuroCompt.mesh[0].volume
	#assert( neuroCompt.mesh[0].volume == 1.0 ) 
	#an unfortunate mismatch
	# So we'll have to resize the volumes of the current compartments to the
	# new ones.

	modelId = moose.loadModel( 'diffonly.g', '/model', 'ee' )
	#moose.le( '/model/model' )
	#moose.le( '/model/model/kinetics' )
	#moose.le( '/model/model/kinetics/PSD' )
	#moose.le( '/model/model/kinetics/SPINE' )
	moose.delete( moose.vec( '/model/model/kinetics/PSD/kreac' ) )
	moose.delete( moose.vec( '/model/model/kinetics/SPINE/kreac' ) )
	#moose.le( '/model/model/kinetics/PSD' )
	#moose.le( '/model/model/kinetics/SPINE' )
	pCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
	pCaCaM.concInit = 0.001
	dCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
	sCaCaM = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
	print "CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit
	#moose.delete( moose.vec( '/model/model/kinetics/SPINE/Ca_CaM' ) )
	#CaCaM2 = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
	#CaCaM2.concInit = 0.001
	chem = moose.element( '/model/model' )
	chem.name = 'chem'
	oldS = moose.element( '/model/chem/compartment_1' )
	oldP = moose.element( '/model/chem/compartment_2' )
	oldN = moose.element( '/model/chem/kinetics' )
	print 'oldvols[p,s,d] = ', oldP.volume, oldS.volume, oldN.volume
	print 'newvols[p,s,d] = ', psdCompt.mesh[0].volume, spineCompt.mesh[0].volume, neuroCompt.mesh[0].volume
	oldN.volume = neuroCompt.mesh[0].volume
	oldS.volume = spineCompt.mesh[0].volume
	oldP.volume = psdCompt.mesh[0].volume
	print 'after redoing vols'
	print "CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit
	moveCompt( '/model/chem/kinetics/SPINE', oldS, spineCompt )
	moveCompt( '/model/chem/kinetics/PSD', oldP, psdCompt )
	# Need to do the DEND last because the oldN is /kinetics, 
	# and it will be deleted.
	moveCompt( '/model/chem/kinetics/DEND', oldN, neuroCompt )
	print 'after moving to new compts'
	print "CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit
开发者ID:NeuroArchive,项目名称:moose,代码行数:49,代码来源:diffusionOnly.py


示例15: printPsd

def printPsd( name ):
    # Print the vol, the path dist from soma, the electrotonic dist, and N
    psdR = moose.vec( '/model/chem/psd/tot_PSD_R' )
    neuronVoxel = moose.element( '/model/chem/spine' ).neuronVoxel
    elecComptMap = moose.element( '/model/chem/dend' ).elecComptMap
    print(("len( neuronVoxel = ", len( neuronVoxel), min( neuronVoxel), max( neuronVoxel)))
    print((len( elecComptMap), elecComptMap[0], elecComptMap[12]))
    neuron = moose.element( '/model/elec' )
    ncompts = neuron.compartments
    d = {}
    j = 0
    for i in ncompts:
        #print i
        d[i] = j
        j += 1

    f = open( name + ".txt", 'w' )
    for i in range( len( psdR ) ):
        n = psdR[i].n
        conc = psdR[i].conc
        vol = psdR[i].volume
        compt = elecComptMap[ neuronVoxel[i] ]
        #print compt
        segIndex = d[compt[0]]
        p = neuron.geometricalDistanceFromSoma[ segIndex ]
        L = neuron.electrotonicDistanceFromSoma[ segIndex ]
        s = str( i ) + "    " + str(n) + "  " + str( conc ) + "  " + str(p) + "  " + str(L) + "\n"
        f.write( s )
    f.close()
开发者ID:dilawar,项目名称:moose-examples,代码行数:29,代码来源:Fig5BCD.py


示例16: _parseComptField

    def _parseComptField( self, comptList, plotSpec, knownFields ):
        # Put in stuff to go through fields if the target is a chem object
        field = plotSpec[3]
        if not field in knownFields:
            print "Warning: Rdesigneur::_parseComptField: Unknown field '", field, "'"
            return (), ""

        kf = knownFields[field] # Find the field to decide type.
        if ( kf[0] == 'CaConcBase' or kf[0] == 'ChanBase' ):
            objList = self._collapseElistToPathAndClass( comptList, plotSpec[2], kf[0] )
            return objList, kf[1]
        elif (field == 'n' or field == 'conc' ):
            path = plotSpec[2]
            pos = path.find( '/' )
            if pos == -1:   # Assume it is in the dend compartment.
                path  = 'dend/' + path
            pos = path.find( '/' )
            chemCompt = path[:pos]
            cc = moose.element( self.modelPath + '/chem/' + chemCompt)
            voxelVec = []
            if ( chemCompt == 'dend' ):
                for i in comptList:
                    voxelVec.extend( cc.dendVoxelsOnCompartment[i] )
            else:
                for i in comptList:
                    voxelVec.extend( cc.spineVoxelsOnCompartment[i] )
            # Here we collapse the voxelVec into objects to plot.
            allObj = moose.vec( self.modelPath + '/chem/' + plotSpec[2] )
            objList = [ allObj[int(j)] for j in voxelVec]
            return objList, kf[1]

        else:
            return comptList, kf[1]
开发者ID:dharmasam9,项目名称:moose-core,代码行数:33,代码来源:rdesigneur.py


示例17: makeModel

def makeModel():
    moose.Neutral( '/library' )
    makeCellProto( 'cellProto' )
    makeChemProto( 'cProto' )
    makeSpineProto2( 'spine' )
    rdes = rd.rdesigneur( useGssa = False, \
            combineSegments = False, \
            stealCellFromLibrary = True, \
            diffusionLength = 1e-6, \
            cellProto = [['cellProto', 'elec' ]] ,\
            spineProto = [['spineProto', 'spine' ]] ,\
            chemProto = [['cProto', 'chem' ]] ,\
            spineDistrib = [ \
                ['spine', '#', \
                'spacing', str( spineSpacing ), \
                'spacingDistrib', str( spineSpacingDistrib ), \
                'angle', str( spineAngle ), \
                'angleDistrib', str( spineAngleDistrib ), \
                'size', str( spineSize ), \
                'sizeDistrib', str( spineSizeDistrib ) ] \
            ], \
            chemDistrib = [ \
                [ "chem", "dend", "install", "1" ] \
            ],
            adaptorList = [ \
                [ 'psd/z', 'n', 'spine', 'psdArea', 10.0e-15, 300e-15 ], \
                ] \
        )
    rdes.buildModel( '/model' )
    x = moose.vec( '/model/chem/dend/x' )
    x.concInit = 0.0
    for i in range( 0,20 ):
        x[i].concInit = concInit
开发者ID:asiaszmek,项目名称:moose,代码行数:33,代码来源:rxdSpineSize.py


示例18: displayPlots

def displayPlots():
    for x in moose.wildcardFind( '/graphs/#[0]' ):
        tab = moose.vec( x )
        for i in range( len( tab ) ):
            pylab.plot( tab[i].vector, label=x.name[:-3] + " " + str( i ) )
        pylab.legend()
        pylab.figure()
开发者ID:asiaszmek,项目名称:moose,代码行数:7,代码来源:rxdSpineSize.py


示例19: loadtree

def loadtree(hdfnode, moosenode):
    """Load the element tree saved under the group `hdfnode` into `moosenode`"""
    pathclass = {}
    basepath = hdfnode.attr['path']
    if basepath != '/':
        basepath = basepath + '/'
    emdata = hdfnode['vec'][:]
    sorted_paths = sorted(emdata['path'], key=lambda x: x.count('/'))
    dims = dict(emdata['path', 'dims'])
    classes = dict(emdata['path', 'class'])
    current = moose.getCwe()
    moose.setCwe(moosenode)
    # First create all the ematrices
    for path in sorted_paths:
        rpath = path[len(basepath):]
        classname = classes[path]
        shape = dims[path]
        em = moose.vec(rpath, shape, classname)
    wfields = {}
    for cinfo in moose.element('/classes').children:
        cname = cinfo[0].name
        wfields[cname] = [f[len('set_'):] for f in moose.getFieldNames(cname, 'destFinfo')
                          if f.startswith('set_') and f not in ['set_this', 'set_name', 'set_lastDimension', 'set_runTime'] and not f.startswith('set_num_')]
        for key in hdfnode['/elements']:
            dset = hdfnode['/elements/'][key][:]
            fieldnames = dset.dtype.names
            for ii in range(len(dset)):
                obj = moose.element(dset['path'][ii][len(basepath):])
                for f in wfields[obj.className]:
                    obj.setField(f, dset[f][ii])
开发者ID:hrani,项目名称:moose-core,代码行数:30,代码来源:hdfutil.py


示例20: main

def main():
    """
    This illustrates the use of rdesigneur to build a simple dendrite with
    spines, and then to resize them using spine fields. These are the
    fields that would be changed dynamically in a simulation with reactions
    that affect spine geometry.
    In this simulation there is a propagating reaction wave using a
    highly abstracted equation, whose product diffuses into the spines and
    makes them bigger.
    """
    makeModel()
    elec = moose.element( '/model/elec' )
    elec.setSpineAndPsdMesh( moose.element('/model/chem/spine'), moose.element('/model/chem/psd') )

    eHead = moose.wildcardFind( '/model/elec/#head#' )
    oldDia = [ i.diameter for i in eHead ]
    graphs = moose.Neutral( '/graphs' )
    #makePlot( 'psd_x', moose.vec( '/model/chem/psd/x' ), 'getN' )
    #makePlot( 'head_x', moose.vec( '/model/chem/spine/x' ), 'getN' )
    makePlot( 'dend_x', moose.vec( '/model/chem/dend/x' ), 'getN' )
    makePlot( 'dend_z', moose.vec( '/model/chem/dend/z' ), 'getN' )
    makePlot( 'head_z', moose.vec( '/model/chem/spine/z' ), 'getN' )
    makePlot( 'psd_z', moose.vec( '/model/chem/psd/z' ), 'getN' )
    makePlot( 'headDia', eHead, 'getDiameter' )

    '''
    debug = moose.PyRun( '/pyrun' )
    debug.tick = 10
    debug.runString = """print "RUNNING: ", moose.element( '/model/chem/psd/z' ).n, moose.element( '/model/elec/head0' ).diameter"""
    '''
    moose.reinit()
    moose.start( runtime )

    displayPlots()
    pylab.plot( oldDia, label = 'old Diameter' )
    pylab.plot( [ i.diameter for i in eHead ], label = 'new Diameter' )
    pylab.legend()
    pylab.show()

    app = QtGui.QApplication(sys.argv)
    #widget = mv.MoogliViewer( '/model' )
    morphology = moogli.read_morphology_from_moose( name="", path = '/model/elec' )
    widget = moogli.MorphologyViewerWidget( morphology )
    widget.show()
    return app.exec_()
    quit()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:46,代码来源:rxdSpineSize.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python moose.wildcardFind函数代码示例发布时间:2022-05-27
下一篇:
Python moose.useClock函数代码示例发布时间: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