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


Python moose.start函数代码示例

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


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

示例1: testNeuroMeshMultiscale

def testNeuroMeshMultiscale():
        useHsolve = 1
        runtime = 0.5
        if useHsolve:
	    elecDt = 50e-6
        else:
	    elecDt = 10e-6
	chemDt = 0.005
	ePlotDt = 0.5e-3
	cPlotDt = 0.005
	plotName = 'nm.plot'

	makeNeuroMeshModel()
	print "after model is completely done"
	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb

	makeChemPlots()
	makeElecPlots()
	makeCaPlots()
	moose.setClock( 0, elecDt )
	moose.setClock( 1, elecDt )
	moose.setClock( 2, elecDt )
	moose.setClock( 4, chemDt )
	moose.setClock( 5, chemDt )
	moose.setClock( 6, chemDt )
	moose.setClock( 7, cPlotDt )
	moose.setClock( 8, ePlotDt )
        if useHsolve:
	    hsolve = moose.HSolve( '/model/elec/hsolve' )
	    moose.useClock( 1, '/model/elec/hsolve', 'process' )
	    hsolve.dt = elecDt
	    hsolve.target = '/model/elec/compt'
	    moose.reinit()
        else:
	    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
	    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
	    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')

	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
	moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
	moose.useClock( 4, '/model/chem/#/ksolve', 'init' )
	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
	moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
	moose.useClock( 7, '/graphs/chem/#', 'process' )
	moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
        moose.element( '/model/elec/soma' ).inject = 2e-10
        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
	moose.reinit()

	moose.start( runtime )
#        moose.element( '/model/elec/soma' ).inject = 0
#	moose.start( 0.25 )
        makeGraphics( cPlotDt, ePlotDt )
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:60,代码来源:multi3.py

示例2: make_neuron_spike

 def make_neuron_spike(nrnidx,I=1e-7,duration=1e-3):
     """ Inject a brief current pulse to
     make a neuron spike
     """
     network.vec[nrnidx].inject = I
     moose.start(duration)
     network.vec[nrnidx].inject = 0.
开发者ID:dilawar,项目名称:moose-examples,代码行数:7,代码来源:GraupnerBrunel2012_STDPfromCaPlasticity.py

示例3: run

def run(nogui):
    
    reader = NML2Reader(verbose=True)

    filename = 'test_files/NML2_SingleCompHHCell.nml'
    print('Loading: %s'%filename)
    reader.read(filename, symmetric=True)
    
    
    msoma = reader.getComp(reader.doc.networks[0].populations[0].id,0,0)
    print(msoma)
    
    
    data = moose.Neutral('/data')
    
    pg = reader.getInput('pulseGen1')
    
    inj = moose.Table('%s/pulse' % (data.path))
    moose.connect(inj, 'requestOut', pg, 'getOutputValue')
    
    
    vm = moose.Table('%s/Vm' % (data.path))
    moose.connect(vm, 'requestOut', msoma, 'getVm')
    
    simdt = 1e-6
    plotdt = 1e-4
    simtime = 300e-3
    #moose.showmsg( '/clock' )
    for i in range(8):
        moose.setClock( i, simdt )
    moose.setClock( 8, plotdt )
    moose.reinit()
    moose.start(simtime)
    
    print("Finished simulation!")
    
    t = np.linspace(0, simtime, len(vm.vector))
    
    if not nogui:
        import matplotlib.pyplot as plt

        vfile = open('moose_v_hh.dat','w')

        for i in range(len(t)):
            vfile.write('%s\t%s\n'%(t[i],vm.vector[i]))
        vfile.close()
        plt.subplot(211)
        plt.plot(t, vm.vector * 1e3, label='Vm (mV)')
        plt.legend()
        plt.title('Vm')
        plt.subplot(212)
        plt.title('Input')
        plt.plot(t, inj.vector * 1e9, label='injected (nA)')
        #plt.plot(t, gK.vector * 1e6, label='K')
        #plt.plot(t, gNa.vector * 1e6, label='Na')
        plt.legend()
        plt.figure()
        test_channel_gates()
        plt.show()
        plt.close()
开发者ID:hrani,项目名称:moose-core,代码行数:60,代码来源:run_hhcell.py

示例4: singleCompt

def singleCompt( name, params ):
    mod = moose.copy( '/library/' + name + '/' + name, '/model' )
    A = moose.element( mod.path + '/A' )
    Z = moose.element( mod.path + '/Z' )
    Z.nInit = 1
    Ca = moose.element( mod.path + '/Ca' )
    CaStim = moose.element( Ca.path + '/CaStim' )
    runtime = params['preStimTime'] + params['stimWidth'] + params['postStimTime'] 
    steptime = 100

    CaStim.expr += ' + x2 * (t > ' + str( runtime ) + ' ) * ( t < ' + str( runtime + steptime ) +  ' )'
    print(CaStim.expr)
    tab = moose.Table2( '/model/' + name + '/Atab' )
    #for i in range( 10, 19 ):
        #moose.setClock( i, 0.01 )
    ampl = moose.element( mod.path + '/ampl' )
    phase = moose.element( mod.path + '/phase' )
    moose.connect( tab, 'requestOut', A, 'getN' )
    ampl.nInit = params['stimAmplitude'] * 1
    phase.nInit = params['preStimTime']

    ksolve = moose.Ksolve( mod.path + '/ksolve' )
    stoich = moose.Stoich( mod.path + '/stoich' )
    stoich.compartment = mod
    stoich.ksolve = ksolve
    stoich.path = mod.path + '/##'
    runtime += 2 * steptime

    moose.reinit()
    moose.start( runtime )
    t = np.arange( 0, runtime + 1e-9, tab.dt )
    return name, t, tab.vector
开发者ID:dilawar,项目名称:moose-examples,代码行数:32,代码来源:Fig2_v4.py

示例5: run_LIF

def run_LIF():
	## reset and run the simulation
	print("Reinit MOOSE.")
	## from moose_utils.py sets clocks and resets
	resetSim(['/cells[0]'], SIMDT, PLOTDT, simmethod='ee')
	print("Running now...")
	moose.start(RUNTIME)
开发者ID:dilawar,项目名称:moose-examples,代码行数:7,代码来源:LIFxml_firing.py

示例6: main

def main():
    """ This example illustrates loading, running of an SBML model defined in XML format.\n
	The model 00001-sbml-l3v1.xml is taken from l3v1 SBML testcase.\n
	Plots are setup.\n
	Model is run for 20sec.\n
	As a general rule we created model under '/path/model' and plots under '/path/graphs'.\n
    """

    mfile =  os.path.join( script_dir, 'chem_models/00001-sbml-l3v1.xml')
    runtime = 20.0
        
    # Loading the sbml file into MOOSE, models are loaded in path/model
    sbmlId = moose.readSBML(mfile,'sbml')
    

    s1 = moose.element('/sbml/model/compartment/S1')
    s2= moose.element('/sbml/model/compartment/S2')
                      
    # Creating MOOSE Table, Table2 is for the chemical model
    graphs = moose.Neutral( '/sbml/graphs' )
    outputs1 = moose.Table2 ( '/sbml/graphs/concS1')
    outputs2 = moose.Table2 ( '/sbml/graphs/concS2')

    # connect up the tables
    moose.connect( outputs1,'requestOut', s1, 'getConc' );
    moose.connect( outputs2,'requestOut', s2, 'getConc' );

        
    # Reset and Run
    moose.reinit()
    moose.start(runtime)
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:31,代码来源:test_sbml_support.py

示例7: run_sim_parallel

def run_sim_parallel(passive=True, solver='hsolve'):
    data_info_list = []
    model_info_list = []
    for jj, ti in enumerate(intervals):
        for ii, st in enumerate(stim_order):
            experiment_name = 'expt_%d_%d' % (jj, ii)
            dinfo, minfo = setup_experiment(experiment_name, st, tonset, ti, passive=passive, solver=solver)
            data_info_list.append(dinfo)
            model_info_list.append(minfo)
    mutils.setDefaultDt(elecdt=simdt)
    mutils.assignDefaultTicks()
    moose.reinit()
    moose.start(tstop)
    print('$$$$$$$$$$$', moose.element('/clock'    ).currentTime)
    axes_vm = fig.add_subplot(111)
    # axes_vm_out = fig.add_subplot(121)
    # axes_vm_in = fig.add_subplot(122, sharex=axes_vm_out, sharey=axes_vm_out)
    ################
    # axes_vm = fig.add_subplot(311)
    # axes_nmda = fig.add_subplot(312)
    # axes_ampa = fig.add_subplot(313)
    for jj, ti in enumerate(intervals):
        for ii, st in enumerate(stim_order):
            dinfo = data_info_list[jj * len(stim_order) + ii]
            print('Interval=', ti, 'Stim order=', st)
            print('dinfo:', dinfo)
            print(dinfo['soma_vm'])
            print(dinfo['soma_vm'].vector)
            v = dinfo['soma_vm'].vector
            t = np.linspace(0, tstop, len(v))
            print('num points=', len(t), 't0=', t[0], 't_last=', t[-1], 'v0=', v[0], 'v_last=', v[-1])
开发者ID:hrani,项目名称:moose-core,代码行数:31,代码来源:rc19.py

示例8: resetAndStartSimulation

 def resetAndStartSimulation(self):
     """TODO this should provide a clean scheduling through all kinds
     of simulation or default scheduling should be implemented in MOOSE
     itself. We need to define a policy for handling scheduling. It can
     be pushed to the plugin-developers who should have knowledge of
     the scheduling criteria for their domain."""
     settings = config.MooseSetting()
     try:
         simdt_kinetics = float(settings[config.KEY_KINETICS_SIMDT])
     except ValueError:
         simdt_kinetics = 0.1
     try:
         simdt_electrical = float(settings[config.KEY_ELECTRICAL_SIMDT])
     except ValueError:
         simdt_electrical = 0.25e-4
     try:
         plotdt_kinetics = float(settings[config.KEY_KINETICS_PLOTDT])
     except ValueError:
         plotdt_kinetics = 0.1
     try:
         plotdt_electrical = float(settings[config.KEY_ELECTRICAL_PLOTDT])
     except ValueError:
         plotdt_electrical = 0.25e-3
     try:
         simtime = float(settings[config.KEY_SIMTIME])
     except ValueError:
         simtime = 1.0
     moose.reinit()
     view = self.plugin.getRunView()
     moose.start(simtime)
     if view.getCentralWidget().plotAll:
         view.getCentralWidget().plotAllData()
     self.setCurrentView('run')        
开发者ID:Vivek-sagar,项目名称:moose-1,代码行数:33,代码来源:mgui.py

示例9: continueSimulation

 def continueSimulation(self):
     """TODO implement this somewhere else"""
     try:
         simtime = float(config.MooseSetting()[config.KEY_SIMTIME])
     except ValueError:
         simtime = 1.0
     moose.start(simtime)      
开发者ID:Vivek-sagar,项目名称:moose-1,代码行数:7,代码来源:mgui.py

示例10: main

def main():
    """
    A toy compartmental neuronal + chemical model that causes bad things
    to happen to the hsolver, as of 28 May 2013. Hopefully this will
    become irrelevant soon.
    """
    fineDt = 1e-5
    coarseDt = 5e-5
    make_spiny_compt()
    make_plots()
    for i in range( 8 ):
        moose.setClock( i, fineDt )
    moose.setClock( 8, coarseDt )
    moose.reinit()
    moose.start( 0.1 )
    display_plots( 'instab.plot' )
    # make Hsolver and rerun
    hsolve = moose.HSolve( '/n/hsolve' )
    for i in range( 8 ):
        moose.setClock( i, coarseDt )
    hsolve.dt = coarseDt
    hsolve.target = '/n/compt'
    moose.reinit()
    moose.start( 0.1 )
    display_plots( 'h_instab.plot' )
    pylab.show()
开发者ID:asiaszmek,项目名称:moose,代码行数:26,代码来源:HsolveInstability.py

示例11: test_crossing_single

def test_crossing_single():
    """This function creates an ematrix of two PulseGen elements and
    another ematrix of two Table elements.

    The two pulsegen elements have same amplitude but opposite phase.

    Table[0] is connected to PulseGen[1] and Table[1] to Pulsegen[0].

    In the plot you should see two square pulses of opposite phase.

    """
    size = 2
    pg = moose.PulseGen('pulsegen', size)
    for ix, ii in enumerate(pg.vec):
        pulse = moose.element(ii)
        pulse.delay[0] = 1.0
        pulse.width[0] = 2.0
        pulse.level[0] = (-1)**ix
    tab = moose.Table('table', size)
    moose.connect(tab.vec[0], 'requestOut', pg.vec[1], 'getOutputValue', 'Single')
    moose.connect(tab.vec[1], 'requestOut', pg.vec[0], 'getOutputValue', 'Single')
    print 'Neighbors:'
    for t in tab.vec:
        print t.path
        for n in moose.element(t).neighbors['requestOut']:
            print 'requestOut <-', n.path
    moose.setClock(0, 0.1)
    moose.useClock(0, '/##', 'process')
    moose.start(5)
    for ii in tab.vec:
        t = moose.Table(ii).vector
        print len(t)
        pylab.plot(t)
    pylab.show()
开发者ID:csiki,项目名称:MOOSE,代码行数:34,代码来源:singlemsgcross.py

示例12: main

def main():
		makeModel()
                '''
                '''
		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
		stoich = moose.Stoich( '/model/compartment/stoich' )
		stoich.compartment = moose.element( '/model/compartment' )
		stoich.ksolve = ksolve
		stoich.path = "/model/compartment/##"
		#solver.method = "rk5"
		#mesh = moose.element( "/model/compartment/mesh" )
		#moose.connect( mesh, "remesh", solver, "remesh" )
                '''
		moose.setClock( 5, 1.0 ) # clock for the solver
		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
                '''

		moose.reinit()
		moose.start( 100.0 ) # Run the model for 100 seconds.
                func = moose.element( '/model/compartment/d/func' )
                if useY:
                    func.expr = "-y0 + 10*y1"
                else:
                    func.expr = "-x0 + 10*x1"
		moose.start( 100.0 ) # Run the model for 100 seconds.
                #moose.showfields( '/model/compartment/d' )
                #moose.showfields( '/model/compartment/d/func' )
                print func.x.value
                print moose.element( '/model/compartment/b' ).n

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

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

示例13: main

def main():
	"""
	This snippet shows the use of several objects.
	This snippet sets up a StimulusTable to control a RandSpike which
	sends its outputs to two places: to a SimpleSynHandler on an IntFire,
	which is used to monitor spike arrival, and to various Stats objects.
    Each of these are recorded and plotted.
	The StimulusTable has a sine-wave waveform.
	"""
        make_model()

        moose.reinit()
        moose.start( runtime )
        plots = moose.element( '/plots' )
        plot1 = moose.element( '/plot1' )
        plot2 = moose.element( '/plot2' )
        plotf = moose.element( '/plotf' )
        t = [i * dt for i in range( plot1.vector.size )]
        pylab.plot( t, plots.vector, label='stimulus' )
        pylab.plot( t, plot1.vector, label='spike rate mean' )
        pylab.plot( t, plot2.vector, label='Vm mean' )
        pylab.plot( t, plotf.vector, label='Vm' )
        pylab.legend()
        pylab.show()

	'''
开发者ID:asiaszmek,项目名称:moose,代码行数:26,代码来源:RandSpikeStats.py

示例14: testCubeMultiscale

def testCubeMultiscale( useSolver ):
    elecDt = 10e-6
    chemDt = 1e-4
    plotDt = 5e-4
    plotName = 'mc.plot'
    if ( useSolver ):
        elecDt = 50e-6
        chemDt = 2e-3
        plotName = 'mcs.plot'
    makeCubeMultiscale()

    makeChemPlots()
    makeElecPlots()
    moose.setClock( 0, elecDt )
    moose.setClock( 1, elecDt )
    moose.setClock( 2, elecDt )
    moose.setClock( 5, chemDt )
    moose.setClock( 6, chemDt )
    moose.setClock( 7, plotDt )
    moose.setClock( 8, plotDt )
    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
    moose.useClock( 1, '/model/elec/##[ISA=Compartment],/model/elec/##[ISA=SpikeGen]', 'process' )
    moose.useClock( 2, '/model/elec/##[ISA=SynBase],/model/elec/##[ISA=ChanBase],/model/elec/##[ISA=CaConc]','process')
    moose.useClock( 5, '/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
    moose.useClock( 6, '/model/##[ISA=PoolBase],/model/chem/##[ISA=Adaptor]', 'process' )
    moose.useClock( 7, '/graphs/#', 'process' )
    moose.useClock( 8, '/graphs/elec/#', 'process' )
    if ( useSolver ):
        makeSolvers( elecDt )
    moose.reinit()
    moose.start( 1.0 )
    dumpPlots( plotName )
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:32,代码来源:multiComptSigNeur.py

示例15: loadAndRun

def loadAndRun(solver=True):
    simtime = 500e-3
    model = moose.loadModel('../data/h10.CNG.swc', '/cell')
    comp = moose.element('/cell/apical_e_177_0')
    soma = moose.element('/cell/soma')
    for i in range(10):
        moose.setClock(i, dt)
    if solver:
        solver = moose.HSolve('/cell/solver')
        solver.target = soma.path
        solver.dt = dt
    stim = moose.PulseGen('/cell/stim')
    stim.delay[0] = 50e-3
    stim.delay[1] = 1e9
    stim.level[0] = 1e-9
    stim.width[0] = 2e-3    
    moose.connect(stim, 'output', comp, 'injectMsg')
    tab = moose.Table('/cell/Vm')
    moose.connect(tab, 'requestOut', comp, 'getVm')
    tab_soma = moose.Table('/cell/Vm_soma')
    moose.connect(tab_soma, 'requestOut', soma, 'getVm')
    moose.reinit()
    print('[INFO] Running for %s' % simtime)
    moose.start(simtime )
    vec = tab_soma.vector 
    moose.delete( '/cell' )
    return vec
开发者ID:rahulgayatri23,项目名称:moose-core,代码行数:27,代码来源:issue_93.py


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