本文整理汇总了Python中moose.start函数的典型用法代码示例。如果您正苦于以下问题:Python start函数的具体用法?Python start怎么用?Python start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: run_single_channel
def run_single_channel(channelname, Gbar, simtime, simdt=testutils.SIMDT, plotdt=testutils.PLOTDT):
testId = uuid.uuid4().int
container = moose.Neutral('test%d' % (testId))
model_container = moose.Neutral('%s/model' % (container.path))
data_container = moose.Neutral('%s/data' % (container.path))
params = testutils.setup_single_compartment(
model_container, data_container,
channelbase.prototypes[channelname],
Gbar)
vm_data = params['Vm']
gk_data = params['Gk']
ik_data = params['Ik']
testutils.setup_clocks(simdt, plotdt)
testutils.assign_clocks(model_container, data_container)
moose.reinit()
print 'Starting simulation', testId, 'for', simtime, 's'
moose.start(simtime)
print 'Finished simulation'
vm_file = 'data/%s_Vm.dat' % (channelname)
gk_file = 'data/%s_Gk.dat' % (channelname)
ik_file = 'data/%s_Ik.dat' % (channelname)
tseries = np.array(range(len(vm_data.vec))) * simdt
print 'Vm:', len(vm_data.vec), 'Gk', len(gk_data.vec), 'Ik', len(ik_data.vec)
data = np.c_[tseries, vm_data.vec]
np.savetxt(vm_file, data)
print 'Saved Vm in', vm_file
print len(gk_data.vec), len(vm_data.vec)
data = np.c_[tseries, gk_data.vec]
np.savetxt(gk_file, data)
print 'Saved Gk in', gk_file
data = np.c_[tseries, ik_data.vec]
np.savetxt(ik_file, data)
print 'Saved Gk in', ik_file
return params
开发者ID:OpenSourceBrain,项目名称:Thalamocortical,代码行数:34,代码来源:channel_test_util.py
示例17: main
def main():
"""
This example illustrates loading, and running a kinetic model
for a bistable positive feedback system, defined in kkit format.
This is based on Bhalla, Ram and Iyengar, Science 2002.
The core of this model is a positive feedback loop comprising of
the MAPK cascade, PLA2, and PKC. It receives PDGF and Ca2+ as
inputs.
This model is quite a large one and due to some stiffness in its
equations, it runs somewhat slowly.
The simulation illustrated here shows how the model starts out in
a state of low activity. It is induced to 'turn on' when a
a PDGF stimulus is given for 400 seconds.
After it has settled to the new 'on' state, model is made to
'turn off'
by setting the system calcium levels to zero for a while. This
is a somewhat unphysiological manipulation!
"""
solver = "gsl" # Pick any of gsl, gssa, ee..
#solver = "gssa" # Pick any of gsl, gssa, ee..
mfile = '../../genesis/acc35.g'
runtime = 2000.0
if ( len( sys.argv ) == 2 ):
solver = sys.argv[1]
modelId = moose.loadModel( mfile, 'model', solver )
# Increase volume so that the stochastic solver gssa
# gives an interesting output
compt = moose.element( '/model/kinetics' )
compt.volume = 5e-19
moose.reinit()
moose.start( 500 )
moose.element( '/model/kinetics/PDGFR/PDGF' ).concInit = 0.0001
moose.start( 400 )
moose.element( '/model/kinetics/PDGFR/PDGF' ).concInit = 0.0
moose.start( 2000 )
moose.element( '/model/kinetics/Ca' ).concInit = 0.0
moose.start( 500 )
moose.element( '/model/kinetics/Ca' ).concInit = 0.00008
moose.start( 2000 )
# Display all plots.
img = mpimg.imread( 'mapkFB.png' )
fig = plt.figure( figsize=(12, 10 ) )
png = fig.add_subplot( 211 )
imgplot = plt.imshow( img )
ax = fig.add_subplot( 212 )
x = moose.wildcardFind( '/model/#graphs/conc#/#' )
t = numpy.arange( 0, x[0].vector.size, 1 ) * x[0].dt
ax.plot( t, x[0].vector, 'b-', label=x[0].name )
ax.plot( t, x[1].vector, 'c-', label=x[1].name )
ax.plot( t, x[2].vector, 'r-', label=x[2].name )
ax.plot( t, x[3].vector, 'm-', label=x[3].name )
plt.ylabel( 'Conc (mM)' )
plt.xlabel( 'Time (seconds)' )
pylab.legend()
pylab.show()
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:60,代码来源:mapkFB.py
示例18: run_model_fig7
def run_model_fig7(chans_1, chans_2, chans_3):
to_run = simtime
delta_t = 0.25 * tau
for ii in range(0, len(chans_1), 2):
print(ii)
print('-----------------')
chans_1[ii].Gk = 1 / Rm
chans_1[ii+1].Gk = 1 / Rm
chans_2[-ii-1].Gk = 1 / Rm
chans_2[-ii-2].Gk = 1 / Rm
for chan in chans_3:
chan.Gk = 0.25 / Rm
for chan in chans_1:
print(chan.Gk, end=' ')
print()
for chan in chans_2:
print(chan.Gk, end=' ')
print()
moose.start(delta_t)
for chan in chans_1:
chan.Gk = 0.0
for chan in chans_2:
chan.Gk = 0.0
to_run = to_run - delta_t
for chan in chans_3:
chan.Gk = 0.0
moose.start(to_run)
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:28,代码来源:rall64.py
示例19: loadGran98NeuroML_L123
def loadGran98NeuroML_L123(filename):
neuromlR = NeuroML()
populationDict, projectionDict = \
neuromlR.readNeuroMLFromFile(filename)
soma_path = populationDict['Gran'][1][0].path+'/Soma_0'
somaVm = setupTable('somaVm',moose.Compartment(soma_path),'Vm')
somaCa = setupTable('somaCa',moose.CaConc(soma_path+'/Gran_CaPool_98'),'Ca')
somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk')
## Am not able to plot KDr gating variable X when running under hsolve
#KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
print "Reinit MOOSE ... "
resetSim(['/elec',cells_path], simdt, plotdt, simmethod='hsolve')
print "Running ... "
moose.start(runtime)
tvec = arange(0.0,runtime*2.0,plotdt)
tvec = tvec[ : somaVm.vector.size ]
plot(tvec,somaVm.vector)
title('Soma Vm')
xlabel('time (s)')
ylabel('Voltage (V)')
figure()
plot(tvec,somaCa.vector)
title('Soma Ca')
xlabel('time (s)')
ylabel('Ca conc (mol/m^3)')
figure()
plot(tvec,somaIKCa.vector)
title('soma KCa current')
xlabel('time (s)')
ylabel('KCa current (A)')
print "Showing plots ..."
show()
开发者ID:csiki,项目名称:MOOSE,代码行数:34,代码来源:Granule98_hsolve.py
示例20: test
def test():
global finish_all_
os.environ['MOOSE_STREAMER_ADDRESS'] = 'http://127.0.0.1:%d'%port_
done = mp.Value('d', 0)
q = mp.Queue()
client = mp.Process(target=socket_client, args=(q, done))
client.start()
time.sleep(0.1)
print( '[INFO] Socket client is running now' )
ts = models.simple_model_a()
moose.reinit()
time.sleep(0.1)
# If TCP socket is created, some delay is often neccessary before start. Don't
# know why. probably some latency in a fresh TCP socket. A TCP guru can
# tell.
moose.start(50)
print( 'MOOSE is done' )
time.sleep(0.5)
done.value = 1
res = q.get()
client.join()
if not res:
raise RuntimeWarning('Nothing was streamed')
for k in res:
a = res[k][1::2]
b = moose.element(k).vector
print(k, len(a), len(b))
assert( (a==b).all())
print( 'Test 1 passed' )
开发者ID:hrani,项目名称:moose-core,代码行数:33,代码来源:testDisabled_socket_streamer_tcp.py
注:本文中的moose.start函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论