本文整理汇总了Python中moose.delete函数的典型用法代码示例。如果您正苦于以下问题:Python delete函数的具体用法?Python delete怎么用?Python delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _addSpine
def _addSpine( self, parent, spineProto, pos, angle, x, y, z, size, k ):
spine = moose.copy( spineProto, parent.parent, 'spine' + str(k) )
kids = spine[0].children
coords = []
ppos = np.array( [parent.x0, parent.y0, parent.z0] )
for i in kids:
#print i.name, k
j = i[0]
j.name += str(k)
#print 'j = ', j
coords.append( [j.x0, j.y0, j.z0] )
coords.append( [j.x, j.y, j.z] )
self._scaleSpineCompt( j, size )
moose.move( i, self.elecid )
origin = coords[0]
#print 'coords = ', coords
# Offset it so shaft starts from surface of parent cylinder
origin[0] -= parent.diameter / 2.0
coords = np.array( coords )
coords -= origin # place spine shaft base at origin.
rot = np.array( [x, [0,0,0], [0,0,0]] )
coords = np.dot( coords, rot )
moose.delete( spine )
moose.connect( parent, "raxial", kids[0], "axial" )
self._reorientSpine( kids, coords, ppos, pos, size, angle, x, y, z )
示例2: saveAndClearPlots
def saveAndClearPlots( name ):
print 'saveAndClearPlots( ', name, ' )'
for i in moose.wildcardFind( "/graphs/#" ):
#print i
#plot stuff
i.xplot( name + '.xplot', i.name )
moose.delete( "/graphs" )
示例3: 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
示例4: buildModel
def buildModel( self, modelPath ):
if not moose.exists( '/library' ):
library = moose.Neutral( '/library' )
if moose.exists( modelPath ):
print "rdesigneur::buildModel: Build failed. Model '", \
modelPath, "' already exists."
return
self.model = moose.Neutral( modelPath )
try:
self.buildCellProto()
self.buildChanProto()
self.buildSpineProto()
self.buildChemProto()
# Protos made. Now install the elec and chem protos on model.
self.installCellFromProtos()
# Now assign all the distributions
self.buildPassiveDistrib()
self.buildChanDistrib()
self.buildSpineDistrib()
self.buildChemDistrib()
self._configureSolvers()
self.buildAdaptors()
self._configureClocks()
self._printModelStats()
except BuildError, msg:
print "Error: rdesigneur: model build failed: ", msg
moose.delete( self.model )
示例5: main
def main( runTime ):
try:
moose.delete('/acc92')
print("Deleted old model")
except Exception as e:
print("Could not clean. model not loaded yet")
moose.loadModel('acc92_caBuff.g',loadpath,'gsl')
ca = moose.element(loadpath+'/kinetics/Ca')
pr = moose.element(loadpath+'/kinetics/protein')
clockdt = moose.Clock('/clock').dts
moose.setClock(8, 0.1)#simdt
moose.setClock(18, 0.1)#plotdt
print clockdt
print " \t \t simdt ", moose.Clock('/clock').dts[8],"plotdt ",moose.Clock('/clock').dts[18]
ori = ca.concInit
tablepath = loadpath+'/kinetics/Ca'
tableele = moose.element(tablepath)
table = moose.Table2(tablepath+'.con')
x = moose.connect(table, 'requestOut', tablepath, 'getConc')
tablepath1 = loadpath+'/kinetics/protein'
tableele1 = moose.element(tablepath1)
table1 = moose.Table2(tablepath1+'.con')
x1 = moose.connect(table1, 'requestOut', tablepath1, 'getConc')
ca.concInit = ori
print("[INFO] Running for 4000 with Ca.conc %s " % ca.conc)
moose.start(4000)
ca.concInit = 5e-03
print("[INFO] Running for 20 with Ca.conc %s " % ca.conc)
moose.start(20)
ca.concInit = ori
moose.start( runTime ) #here give the interval time
ca.concInit = 5e-03
print("[INFO] Running for 20 with Ca.conc %s " % ca.conc)
moose.start(20)
ca.concInit = ori
print("[INFO] Running for 2000 with Ca.conc %s " % ca.conc)
moose.start(2000)
pylab.figure()
pylab.subplot(2, 1, 1)
t = numpy.linspace(0.0, moose.element("/clock").runTime, len(table.vector)) # sec
pylab.plot( t, table.vector, label="Ca Conc (interval- 8000s)" )
pylab.legend()
pylab.subplot(2, 1, 2)
t1 = numpy.linspace(0.0, moose.element("/clock").runTime, len(table1.vector)) # sec
pylab.plot( t1, table1.vector, label="Protein Conc (interval- 8000s)" )
pylab.legend()
pylab.savefig( os.path.join( dataDir, '%s_%s.png' % (table1.name, runTime) ) )
print('[INFO] Saving data to csv files in %s' % dataDir)
tabPath1 = os.path.join( dataDir, '%s_%s.csv' % (table.name, runTime))
numpy.savetxt(tabPath1, numpy.matrix([t, table.vector]).T, newline='\n')
tabPath2 = os.path.join( dataDir, '%s_%s.csv' % (table1.name, runTime) )
numpy.savetxt(tabPath2, numpy.matrix([t1, table1.vector]).T, newline='\n')
示例6: main
def main():
global synSpineList
global synDendList
numpy.random.seed( 1234 )
rdes = buildRdesigneur( )
for i in elecFileNames:
print(i)
rdes.cellProtoList = [ ['./cells/' + i, 'elec'] ]
rdes.buildModel( )
assert( moose.exists( '/model' ) )
synSpineList = moose.wildcardFind( "/model/elec/#head#/glu,/model/elec/#head#/NMDA" )
temp = set( moose.wildcardFind( "/model/elec/#/glu,/model/elec/#/NMDA" ) )
synDendList = list( temp - set( synSpineList ) )
moose.reinit()
buildPlots( rdes )
# Run for baseline, tetanus, and post-tetanic settling time
t1 = time.time()
probeStimulus( baselineTime )
tetanicStimulus( tetTime )
probeStimulus( postTetTime )
print(('real time = ', time.time() - t1))
printPsd( i + ".fig5" )
saveAndClearPlots( i + ".fig5" )
moose.delete( '/model' )
rdes.elecid = moose.element( '/' )
示例7: main
def main():
global synSpineList
global synDendList
numpy.random.seed( 1234 )
rdes = buildRdesigneur()
for i in elecFileNames:
print(i)
rdes.cellProtoList = [ ['./cells/' + i, 'elec'] ]
rdes.buildModel( '/model' )
rdes.soma.inject = inject
assert( moose.exists( '/model' ) )
synSpineList = moose.wildcardFind( "/model/elec/#head#/glu,/model/elec/#head#/NMDA" )
temp = set( moose.wildcardFind( "/model/elec/#/glu,/model/elec/#/NMDA" ) )
synDendList = list( temp - set( synSpineList ) )
print("[INFO] reinitialzing")
moose.reinit()
buildPlots( rdes )
# Run for baseline, tetanus, and post-tetanic settling time
t1 = time.time()
moose.start( runtime )
print('runtime = ', runtime, '; real time = ', time.time() - t1)
saveAndClearPlots( "bigElec" )
moose.delete( '/model' )
rdes.elecid = moose.element( '/' )
示例8: updateDisplay
def updateDisplay():
makeYmodel()
tabvec = moose.wildcardFind( '/model/graphs/plot#' )
moose.element( '/model/elec/' ).name = 'Y'
vecYdend = moose.wildcardFind( '/model/Y/soma,/model/Y/dend#' )
vecYbranch1 = moose.wildcardFind( '/model/Y/branch1#' )
vecYbranch2 = moose.wildcardFind( '/model/Y/branch2#' )
moose.reinit()
dt = interval1
currtime = 0.0
for i in lines:
moose.start( dt )
currtime += dt
#print "############## NumDendData = ", len( vecYdend )
i.YdendLines.set_ydata( [v.Vm*1000 for v in vecYdend] )
i.Ybranch1Lines.set_ydata( [v.Vm*1000 for v in vecYbranch1] )
i.Ybranch2Lines.set_ydata( [v.Vm*1000 for v in vecYbranch2] )
dt = interval2
moose.start( runtime - currtime )
#print "############## len (tabvec) = ", len( tabvec[0].vector )
for i, tab in zip( tplot, tabvec ):
i.set_ydata( tab.vector * 1000 )
moose.delete( '/model' )
moose.delete( '/library' )
示例9: transformNMDAR
def transformNMDAR( path ):
for i in moose.wildcardFind( path + "/##/#NMDA#[ISA!=NMDAChan]" ):
chanpath = i.path
pa = i.parent
i.name = '_temp'
if ( chanpath[-3:] == "[0]" ):
chanpath = chanpath[:-3]
nmdar = moose.NMDAChan( chanpath )
sh = moose.SimpleSynHandler( chanpath + '/sh' )
moose.connect( sh, 'activationOut', nmdar, 'activation' )
sh.numSynapses = 1
sh.synapse[0].weight = 1
nmdar.Ek = i.Ek
nmdar.tau1 = i.tau1
nmdar.tau2 = i.tau2
nmdar.Gbar = i.Gbar
nmdar.CMg = 12
nmdar.KMg_A = 1.0 / 0.28
nmdar.KMg_B = 1.0 / 62
nmdar.temperature = 300
nmdar.extCa = 1.5
nmdar.intCa = 0.00008
nmdar.intCaScale = 1
nmdar.intCaOffset = 0.00008
nmdar.condFraction = 0.02
moose.delete( i )
moose.connect( pa, 'channel', nmdar, 'channel' )
caconc = moose.wildcardFind( pa.path + '/#[ISA=CaConcBase]' )
if ( len( caconc ) < 1 ):
print('no caconcs found on ', pa.path)
else:
moose.connect( nmdar, 'ICaOut', caconc[0], 'current' )
moose.connect( caconc[0], 'concOut', nmdar, 'assignIntCa' )
示例10: buildModel
def buildModel( self, modelPath = '/model' ):
if moose.exists( modelPath ):
print("rdesigneur::buildModel: Build failed. Model '",
modelPath, "' already exists.")
return
self.model = moose.Neutral( modelPath )
self.modelPath = modelPath
try:
# Protos made in the init phase. Now install the elec and
# chem protos on model.
self.installCellFromProtos()
# Now assign all the distributions
self.buildPassiveDistrib()
self.buildChanDistrib()
self.buildSpineDistrib()
self.buildChemDistrib()
self._configureSolvers()
self.buildAdaptors()
self._buildPlots()
self._buildMoogli()
self._buildStims()
self._configureClocks()
self._printModelStats()
except BuildError as msg:
print("Error: rdesigneur: model build failed:", msg)
moose.delete( self.model )
示例11: newModelDialogSlot
def newModelDialogSlot(self):
if self.popup is not None:
self.popup.close()
newModelDialog = DialogWidget()
if newModelDialog.exec_():
modelPath = str(newModelDialog.modelPathEdit.text()).strip()
if len(modelPath) == 0:
raise mexception.ElementNameError('Model path cannot be empty')
if re.search('[ /]',modelPath) is not None:
raise mexception.ElementNameError('Model path should not containe / or whitespace')
plugin = str(newModelDialog.getcurrentRadioButton())
if moose.exists(modelPath+'/model'):
moose.delete(modelPath)
modelContainer = moose.Neutral('%s' %(modelPath))
modelRoot = moose.Neutral('%s/%s' %(modelContainer.path,"model"))
if not moose.exists(modelRoot.path+'/info'):
moose.Annotator(modelRoot.path+'/info')
modelAnno = moose.element(modelRoot.path+'/info')
modelAnno.modeltype = "new_kkit"
modelAnno.dirpath = " "
self.loadedModelsAction(modelRoot.path,plugin)
self.setPlugin(plugin, modelRoot.path)
self.objectEditSlot('/', False)
示例12: transformNMDAR
def transformNMDAR(path):
for i in moose.wildcardFind(path + "/##/#NMDA#[ISA!=NMDAChan]"):
chanpath = i.path
pa = i.parent
i.name = "_temp"
if chanpath[-3:] == "[0]":
chanpath = chanpath[:-3]
nmdar = moose.NMDAChan(chanpath)
sh = moose.SimpleSynHandler(chanpath + "/sh")
moose.connect(sh, "activationOut", nmdar, "activation")
sh.numSynapses = 1
sh.synapse[0].weight = 1
nmdar.Ek = i.Ek
nmdar.tau1 = i.tau1
nmdar.tau2 = i.tau2
nmdar.Gbar = i.Gbar
nmdar.CMg = 12
nmdar.KMg_A = 1.0 / 0.28
nmdar.KMg_B = 1.0 / 62
nmdar.temperature = 300
nmdar.extCa = 1.5
nmdar.intCa = 0.00008
nmdar.intCaScale = 1
nmdar.intCaOffset = 0.00008
nmdar.condFraction = 0.02
moose.delete(i)
moose.connect(pa, "channel", nmdar, "channel")
caconc = moose.wildcardFind(pa.path + "/#[ISA=CaConcBase]")
if len(caconc) < 1:
print("no caconcs found on ", pa.path)
else:
moose.connect(nmdar, "ICaOut", caconc[0], "current")
moose.connect(caconc[0], "concOut", nmdar, "assignIntCa")
示例13: main
def main( standalone = False ):
runtime = 100
makeModel()
moose.reinit()
moose.start( runtime )
assert( almostEq( moose.element( 'model/compartment/s' ).conc,
moose.element( '/model/endo/s' ).conc ) )
moose.delete( '/model' )
示例14: main
def main( standalone = False ):
runtime = 200
displayInterval = 2
makeModel()
moose.reinit()
moose.start( runtime )
assert( almostEq( 2.0 * moose.element( 'model/compartment/s' ).conc,
moose.element( '/model/endo/s' ).conc ) )
moose.delete( '/model' )
示例15: deleteSolver
def deleteSolver(modelRoot):
compts = moose.wildcardFind(modelRoot+'/##[ISA=ChemCompt]')
for compt in compts:
if moose.exists(compt.path+'/stoich'):
st = moose.element(compt.path+'/stoich')
st_ksolve = st.ksolve
moose.delete(st)
if moose.exists((st_ksolve).path):
moose.delete(st_ksolve)