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

Python moose.le函数代码示例

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

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



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

示例1: test_elec_alone

def test_elec_alone():
    eeDt = 2e-6
    hSolveDt = 2e-5
    runTime = 0.02

    make_spiny_compt()
    make_elec_plots()
    head2 = moose.element( '/n/head2' )
    moose.setClock( 0, 2e-6 )
    moose.setClock( 1, 2e-6 )
    moose.setClock( 2, 2e-6 )
    moose.setClock( 8, 0.1e-3 )
    moose.useClock( 0, '/n/##[ISA=Compartment]', 'init' )
    moose.useClock( 1, '/n/##[ISA=Compartment]', 'process' )
    moose.useClock( 2, '/n/##[ISA=ChanBase],/n/##[ISA=SynBase],/n/##[ISA=CaConc],/n/##[ISA=SpikeGen]','process')
    moose.useClock( 8, '/graphs/elec/#', 'process' )
    moose.reinit()
    moose.start( runTime )
    dump_plots( 'instab.plot' )
    print "||||", len(moose.wildcardFind('/##[ISA=HHChannel]'))
    # make Hsolver and rerun
    hsolve = moose.HSolve( '/n/hsolve' )
    moose.useClock( 1, '/n/hsolve', 'process' )
    hsolve.dt = 20e-6
    hsolve.target = '/n/compt'
    moose.le( '/n' )
    for dt in ( 20e-6, 50e-6, 100e-6 ):
        print 'running at dt =', dt
        moose.setClock( 0, dt )
        moose.setClock( 1, dt )
        moose.setClock( 2, dt )
        hsolve.dt = dt
        moose.reinit()
        moose.start( runTime )
        dump_plots( 'h_instab' + str( dt ) + '.plot' )
开发者ID:csiki,项目名称:MOOSE,代码行数:35,代码来源:testHsolve.py


示例2: main

def main():
        """
        This example illustrates loading and running a reaction system that
        spans two volumes, that is, is in different compartments. It uses a
        kkit model file. You can tell if it is working if you see nice 
        relaxation oscillations.
        """
        # the kkit reader doesn't know how to do multicompt solver setup.
        solver = "ee"  
	mfile = '../Genesis_files/OSC_diff_vols.g'
	runtime = 3000.0
        simDt = 1.0
	modelId = moose.loadModel( mfile, 'model', solver )
        #moose.delete( '/model/kinetics/A/Stot' )
        compt0 = moose.element( '/model/kinetics' )
        compt1 = moose.element( '/model/compartment_1' )
        assert( deq( compt0.volume, 2e-20 ) )
        assert( deq( compt1.volume, 1e-20 ) )
        dy = compt0.dy
        compt1.y1 += dy
        compt1.y0 = dy
        assert( deq( compt1.volume, 1e-20 ) )
        # We now have two cubes adjacent to each other. Compt0 has 2x vol.
        # Compt1 touches it.
        stoich0 = moose.Stoich( '/model/kinetics/stoich' )
        stoich1 = moose.Stoich( '/model/compartment_1/stoich' )
        ksolve0 = moose.Ksolve( '/model/kinetics/ksolve' )
        ksolve1 = moose.Ksolve( '/model/compartment_1/ksolve' )
        stoich0.compartment = compt0
        stoich0.ksolve = ksolve0
        stoich0.path = '/model/kinetics/##'
        stoich1.compartment = compt1
        stoich1.ksolve = ksolve1
        stoich1.path = '/model/compartment_1/##'
        #stoich0.buildXreacs( stoich1 )
        print ksolve0.numLocalVoxels, ksolve0.numPools, stoich0.numAllPools
        assert( ksolve0.numLocalVoxels == 1 )
        assert( ksolve0.numPools == 7 )
        assert( stoich0.numAllPools == 6 )
        print len( stoich0.proxyPools[stoich1] ),
        print len( stoich1.proxyPools[stoich0] )
        assert( len( stoich0.proxyPools[stoich1] ) == 1 )
        assert( len( stoich1.proxyPools[stoich0] ) == 1 )
        print ksolve1.numLocalVoxels, ksolve1.numPools, stoich1.numAllPools
        assert( ksolve1.numLocalVoxels == 1 )
        assert( ksolve1.numPools == 6 )
        assert( stoich1.numAllPools == 5 )
        stoich0.buildXreacs( stoich1 )
        print moose.element( '/model/kinetics/endo' )
        print moose.element( '/model/compartment_1/exo' )
        moose.le( '/model/compartment_1' )
	moose.reinit()
	moose.start( runtime ) 

	# Display all plots.
	for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
            t = numpy.arange( 0, x.vector.size, 1 ) * simDt
            pylab.plot( t, x.vector, label=x.name )
        pylab.legend()
        pylab.show()
开发者ID:NeuroArchive,项目名称:moose,代码行数:60,代码来源:crossComptOscillator.py


示例3: testChemAlone

def testChemAlone():
    nid = makeChemInCubeMesh()
    moose.le( '/n' )
    makeChemPlots()
    moose.setClock( 5, 1e-2 )
    moose.setClock( 6, 1e-2 )
    moose.setClock( 7, 1.0 )
    moose.setClock( 8, 1.0 )
    moose.setClock( 9, 1.0 )
    moose.useClock( 5, '/n/##', 'init' )
    moose.useClock( 6, '/n/##', 'process' )
    #moose.useClock( 7, '/graphs/#', 'process' )
    moose.useClock( 8, '/graphs/#', 'process' )
    moose.reinit()
    moose.start( 100 )
    dumpPlots( 'chem.plot' )
    # Make ksolver and rerun.
    ksolve = moose.GslStoich( '/n/solver' )
    ksolve.path = '/n/##'
    ksolve.method = 'rk5'
    moose.useClock( 5, '/n/solver', 'process' )
    moose.setClock( 5, 1 )
    moose.setClock( 6, 1 )
    moose.reinit()
    moose.start( 100 )
    dumpPlots( 'kchem.plot' )
开发者ID:Vivek-sagar,项目名称:moose-1,代码行数:26,代码来源:testSigNeur.py


示例4: makeModel

def makeModel():
                if len( sys.argv ) == 1:
                        useGsolve = True
                else:
                        useGsolve = ( sys.argv[1] == 'True' )
                # create container for model
                model = moose.Neutral( 'model' )
                compartment = moose.CubeMesh( '/model/compartment' )
                compartment.volume = 1e-22
                # the mesh is created automatically by the compartment
                moose.le( '/model/compartment' )
                mesh = moose.element( '/model/compartment/mesh' )

                # create molecules and reactions
                a = moose.Pool( '/model/compartment/a' )
                b = moose.Pool( '/model/compartment/b' )

                # create functions of time
                f1 = moose.Function( '/model/compartment/f1' )
                f2 = moose.Function( '/model/compartment/f2' )

                # connect them up for reactions
                moose.connect( f1, 'valueOut', a, 'setConc' )
                moose.connect( f2, 'valueOut', b, 'increment' )

                # Assign parameters
                a.concInit = 0
                b.concInit = 1
                #f1.numVars = 1
                #f2.numVars = 1
                f1.expr = '1 + sin(t)'
                f2.expr = '10 * cos(t)'

                # Create the output tables
                graphs = moose.Neutral( '/model/graphs' )
                outputA = moose.Table2 ( '/model/graphs/nA' )
                outputB = moose.Table2 ( '/model/graphs/nB' )

                # connect up the tables
                moose.connect( outputA, 'requestOut', a, 'getN' );
                moose.connect( outputB, 'requestOut', b, 'getN' );

                # Set up the solvers
                if useGsolve:
                    gsolve = moose.Gsolve( '/model/compartment/gsolve' )
                    gsolve.useClockedUpdate = True
                else:
                    gsolve = moose.Ksolve( '/model/compartment/gsolve' )
                stoich = moose.Stoich( '/model/compartment/stoich' )
                stoich.compartment = compartment
                stoich.ksolve = gsolve
                stoich.path = '/model/compartment/##'
                '''
                '''

                # We need a finer timestep than the default 0.1 seconds,
                # in order to get numerical accuracy.
                for i in range (10, 19 ):
                    moose.setClock( i, 0.1 ) # for computational objects
开发者ID:asiaszmek,项目名称:moose,代码行数:59,代码来源:funcInputToPools.py


示例5: setup_clocks

def setup_clocks(simdt, plotdt):
    print 'Setting up clocks: simdt', simdt, 'plotdt', plotdt
    moose.setClock(INITCLOCK, simdt)
    moose.setClock(ELECCLOCK, simdt)
    moose.setClock(CHANCLOCK, simdt)
    moose.setClock(POOLCLOCK, simdt)
    moose.setClock(LOOKUPCLOCK, simdt)
    moose.setClock(STIMCLOCK, simdt)
    moose.setClock(PLOTCLOCK, plotdt)
    moose.le('/clock')
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:10,代码来源:testutils.py


示例6: setup_clocks

def setup_clocks(simdt, plotdt):
    print("Setting up clocks: simdt", simdt, "plotdt", plotdt)
    moose.setClock(INITCLOCK, simdt)
    moose.setClock(ELECCLOCK, simdt)
    moose.setClock(CHANCLOCK, simdt)
    moose.setClock(POOLCLOCK, simdt)
    moose.setClock(LOOKUPCLOCK, simdt)
    moose.setClock(STIMCLOCK, simdt)
    moose.setClock(PLOTCLOCK, plotdt)
    moose.le("/clock")
开发者ID:BhallaLab,项目名称:moose,代码行数:10,代码来源:testutils.py


示例7: _setup_network

 def _setup_network(self):
     """Sets up the network (_init_network is enough)"""
     self.network = moose.LIF( 'network', self.N );
     moose.le( '/network' )
     self.network.vec.Em = self.el
     self.network.vec.thresh = self.vt
     self.network.vec.refractoryPeriod = self.refrT
     self.network.vec.Rm = self.Rm
     self.network.vec.vReset = self.vr
     self.network.vec.Cm = self.Cm
     self.network.vec.inject = self.Iinject
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:11,代码来源:ExcInhNet_Ostojic2014_Brunel2000.py


示例8: main

def main():
		# Schedule the whole lot
		moose.setClock( 4, 0.1 ) # for the computational objects
		moose.setClock( 5, 0.1 ) # clock for the solver
		moose.setClock( 8, 1.0 ) # for the plots
		# The wildcard uses # for single level, and ## for recursive.
		#compartment = makeModel()
                moose.loadModel( '../Genesis_files/M1719.cspace', '/model', 'ee' )
                compartment = moose.element( 'model/kinetics' )
                compartment.name = 'compartment'
		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
		stoich = moose.Stoich( '/model/compartment/stoich' )
		stoich.compartment = compartment
		stoich.ksolve = ksolve
		#ksolve.stoich = stoich
		stoich.path = "/model/compartment/##"
		state = moose.SteadyState( '/model/compartment/state' )
		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
		moose.useClock( 8, '/model/graphs/#', 'process' )

		moose.reinit()
		state.stoich = stoich
		#state.showMatrices()
		state.convergenceCriterion = 1e-7

                moose.le( '/model/graphs' )
                a = moose.element( '/model/compartment/a' )
                b = moose.element( '/model/compartment/b' )
                c = moose.element( '/model/compartment/c' )

		for i in range( 0, 100 ):
			getState( ksolve, state )
		
		moose.start( 100.0 ) # Run the model for 100 seconds.

		b = moose.element( '/model/compartment/b' )
		c = moose.element( '/model/compartment/c' )

		# move most molecules over to b
		b.conc = b.conc + c.conc * 0.95
		c.conc = c.conc * 0.05
		moose.start( 100.0 ) # Run the model for 100 seconds.

		# move most molecules back to a
		c.conc = c.conc + b.conc * 0.95
		b.conc = b.conc * 0.05
		moose.start( 100.0 ) # Run the model for 100 seconds.

		# Iterate through all plots, dump their contents to data.plot.
		displayPlots()

		quit()
开发者ID:saeedsh,项目名称:async_gpu,代码行数:52,代码来源:cspaceSteadyState.py


示例9: _setup_network

 def _setup_network(self):
     """Sets up the network (_init_network is enough)"""
     self.network = moose.LIF("network", self.N)
     moose.le("/network")
     self.network.vec.Em = self.el
     self.network.vec.thresh = self.vt
     self.network.vec.refractoryPeriod = self.refrT
     self.network.vec.Rm = self.Rm
     self.network.vec.vReset = self.vr
     self.network.vec.Cm = self.Cm
     if not noiseInj:
         self.network.vec.inject = self.Iinject
     else:
         ## inject a constant + noisy current
         ## values are set in self.simulate()
         self.noiseTables = moose.StimulusTable("noiseTables", self.N)
         moose.connect(self.noiseTables, "output", self.network, "setInject", "OneToOne")
开发者ID:NeuroArchive,项目名称:moose,代码行数:17,代码来源:ExcInhNet_HigginsGraupnerBrunel2014.py


示例10: main

def main():
    """
    Demonstrates how one can visualise morphology of a neuron using the MOOSE.
    """
    app = QtGui.QApplication(sys.argv)
    filename = 'barrionuevo_cell1zr.CNG.swc'
    moose.Neutral( '/library' )
    moose.Neutral( '/model' )
    cell = moose.loadModel( filename, '/model/testSwc' )
    for i in range( 8 ):
        moose.setClock( i, simdt )
    hsolve = moose.HSolve( '/model/testSwc/hsolve' )
    hsolve.dt = simdt
    hsolve.target = '/model/testSwc/soma'
    moose.le( cell )
    moose.reinit()

    # Now we set up the display
    compts = moose.wildcardFind( "/model/testSwc/#[ISA=CompartmentBase]" )
    compts[0].inject = inject
    ecomptPath = [x.path for x in compts]
    morphology = moogli.extensions.moose.read(path="/model/testSwc", vertices=15)
    viewer = moogli.Viewer("Viewer")
    viewer.attach_shapes( morphology.shapes.values() )
    view = moogli.View("main-view")
    viewer.attach_view( view )
    # morphology = moogli.read_morphology_from_moose(name = "", path = "/model/testSwc")
    # 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( frameRunTime )
        Vm = [moose.element( x ).Vm for x in compts]
        morphology.set_color( "group_all", Vm )
        currTime = moose.element( '/clock' ).currentTime
        #print currTime, compts[0].Vm
        if ( currTime < runtime ):
            return True
        return False

    #viewer.set_callback( callback, idletime = 0 )
    #viewer.showMaximized()
    viewer.show()
    app.exec_()
开发者ID:dilawar,项目名称:moose-examples,代码行数:45,代码来源:loadMorphology.py


示例11: addSpineProto

    def addSpineProto( self, name = 'spine', \
            RM = 1.0, RA = 1.0, CM = 0.01, \
            shaftLen = 1.e-6 , shaftDia = 0.2e-6, \
            headLen = 0.5e-6, headDia = 0.5e-6, \
            synList = ( ['glu', 0.0, 2e-3, 9e-3, 200.0, False],
                        ['NMDA', 0.0, 20e-3, 20e-3, 40.0, True] ),
            chanList = ( ['LCa', 40.0, True ], ),
            caTau = 13.333e-3
            ):
        if not moose.exists( '/library' ):
            library = moose.Neutral( '/library' )
        spine = moose.Neutral( '/library/spine' )
        shaft = self._buildCompt( spine, 'shaft', shaftLen, shaftDia, 0.0, RM, RA, CM )
        head = self._buildCompt( spine, 'head', headLen, headDia, shaftLen, RM, RA, CM )
        moose.connect( shaft, 'raxial', head, 'axial' )

        if caTau > 0.0:
            conc = moose.CaConc( head.path + '/Ca_conc' )
            conc.tau = caTau
            # B = 1/(ion_charge * Faraday * volume)
            vol = head.length * head.diameter * head.diameter * PI / 4.0
            conc.B = 1.0 / ( 2.0 * FaradayConst * vol )
            conc.Ca_base = 0.0
        for i in synList:
            syn = self._buildSyn( i[0], head, i[1], i[2], i[3], i[4], CM )
            if i[5] and caTau > 0.0:
                moose.connect( syn, 'IkOut', conc, 'current' )
        for i in chanList:
            if ( moose.exists( '/library/' + i[0] ) ):
                chan = moose.copy( '/library/' + i[0], head )
                chan.Gbar = i[1] * head.Cm / CM
                #print "CHAN = ", chan, chan.tick
                moose.connect( head, 'channel', chan, 'channel' )
                if i[2] and caTau > 0.0:
                    moose.connect( chan, 'IkOut', conc, 'current' )
            else:
                print "Warning: addSpineProto: channel '", i[0], \
                    "' not found on /library."
                moose.le( '/library' )
        self._transformNMDAR( '/library/spine' )
        return spine
开发者ID:iampritishpatil,项目名称:moose,代码行数:41,代码来源:rdesigneur.py


示例12: createCell

 def createCell(self, name):
     model_container = moose.Neutral('/model')
     data_container = moose.Neutral('/data')        
     moose.le(model_container)
     moose.le(data_container)
     for ch in model_container.children:            
         moose.delete(ch)
     for ch in data_container.children:
         moose.delete(ch)
     params = setup_current_step_model(model_container,
                                       data_container,
                                       name,
                                       [[0, 0, 0],
                                        [1e9, 0, 0]])
     # moose.le(model_container)
     # moose.le(data_container)
     print '11111'
     print model_container.path, data_container.path
     params['modelRoot'] = model_container.path
     params['dataRoot'] = data_container.path
     print 'here'
     return params
开发者ID:OpenSourceBrain,项目名称:Thalamocortical,代码行数:22,代码来源:gui.py


示例13: main

def main():
    app = QtGui.QApplication(sys.argv)
    filename = 'barrionuevo_cell1zr.CNG.swc'
    moose.Neutral( '/library' )
    moose.Neutral( '/model' )
    cell = moose.loadModel( filename, '/model/testSwc' )
    for i in range( 8 ):
        moose.setClock( i, simdt )
    hsolve = moose.HSolve( '/model/testSwc/hsolve' )
    hsolve.dt = simdt
    hsolve.target = '/model/testSwc/soma'
    moose.le( cell )
    moose.reinit()

    # Now we set up the display
    compts = moose.wildcardFind( "/model/testSwc/#[ISA=CompartmentBase]" )
    compts[0].inject = inject
    ecomptPath = map( lambda x : x.path, compts )
    morphology = moogli.read_morphology_from_moose(name = "", path = "/model/testSwc")
    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( frameRunTime )
        Vm = map( lambda x: moose.element( x ).Vm, compts )
        morphology.set_color( "group_all", Vm )
        currTime = moose.element( '/clock' ).currentTime
        #print currTime, compts[0].Vm
        if ( currTime < runtime ):
            return True
        return False

    viewer.set_callback( callback, idletime = 0 )
    viewer.showMaximized()
    viewer.show()
    app.exec_()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:37,代码来源:loadMorphology.py


示例14:

moose.setCwe( '/library' )
proto18.make_Ca()
proto18.make_Ca_conc()
proto18.make_K_AHP()
proto18.make_K_C()
proto18.make_Na()
proto18.make_K_DR()
proto18.make_K_A()
proto18.make_glu()
proto18.make_NMDA()
proto18.make_Ca_NMDA()
proto18.make_NMDA_Ca_conc()
proto18.make_axon()

cellId = moose.loadModel( 'ca1_asym.p', '/cell', "hsolve" )
moose.le( cellId )
moose.le( '/cell/lat_14_1' )
#le( '/cell' )
graphs = moose.Neutral( '/graphs' )
tab = moose.Table( '/graphs/soma' )
catab = moose.Table( '/graphs/ca' )
soma = moose.element( '/cell/soma' )
soma.inject = 2e-10
moose.connect( tab, 'requestOut', soma, 'getVm' )
capool = moose.element( '/cell/soma/Ca_conc' )
moose.connect( catab, 'requestOut', capool, 'getCa' )
print 1
dt = 50e-6
moose.setClock( 0, dt )
moose.setClock( 1, dt )
moose.setClock( 2, dt )
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:31,代码来源:runcell18.py


示例15: main

def main():
    """
    Simulate a pseudo-STDP protocol and plot the STDP kernel
    that emerges from Ca plasticity of Graupner and Brunel 2012.

    Author: Aditya Gilra, NCBS, Bangalore, October, 2014.
    """

    # ###########################################
    # Neuron models
    # ###########################################

    ## Leaky integrate and fire neuron
    Vrest = -65e-3 # V      # resting potential
    Vt_base = -45e-3 # V    # threshold
    Vreset = -55e-3 # V     # in current steps, Vreset is same as pedestal
    R = 1e8 # Ohm
    tau = 10e-3 # s
    refrT = 2e-3 # s

    # ###########################################
    # Initialize neuron group
    # ###########################################

    ## two neurons: index 0 will be presynaptic, 1 will be postsynaptic
    network = moose.LIF( 'network', 2 );
    moose.le( '/network' )
    network.vec.Em = Vrest
    network.vec.thresh = Vt_base
    network.vec.refractoryPeriod = refrT
    network.vec.Rm = R
    network.vec.vReset = Vreset
    network.vec.Cm = tau/R
    network.vec.inject = 0.
    network.vec.initVm = Vrest

    #############################################
    # Ca Plasticity parameters: synapses (not for ExcInhNetBase)
    #############################################

    ### Cortical slice values -- Table Suppl 2 in Graupner & Brunel 2012
    ### Also used in Higgins et al 2014
    #tauCa = 22.6936e-3      # s # Ca decay time scale
    #tauSyn = 346.3615       # s # synaptic plasticity time scale
    ### in vitro values in Higgins et al 2014, faster plasticity
    #CaPre = 0.56175         # mM
    #CaPost = 1.2964         # mM
    ### in vivo values in Higgins et al 2014, slower plasticity
    ##CaPre = 0.33705         # mM
    ##CaPost = 0.74378        # mM
    #delayD = 4.6098e-3      # s # CaPre is added to Ca after this delay
                            ## proxy for rise-time of NMDA
    #thetaD = 1.0            # mM # depression threshold for Ca
    #thetaP = 1.3            # mM # potentiation threshold for Ca
    #gammaD = 331.909        # factor for depression term
    #gammaP = 725.085        # factor for potentiation term

    #J = 5e-3 # V            # delta function synapse, adds to Vm
    #weight = 0.43           # initial synaptic weight
                            ## gammaP/(gammaP+gammaD) = eq weight w/o noise
                            ## see eqn (22), noiseSD also appears
                            ## but doesn't work here,
                            ## weights away from 0.4 - 0.5 screw up the STDP rule!!

    #bistable = True        # if bistable is True, use bistable potential for weights
    #noisy = False          # use noisy weight updates given by noiseSD
    #noiseSD = 3.3501        # if noisy, use noiseSD (3.3501 from Higgins et al 2014)

    ########################################

    ## DP STDP curve (Fig 2C) values -- Table Suppl 1 in Graupner & Brunel 2012
    tauCa = 20e-3           # s # Ca decay time scale
    tauSyn = 150.0          # s # synaptic plasticity time scale
    CaPre = 1.0             # arb
    CaPost = 2.0            # arb
    delayD = 13.7e-3        # s # CaPre is added to Ca after this delay
                            # proxy for rise-time of NMDA
    thetaD = 1.0            # mM # depression threshold for Ca
    thetaP = 1.3            # mM # potentiation threshold for Ca
    gammaD = 200.0          # factor for depression term
    gammaP = 321.808        # factor for potentiation term

    J = 5e-3 # V            # delta function synapse, adds to Vm
    weight = 0.5            # initial synaptic weight
                            # gammaP/(gammaP+gammaD) = eq weight w/o noise
                            # see eqn (22), noiseSD also appears
                            # but doesn't work here,
                            # weights away from 0.4 - 0.5 screw up the STDP rule!!

    bistable = True        # if bistable is True, use bistable potential for weights
    noisy = False          # use noisy weight updates given by noiseSD
    noiseSD = 2.8284        # if noisy, use noiseSD (3.3501 in Higgins et al 2014)

    ##########################################

    syn = moose.GraupnerBrunel2012CaPlasticitySynHandler( '/network/syn' )
    syn.numSynapses = 1     # 1 synapse
                            # many pre-synaptic inputs can connect to a synapse
    # synapse onto postsynaptic neuron
    moose.connect( syn, 'activationOut', network.vec[1], 'activation' )
#.........这里部分代码省略.........
开发者ID:dilawar,项目名称:moose-examples,代码行数:101,代码来源:GraupnerBrunel2012_STDPfromCaPlasticity.py


示例16: main

def main():
    cm = ChannelML( {'temperature': 32 })
    cm.readChannelMLFromFile( 'CA1_migliore_reference/hd.xml' )
    cm.readChannelMLFromFile( 'CA1_migliore_reference/kap.xml' )
    cm.readChannelMLFromFile( 'CA1_migliore_reference/kad.xml' )
    cm.readChannelMLFromFile( 'CA1_migliore_reference/kdr.xml' )
    cm.readChannelMLFromFile( 'CA1_migliore_reference/na3.xml' )
    cm.readChannelMLFromFile( 'CA1_migliore_reference/nax.xml' )
    if ( len( sys.argv ) < 2 ):
        print("Usage: ", sys.argv[0], " filename")
        return

    # filename = "./Bhavika_swcplusnmlfiles/preliminarily corrected nmlfiles/ascoli+buzsaki/valid/" + sys.argv[1]
    filename = sys.argv[1]
    moose.Neutral( '/model' )
    # Load in the swc file.
    cell = moose.loadModel( filename, '/model/ca1' )

    for i in moose.wildcardFind( '/library/##' ):
        i.tick = -1

    chanDistrib = [ \
            "EM", "#", "-58e-3", \
            "initVm", "#", "-65e-3", \
            "RM", "#", "2.8", \
            "CM", "#", "0.01", \
            "RA", "#", "1.5", \
            "RA", "#axon#", "0.5", \

            "hd", "#dend#,#apical#", "5e-2*(1+(r*3e4))", \
            "kdr", "#", "100", \
            "na3", "#soma#,#dend#,#apical#", "250", \
            "nax", "#axon#", "1250", \
            "kap", "#axon#,#soma#", "300", \
            "kap", "#dend#,#apical#", "150*(1+sign(100-r*1e6)) * (1+(r*1e4))", \
            "kad", "#dend#,#apical#", "150*(1+sign(r*1e6-100))*(1+r*1e4)", \
            ]
    moose.showfields( cell[0] )
    cell[0].channelDistribution = chanDistrib
    cell[0].parseChanDistrib()
    for i in range( 8 ):
        moose.setClock( i, simdt )
    hsolve = moose.HSolve( '/model/ca1/hsolve' )
    hsolve.dt = simdt
    hsolve.target = '/model/ca1/soma'
    '''
    '''
    moose.reinit()
    makePlot( cell[0] )

    # Now we set up the display
    moose.le( '/model/ca1/soma' )
    soma = moose.element( '/model/ca1/soma' )
    kap = moose.element( '/model/ca1/soma/kap' )

    graphs = moose.Neutral( '/graphs' )
    vtab = moose.Table( '/graphs/vtab' )
    moose.connect( vtab, 'requestOut', soma, 'getVm' )
    kaptab = moose.Table( '/graphs/kaptab' )
    moose.connect( kaptab, 'requestOut', kap, 'getGk' )

    compts = moose.wildcardFind( "/model/ca1/#[ISA=CompartmentBase]" )
    '''
    for i in compts:
        if moose.exists( i.path + '/Na' ):
            print i.path, moose.element( i.path + '/Na' ).Gbar, \
                moose.element( i.path + '/K_DR' ).Gbar, \
                i.Rm, i.Ra, i.Cm
    '''
    '''
    Na = moose.wildcardFind( '/model/ca1/#/Na#' )
    print Na
    Na2 = []
    for i in compts:
        if ( moose.exists( i.path + '/NaF2' ) ):
            Na2.append(  moose.element( i.path + '/NaF2' ) )
        if ( moose.exists( i.path + '/NaPF_SS' ) ):
            Na2.append(  moose.element( i.path + '/NaPF_SS' ) )
    ecomptPath = map( lambda x : x.path, compts )
    print "Na placed in ", len( Na ), len( Na2 ),  " out of ", len( compts ), " compts."
    '''
    compts[0].inject = inject
    ecomptPath = [x.path for x in compts]

    # Graphics stuff here.
    app = QtGui.QApplication(sys.argv)
    morphology = moogli.read_morphology_from_moose(name = "", path = "/model/ca1")
    morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
            [0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 0.0, 0.1] ) 

    viewer = moogli.DynamicMorphologyViewerWidget(morphology)
    def callback( morphology, viewer ):
        moose.start( frameRunTime )
        Vm = [moose.element( x ).Vm for x in compts]
        morphology.set_color( "group_all", Vm )
        currTime = moose.element( '/clock' ).currentTime
        #print currTime, compts[0].Vm
        if ( currTime < runtime ):
            return True
        return False
#.........这里部分代码省略.........
开发者ID:BhallaLab,项目名称:benchmarks,代码行数:101,代码来源:buildCA1Pyr.py


示例17: readMorphML

    def readMorphML(self,cell,params={},lengthUnits="micrometer"):
        """
        returns cellDict = { cellname: (segDict, cableDict) } # note: single cell only
        where segDict = { segid1 : [ segname,(proximalx,proximaly,proximalz),
            (distalx,distaly,distalz),diameter,length,[potential_syn1, ... ] ] , ... }
        segname is "<name>_<segid>" because 1) guarantees uniqueness,
            & 2) later scripts obtain segid from the compartment's name!
        and cableDict = { cablegroupname : [campartment1name, compartment2name, ... ], ... }.
        params is dict which can contain, combineSegments and/or createPotentialSynapses,
         both boolean.
        """
        if lengthUnits in ['micrometer','micron']:
            self.length_factor = 1e-6
        else:
            self.length_factor = 1.0
        cellname = cell.attrib["name"]
        moose.Neutral('/library') # creates /library in MOOSE tree; elif present, wraps
        _logger.info("Loading cell %s into /library ." % cellname)

        #~ moosecell = moose.Cell('/library/'+cellname)
        #using moose Neuron class - in previous version 'Cell' class Chaitanya
        moosecell = moose.Neuron('/library/'+cellname)
        self.cellDictBySegmentId[cellname] = [moosecell,{}]
        self.cellDictByCableId[cellname] = [moosecell,{}]
        self.segDict = {}
        if 'combineSegments' in params:
            self.combineSegments = params['combineSegments']
        else:
            self.combineSegments = False
        if 'createPotentialSynapses' in params:
            self.createPotentialSynapses = params['createPotentialSynapses']
        else:
            self.createPotentialSynapses = False
        _logger.info("readMorphML using combineSegments = %s" % self.combineSegments)

        ###############################################
        #### load cablegroups into a dictionary
        self.cablegroupsDict = {}
        self.cablegroupsInhomoparamsDict = {}
        ## Two ways of specifying cablegroups in neuroml 1.x
        ## <cablegroup>s with list of <cable>s
        cablegroups = cell.findall(".//{"+self.mml+"}cablegroup")
        for cablegroup in cablegroups:
            cablegroupname = cablegroup.attrib['name']
            self.cablegroupsDict[cablegroupname] = []
            self.cablegroupsInhomoparamsDict[cablegroupname] = []
            for cable in cablegroup.findall(".//{"+self.mml+"}cable"):
                cableid = cable.attrib['id']
                self.cablegroupsDict[cablegroupname].append(cableid)
            # parse inhomogenous_params
            for inhomogeneous_param in cablegroup.findall(".//{"+self.mml+"}inhomogeneous_param"):
                metric = inhomogeneous_param.find(".//{"+self.mml+"}metric")
                if metric.text == 'Path Length from root':
                    inhomoparamname = inhomogeneous_param.attrib['name']
                    inhomoparamvar = inhomogeneous_param.attrib['variable']
                    self.cablegroupsInhomoparamsDict[cablegroupname].append(\
                                (inhomoparamname,inhomoparamvar))
                else:
                    _logger.warning('Only "Path Length from root" metric is '
                            ' supported currently, ignoring %s ' % metric.text
                            )

        ## <cable>s with list of <meta:group>s
        cables = cell.findall(".//{"+self.mml+"}cable")
        for cable in cables:
            cableid = cable.attrib['id']
            cablegroups = cable.findall(".//{"+self.meta+"}group")
            for cablegroup in cablegroups:
                cablegroupname = cablegroup.text
                if cablegroupname in self.cablegroupsDict:
                    self.cablegroupsDict[cablegroupname].append(cableid)
                else:
                    self.cablegroupsDict[cablegroupname] = [cableid]

        ###################################################
        ## load all mechanisms in this cell into /library for later copying
        ## set which compartments have integrate_and_fire mechanism
        self.intFireCableIds = {}   # dict with keys as Compartments/cableIds which are IntFire
                                    # with mechanismnames as values
        for mechanism in cell.findall(".//{"+self.bio+"}mechanism"):
            mechanismname = mechanism.attrib["name"]
            passive = False
            if "passive_conductance" in mechanism.attrib:
                if mechanism.attrib['passive_conductance'] in ["true",'True','TRUE']:
                    passive = True
            if not passive:
                ## if channel does not exist in library load it from xml file
                if not moose.exists("/library/"+mechanismname):
                    _logger.info("Loading mechanism %s into library." % mechanismname)
                    cmlR = ChannelML(self.nml_params)
                    model_filename = mechanismname+'.xml'
                    model_path = neuroml_utils.find_first_file(model_filename,self.model_dir)
                    if model_path is not None:
                        cmlR.readChannelMLFromFile(model_path)
                    else:
                        raise IOError(
                            'For mechanism {0}: files {1} not found under {2}.'.format(
                                mechanismname, model_filename, self.model_dir)
                        )

#.........这里部分代码省略.........
开发者ID:hrani,项目名称:moose-core,代码行数:101,代码来源:MorphML.py


示例18: make_network

def make_network():
        size = 1024
        dt = 0.2
        runsteps = 50
        delayMin = 0
        delayMax = 4
        weightMax = 1
        Vmax = 1.0
        thresh = 0.4
        refractoryPeriod = 0.4
        tau = 0.5
        connectionProbability = 0.01
        random.seed( 123 )
        nprand.seed( 456 )
        t0 = time.time()

        network = moose.IntFire( 'network', size );
        syns = moose.SimpleSynHandler( '/network/syns', size );
        moose.connect( syns, 'activationOut', network, 'activation', 'OneToOne' )
        moose.le( '/network' )
        syns.vec.numSynapses = [1] * size
        sv = moose.vec( '/network/syns/synapse' )
        print(('before connect t = ', time.time() - t0))
        mid = moose.connect( network, 'spikeOut', sv, 'addSpike', 'Sparse')
        print(('after connect t = ', time.time() - t0))
        #print mid.destFields
        m2 = moose.element( mid )
        m2.setRandomConnectivity( connectionProbability, 5489 )
        print(('after setting connectivity, t = ', time.time() - t0))
        #network.vec.Vm = [(Vmax*random.random()) for r in range(size)]
        network.vec.Vm = nprand.rand( size ) * Vmax
        network.vec.thresh = thresh
        network.vec.refractoryPeriod = refractoryPeriod
        network.vec.tau = tau
        numSynVec = syns.vec.numSynapses
        print(('Middle of setup, t = ', time.time() - t0))
        numTotSyn = sum( numSynVec )
        print((numSynVec.size, ', tot = ', numTotSyn,  ', numSynVec = ', numSynVec))
        for item in syns.vec:
                sh = moose.element( item )
                sh.synapse.delay = delayMin +  (delayMax - delayMin ) * nprand.rand( len( sh.synapse ) )
                #sh.synapse.delay = [ (delayMin + random.random() * (delayMax - delayMin ) for r in range( len( sh.synapse ) ) ] 
                sh.synapse.weight = nprand.rand( len( sh.synapse ) ) * weightMax
        print(('after setup, t = ', time.time() - t0))

        numStats = 100
        stats = moose.SpikeStats( '/stats', numStats )
        stats.vec.windowLength = 1 # timesteps to put together.
        plots = moose.Table( '/plot', numStats )
        convergence = size / numStats
        for i in range( numStats ):
            for j in range( size/numStats ):
                k = i * convergence + j
                moose.connect( network.vec[k], 'spikeOut', stats.vec[i], 'addSpike' )
        moose.connect( plots, 'requestOut', stats, 'getMean', 'OneToOne' )

        #moose.useClock( 0, '/network/syns,/network', 'process' )
        moose.useClock( 0, '/network/syns', 'process' )
        moose.useClock( 1, '/network', 'process' )
        moose.useClock( 2, '/stats', 'process' )
        moose.useClock( 3, '/plot', 'process' )
        moose.setClock( 0, dt )
        moose.setClock( 1, dt )
        moose.setClock( 2, dt )
        moose.setClock( 3, dt )
        moose.setClock( 9, dt )
        t1 = time.time()
        moose.reinit()
        print(('reinit time t = ', time.time() - t1))
        network.vec.Vm = nprand.rand( size ) * Vmax
        print(('setting Vm , t = ', time.time() - t1))
        t1 = time.time()
        print('starting')
        moose.start(runsteps * dt)
        print(('runtime, t = ', time.time() - t1))
        print((network.vec.Vm[99:103], network.vec.Vm[900:903]))
        t = [i * dt for i in range( plots.vec[0].vector.size )]
        i = 0
        for p in plots.vec:
            pylab.plot( t, p.vector, label=str( i) )
            i += 1
        pylab.xlabel( "Time (s)" )
        pylab.ylabel( "Vm (mV)" )
        pylab.legend()
        pylab.show()
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:85,代码来源:recurrentIntFire.py


示例19: ExcInhNetBase

    viewer.attach_shapes(list(lifs.shapes.values()))
    # print "Attached Shapes"
    view = moogli.View("view")
    viewer.attach_view(view)
    # print "Attached View"
    return viewer

if __name__=='__main__':
    plt.ion()
    ## ExcInhNetBase has unconnected neurons,
    ## ExcInhNet connects them
    ## Instantiate either ExcInhNetBase or ExcInhNet below
    #net = ExcInhNetBase(N=N)
    net = ExcInhNet(N=N)
    print(net)
    moose.le( '/' )
    moose.le( '/network' )
    rdes = buildRdesigneur()
    rdes.buildModel( '/model' )
    buildNeuronPlots( rdes )
    connectDetailedNeuron()

    app = QtGui.QApplication(sys.argv)
    viewer = create_viewer(rdes)
    viewer.showMaximized()
    viewer.start()
    app.exec_()

    ## Important to distribute the initial Vm-s
    ## else weak coupling gives periodic synchronous firing
    plotif = True
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:31,代码来源:Fig6BCDE.py


示例20: make_network

该文章已有0人参与评论

请发表评论

全部评论

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