本文整理汇总了Python中moose.le函数的典型用法代码示例。如果您正苦于以下问题:Python le函数的具体用法?Python le怎么用?Python le使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了le函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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' )
示例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()
示例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' )
示例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
示例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')
示例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")
示例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
示例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()
示例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")
示例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_()
示例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
示例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
示例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_()
示例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 )
示例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' )
#.........这里部分代码省略.........