本文整理汇总了Python中moose.wildcardFind函数的典型用法代码示例。如果您正苦于以下问题:Python wildcardFind函数的具体用法?Python wildcardFind怎么用?Python wildcardFind使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wildcardFind函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_synchans
def add_synchans(model, container):
synchans=[]
#2D array to store all the synapses. Rows=num synapse types, columns=num comps
#at the end they are concatenated into a dictionary
for key in model.SYNAPSE_TYPES:
synchans.append([])
allkeys = sorted(model.SYNAPSE_TYPES)
comp_list = moose.wildcardFind(container + '/#[TYPE=Compartment]')
for comp in comp_list:
#create each type of synchan in each compartment. Add to 2D array
for key in DendSynChans(model):
keynum = allkeys.index(key)
Gbar = model.SYNAPSE_TYPES[key].Gbar
Gbarvar=model.SYNAPSE_TYPES[key].var
synchans[keynum].append(addoneSynChan(key,comp,Gbar, model.calYN, Gbarvar))
for key in SpineSynChans(model):
keynum = allkeys.index(key)
Gbar = model.SYNAPSE_TYPES[key].Gbar
Gbarvar=model.SYNAPSE_TYPES[key].var
for spcomp in moose.wildcardFind(comp.path + '/#[ISA=Compartment]'):
if NAME_HEAD in spcomp.path:
synchans[keynum].append(addoneSynChan(key,spcomp,Gbar, model.calYN, Gbarvar))
allsynchans={key:synchans[keynum]
for keynum, key in enumerate(sorted(model.SYNAPSE_TYPES))}
return allsynchans
示例2: main
def main():
#solver = "gsl" # Pick any of gsl, gssa, ee..
solver = "gssa" # Pick any of gsl, gssa, ee..
mfile = '../../Genesis_files/Repressillator.g'
runtime = 6000.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 = 1e-19
dt = moose.element( '/clock' ).dt
moose.reinit()
moose.start( runtime )
# Display all plots.
img = mpimg.imread( 'repressillatorOsc.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#/#' )
plt.ylabel( 'Conc (mM)' )
plt.xlabel( 'Time (seconds)' )
for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
t = numpy.arange( 0, x.vector.size, 1 ) * dt
pylab.plot( t, x.vector, label=x.name )
pylab.legend()
pylab.show()
示例3: 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' )
示例4: 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( '/' )
示例5: main
def main():
simdt = 0.1
plotdt = 0.1
runtime = 100.0
makeModel()
# Schedule the whole lot
moose.setClock( 4, simdt ) # for the computational objects
moose.setClock( 5, simdt ) # for the computational objects
moose.setClock( 8, plotdt ) # for the plots
moose.useClock( 4, '/model/compt#/ksolve#', 'init' )
moose.useClock( 5, '/model/compt#/ksolve#', 'process' )
moose.useClock( 8, '/model/graphs/#', 'process' )
moose.reinit()
moose.start( runtime ) # Run the model for 100 seconds.
for x in moose.wildcardFind( '/model/compt#/#[ISA=PoolBase]' ):
print x.name, x.conc
# Iterate through all plots, dump their contents to data.plot.
for x in moose.wildcardFind( '/model/graphs/conc#' ):
#x.xplot( 'scriptKineticModel.plot', x.name )
t = numpy.linspace( 0, runtime, x.vector.size ) # sec
pylab.plot( t, x.vector, label=x.name )
pylab.legend()
pylab.show()
quit()
示例6: _loadElec
def _loadElec( self, efile, elecname, combineSegments ):
library = moose.Neutral( '/library' )
if ( efile[ len( efile ) - 2:] == ".p" ):
self.elecid = moose.loadModel( efile, self.model.path + '/' + elecname )
else:
nm = NeuroML()
nm.readNeuroMLFromFile( efile, \
params = {'combineSegments': combineSegments, \
'createPotentialSynapses': True } )
if moose.exists( '/cells' ):
kids = moose.wildcardFind( '/cells/#' )
else:
kids = moose.wildcardFind( '/library/#[ISA=Neuron],/library/#[TYPE=Neutral]' )
if ( kids[0].name == 'spine' ):
kids = kids[1:]
assert( len( kids ) > 0 )
self.elecid = kids[0]
temp = moose.wildcardFind( self.elecid.path + '/#[ISA=CompartmentBase]' )
moose.move( self.elecid, self.model )
self.elecid.name = elecname
self._transformNMDAR( self.elecid.path )
kids = moose.wildcardFind( '/library/##[0]' )
for i in kids:
i.tick = -1
示例7: 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' )
示例8: writeCompt
def writeCompt(modelpath, cremodel_):
# getting all the compartments
compts = moose.wildcardFind(modelpath + '/##[ISA=ChemCompt]')
groupInfo = {}
for compt in compts:
comptName = convertSpecialChar(compt.name)
# converting m3 to litre
size = compt.volume * pow(10, 3)
ndim = compt.numDimensions
c1 = cremodel_.createCompartment()
c1.setId(str(idBeginWith(comptName +
"_" +
str(compt.getId().value) +
"_" +
str(compt.getDataIndex()) +
"_")))
c1.setName(comptName)
c1.setConstant(True)
c1.setSize(size)
c1.setSpatialDimensions(ndim)
c1.setUnits('volume')
#For each compartment get groups information along
for grp in moose.wildcardFind(compt.path+'/##[TYPE=Neutral]'):
grp_cmpt = findGroup_compt(grp.parent)
try:
value = groupInfo[moose.element(grp)]
except KeyError:
# Grp is not present
groupInfo[moose.element(grp)] = []
if compts:
return True,groupInfo
else:
return False,groupInfo
示例9: poolMerge
def poolMerge(comptA,comptB,poolNotcopiedyet):
aCmptGrp = moose.wildcardFind(comptA.path+'/#[TYPE=Neutral]')
aCmptGrp = aCmptGrp +(moose.element(comptA.path),)
bCmptGrp = moose.wildcardFind(comptB.path+'/#[TYPE=Neutral]')
bCmptGrp = bCmptGrp +(moose.element(comptB.path),)
objA = moose.element(comptA.path).parent.name
objB = moose.element(comptB.path).parent.name
for bpath in bCmptGrp:
grp_cmpt = ((bpath.path).replace(objB,objA)).replace('[0]','')
if moose.exists(grp_cmpt) :
if moose.element(grp_cmpt).className != bpath.className:
grp_cmpt = grp_cmpt+'_grp'
bpath.name = bpath.name+"_grp"
l = moose.Neutral(grp_cmpt)
else:
#moose.Neutral(grp_cmpt)
src = bpath
srcpath = (bpath.parent).path
des = srcpath.replace(objB,objA)
moose.copy(bpath,moose.element(des))
apath = moose.element(bpath.path.replace(objB,objA))
bpoollist = moose.wildcardFind(bpath.path+'/#[ISA=PoolBase]')
apoollist = moose.wildcardFind(apath.path+'/#[ISA=PoolBase]')
for bpool in bpoollist:
if bpool.name not in [apool.name for apool in apoollist]:
copied = copy_deleteUnlyingPoolObj(bpool,apath)
if copied == False:
#hold it for later, this pool may be under enzyme, as cplx
poolNotcopiedyet.append(bpool)
示例10: installCellFromProtos
def installCellFromProtos( self ):
if self.stealCellFromLibrary:
moose.move( self.elecid, self.model )
if self.elecid.name != 'elec':
self.elecid.name = 'elec'
else:
moose.copy( self.elecid, self.model, 'elec' )
self.elecid = moose.element( self.model.path + '/elec' )
self.elecid.buildSegmentTree() # rebuild: copy has happened.
if hasattr( self, 'chemid' ):
self.validateChem()
if self.stealCellFromLibrary:
moose.move( self.chemid, self.model )
if self.chemid.name != 'chem':
self.chemid.name = 'chem'
else:
moose.copy( self.chemid, self.model, 'chem' )
self.chemid = moose.element( self.model.path + '/chem' )
ep = self.elecid.path
somaList = moose.wildcardFind( ep + '/#oma#[ISA=CompartmentBase]' )
if len( somaList ) == 0:
somaList = moose.wildcardFind( ep + '/#[ISA=CompartmentBase]' )
if len( somaList ) == 0:
raise BuildError( "installCellFromProto: No soma found" )
maxdia = 0.0
for i in somaList:
if ( i.diameter > maxdia ):
self.soma = i
示例11: loadModel
def loadModel(filename, chanProto, chanDistrib, passiveDistrib):
"""Load the model and insert channels """
global modelName
global nchans, ncompts
# Load in the swc file.
modelName = "elec"
cellProto = [ ( filename, modelName ) ]
rdes = rd.rdesigneur( cellProto = cellProto
, combineSegments = True
, passiveDistrib = passiveDistrib
, chanProto = chanProto
, chanDistrib = chanDistrib
)
rdes.buildModel('/model')
compts = moose.wildcardFind( "/model/%s/#[ISA=CompartmentBase]"%modelName )
setupStimuls( compts[0] )
for compt in compts:
vtab = moose.Table( '%s/vm' % compt.path )
moose.connect( vtab, 'requestOut', compt, 'getVm' )
_records[compt.path] = vtab
nchans = len(set([x.path for x in
moose.wildcardFind('/model/elec/##[TYPE=ZombieHHChannel]')])
)
_logger.info("Total channels: %s" % nchans)
return _records
示例12: showVisualization
def showVisualization():
makeModel()
elec = moose.element( '/model/elec' )
elec.setSpineAndPsdMesh( moose.element('/model/chem/spine'), moose.element('/model/chem/psd') )
eHead = moose.wildcardFind( '/model/elec/#head#' )
oldDia = [ i.diameter for i in eHead ]
graphs = moose.Neutral( '/graphs' )
#makePlot( 'psd_x', moose.vec( '/model/chem/psd/x' ), 'getN' )
#makePlot( 'head_x', moose.vec( '/model/chem/spine/x' ), 'getN' )
makePlot( 'dend_x', moose.vec( '/model/chem/dend/x' ), 'getN' )
dendZ = makePlot( 'dend_z', moose.vec( '/model/chem/dend/z' ), 'getN' )
makePlot( 'head_z', moose.vec( '/model/chem/spine/z' ), 'getN' )
psdZ = makePlot( 'psd_z', moose.vec( '/model/chem/psd/z' ), 'getN' )
diaTab = makePlot( 'headDia', eHead, 'getDiameter' )
# print diaTab[0].vector[-1]
# return
dendrite = moose.element("/model/elec/dend")
dendrites = [dendrite.path + "/" + str(i) for i in range(len(dendZ))]
# print dendrites
moose.reinit()
spineHeads = moose.wildcardFind( '/model/elec/#head#')
# print moose.wildcardFind( '/model/elec/##')
# print "dendZ", readValues(dendZ)
# print dendrite
app = QtGui.QApplication(sys.argv)
viewer = create_viewer("/model/elec", dendrite, dendZ, diaTab, psdZ)
viewer.showMaximized()
viewer.start()
return app.exec_()
示例13: spinetabs
def spinetabs(model,neuron,comps='all'):
if not moose.exists(DATA_NAME):
moose.Neutral(DATA_NAME)
#creates tables of calcium and vm for spines
spcatab = defaultdict(list)
spvmtab = defaultdict(list)
for typenum,neurtype in enumerate(neuron.keys()):
if type(comps)==str and comps in {'*', 'all'}:
spineHeads=[moose.wildcardFind(neurtype+'/##/#head#[ISA=CompartmentBase]')]
else:
spineHeads=[moose.wildcardFind(neurtype+'/'+c+'/#head#[ISA=CompartmentBase]') for c in comps]
for spinelist in spineHeads:
for spinenum,spine in enumerate(spinelist):
compname = spine.parent.name
sp_num=spine.name.split(NAME_HEAD)[0]
spvmtab[typenum].append(moose.Table(vm_table_path(neurtype, spine=sp_num, comp=compname)))
log.debug('{} {} {}',spinenum, spine.path, spvmtab[typenum][-1].path)
moose.connect(spvmtab[typenum][-1], 'requestOut', spine, 'getVm')
if model.calYN:
for child in spine.children:
if child.className == "CaConc" or child.className == "ZombieCaConc" :
spcatab[typenum].append(moose.Table(DATA_NAME+'/%s_%s%s'% (neurtype,sp_num,compname)+child.name))
spcal = moose.element(spine.path+'/'+child.name)
moose.connect(spcatab[typenum][-1], 'requestOut', spcal, 'getCa')
elif child.className == 'DifShell':
spcatab[typenum].append(moose.Table(DATA_NAME+'/%s_%s%s'% (neurtype,sp_num,compname)+child.name))
spcal = moose.element(spine.path+'/'+child.name)
moose.connect(spcatab[typenum][-1], 'requestOut', spcal, 'getC')
return spcatab,spvmtab
示例14: deliverStim
def deliverStim(currTime):
global injectionCurrent
global spineVm
global somaVm
if numpy.fabs( currTime - baselineTime ) < frameRunTime/2.0 :
#start
eList = moose.wildcardFind( '/model/elec/#soma#' )
assert( len(eList) > 0 )
eList[0].inject = injectionCurrent
#print "1. injected current = ", injectionCurrent
injectionCurrent += deltaCurrent
#print "del stim first ", moose.element('/clock').currentTime
if numpy.fabs( currTime - baselineTime - currPulseTime) < frameRunTime/2.0 :
#end
eList = moose.wildcardFind( '/model/elec/#soma#' )
assert( len(eList) > 0 )
eList[0].inject = 0.0
#print "2. injected current = ", injectionCurrent
#print "del stim second ", moose.element('/clock').currentTime
if runtime - currTime < frameRunTime * 2.0 :
#print "3. reinit-ing"
somaVm.append( moose.element( '/graphs/VmTab' ).vector )
spineVm.append( moose.element( '/graphs/eSpineVmTab' ).vector )
iList.append(injectionCurrent)
if injectionCurrent < maxCurrent :
moose.reinit()
示例15: dumpPlots
def dumpPlots( fname ):
if ( os.path.exists( fname ) ):
os.remove( fname )
for x in moose.wildcardFind( '/graphs/#[ISA=Table]' ):
moose.element( x[0] ).xplot( fname, x[0].name )
for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
moose.element( x[0] ).xplot( fname, x[0].name + '_e' )