• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python moose.copy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_compartment

def create_compartment(path):
    comp = moose.Compartment(path)
    comp.diameter = soma_dia
    comp.Em = EREST_ACT + 10.613e-3
    comp.initVm = EREST_ACT
    sarea = np.pi * soma_dia * soma_dia
    comp.Rm = 1/(0.3e-3 * 1e4 * sarea)
    comp.Cm = 1e-6 * 1e4 * sarea
    if moose.exists('/library/na'):
        nachan = moose.element(moose.copy('/library/na', comp, 'na'))
    else:
        nachan = create_na_chan(comp.path)
    nachan.Gbar = 120e-3 * sarea * 1e4
    moose.showfield(nachan)
    moose.connect(nachan, 'channel', comp, 'channel')
    if moose.exists('/library/k'):
        kchan = moose.element(moose.copy('/library/k', comp, 'k'))
    else:
        kchan = create_k_chan(comp.path)
    kchan.Gbar = 36e-3 * sarea * 1e4
    moose.connect(kchan, 'channel', comp, 'channel')
    synchan = moose.SynChan(comp.path + '/synchan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    synchan.Ek = 0.0
    m = moose.connect(comp, 'channel', synchan, 'channel')
    spikegen = moose.SpikeGen(comp.path + '/spikegen')
    spikegen.threshold = 0.0
    m = moose.connect(comp, 'VmOut', spikegen, 'Vm')
    return comp
开发者ID:dilawar,项目名称:moose-examples,代码行数:31,代码来源:compartment_net_no_array.py


示例2: 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
开发者ID:DineshDevPandey,项目名称:moose,代码行数:29,代码来源:rdesigneur.py


示例3: creaetHHComp

def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6):
    """Create a compartment with Hodgkin-Huxley type ion channels (Na and
    K).

    Returns a 3-tuple: (compartment, nachannel, kchannel)

    """
    compPath = '{}/{}'.format(parent, name)
    mc = MooseCompartment( compPath, length, diameter, {})
    c = mc.mc_
    sarea = mc.surfaceArea

    if moose.exists('/library/na'):
        moose.copy('/library/na', c.path, 'na')
    else:
        create_na_chan(parent = c.path)

    na = moose.element('%s/na' % (c.path))

    # Na-conductance 120 mS/cm^2
    na.Gbar = 120e-3 * sarea * 1e4
    na.Ek = 115e-3 + EREST_ACT

    moose.connect(c, 'channel', na, 'channel')
    if moose.exists('/library/k'):
        moose.copy('/library/k', c.path, 'k')
    else:
        create_k_chan(parent = c.path)

    k = moose.element('%s/k' % (c.path))
    # K-conductance 36 mS/cm^2
    k.Gbar = 36e-3 * sarea * 1e4
    k.Ek = -12e-3 + EREST_ACT
    moose.connect(c, 'channel', k, 'channel')
    return (c, na, k)
开发者ID:hrani,项目名称:moose-core,代码行数:35,代码来源:moose_sim.py


示例4: create_hhcomp

def create_hhcomp(parent='/library', name='hhcomp', diameter=-30e-6, length=0.0):
    """Create a compartment with Hodgkin-Huxley type ion channels (Na and
    K).

    Returns a 3-tuple: (compartment, nachannel, kchannel)

    """
    comp, sarea = create_passive_comp(parent, name, diameter, length)
    if moose.exists('/library/na'):
        moose.copy('/library/na', comp.path, 'na')
    else:
        create_na_chan(parent=comp.path)
    na = moose.element('%s/na' % (comp.path))
    # Na-conductance 120 mS/cm^2
    na.Gbar = 120e-3 * sarea * 1e4 
    na.Ek = 115e-3 + EREST_ACT
    moose.connect(comp, 'channel', na, 'channel')
    if moose.exists('/library/k'):
        moose.copy('/library/k', comp.path, 'k')
    else:
        create_k_chan(parent=comp.path)
    k = moose.element('%s/k' % (comp.path))
    # K-conductance 36 mS/cm^2
    k.Gbar = 36e-3 * sarea * 1e4 
    k.Ek = -12e-3 + EREST_ACT
    moose.connect(comp, 'channel', k, 'channel')
    return comp, na, k
开发者ID:csiki,项目名称:MOOSE,代码行数:27,代码来源:hhcomp.py


示例5: 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)
开发者ID:pgleeson,项目名称:moose-core,代码行数:34,代码来源:merge.py


示例6: __init__

 def __init__(self, path):
     if not moose.exists(path):
         path_tokens = path.rpartition('/')
         moose.copy(self.prototype, path_tokens[0], path_tokens[-1])
     moose.Neutral.__init__(self, path)
     self.solver = moose.HSolve('{}/solver'.format(path, 'solver'))
     self.solver.target = path
     self.solver.dt = config.simulationSettings.simulationDt
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:8,代码来源:cells.py


示例7: buildFromMemory

    def buildFromMemory( self, ePath, cPath, doCopy = False ):
        if not self.validateFromMemory( ePath, cPath ):
            return
        if doCopy:
            x = moose.copy( cPath, self.model )
            self.chemid = moose.element( x )
            self.chemid.name = 'chem'
            x = moose.copy( ePath, self.model )
            self.elecid = moose.element( x )
            self.elecid.name = 'elec'
        else:
            self.elecid = moose.element( ePath )
            self.chemid = moose.element( cPath )
            if self.elecid.path != self.model.path + '/elec':
                if ( self.elecid.parent != self.model ):
                    moose.move( self.elecid, self.model )
                self.elecid.name = 'elec'
            if self.chemid.path != self.model.path + '/chem':
                if ( self.chemid.parent != self.model ):
                    moose.move( self.chemid, self.model )
                self.chemid.name = 'chem'


        ep = self.elecid.path
        somaList = moose.wildcardFind( ep + '/#oma#[ISA=CompartmentBase]' )
        if len( somaList ) == 0:
            somaList = moose.wildcardFind( ep + '/#[ISA=CompartmentBase]' )
        assert( len( somaList ) > 0 )
        maxdia = 0.0
        for i in somaList:
            if ( i.diameter > maxdia ):
                self.soma = i
        #self.soma = self.comptList[0]
        self._decorateWithSpines()
        self.spineList = moose.wildcardFind( ep + '/#spine#[ISA=CompartmentBase],' + ep + '/#head#[ISA=CompartmentBase]' )
        if len( self.spineList ) == 0:
            self.spineList = moose.wildcardFind( ep + '/#head#[ISA=CompartmentBase]' )
        nmdarList = moose.wildcardFind( ep + '/##[ISA=NMDAChan]' )

        self.comptList = moose.wildcardFind( ep + '/#[ISA=CompartmentBase]')
        print "Rdesigneur: Elec model has ", len( self.comptList ), \
            " compartments and ", len( self.spineList ), \
            " spines with ", len( nmdarList ), " NMDARs"


        self._buildNeuroMesh()


        self._configureSolvers()
        for i in self.adaptorList:
            print i
            self._buildAdaptor( i[0],i[1],i[2],i[3],i[4],i[5],i[6] )
开发者ID:dharmasam9,项目名称:moose-core,代码行数:52,代码来源:rdesigneur.py


示例8: create_LIF

def create_LIF():
    neuromlR = NeuroML()
    neuromlR.readNeuroMLFromFile("cells_channels/LIF.morph.xml")
    libcell = moose.Neuron("/library/LIF")
    LIFCellid = moose.copy(libcell, moose.Neutral("/cells"), "IF1")
    LIFCell = moose.Neuron(LIFCellid)
    return LIFCell
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:7,代码来源:LIFxml_firing.py


示例9: setup_single_compartment

def setup_single_compartment(container_path, channel_proto, Gbar):
    comp = make_testcomp(container_path)
    channel = moose.copy(channel_proto, comp, channel_proto.name)[0]
    moose.connect(channel, 'channel', comp, 'channel')
    channel.Gbar = Gbar
    pulsegen = make_pulsegen(container_path)
    moose.connect(pulsegen, 'outputOut', comp, 'injectMsg')
    vm_table = moose.Table('%s/Vm' % (container_path))
    moose.connect(vm_table, 'requestData', comp, 'get_Vm')
    gk_table = moose.Table('%s/Gk' % (container_path))
    moose.connect(gk_table, 'requestData', channel, 'get_Gk')
    ik_table = moose.Table('%s/Ik' % (container_path))
    moose.connect(ik_table, 'requestData', channel, 'get_Ik')
    moose.setClock(0, simdt)
    moose.setClock(1, simdt)
    moose.setClock(2, simdt)
    moose.useClock(0, '%s/##[TYPE=Compartment]' % (container_path), 'init')
    moose.useClock(1, '%s/##[TYPE=Compartment]' % (container_path), 'process')
    moose.useClock(2, '%s/##[TYPE!=Compartment]' % (container_path), 'process')

    return {'compartment': comp,
            'stimulus': pulsegen,
            'channel': channel,
            'Vm': vm_table,
            'Gk': gk_table,
            'Ik': ik_table}
开发者ID:Vivek-sagar,项目名称:moose-1,代码行数:26,代码来源:hsolvetestutil.py


示例10: addCaPool

def addCaPool(model,OutershellThickness,BufCapacity,comp,caproto,tau=None,tauScale=None):
    #create the calcium pools in each compartment
    capool = moose.copy(caproto, comp, caproto.name)[0]
    capool.thick = OutershellThickness
    capool.diameter = comp.diameter
    capool.length = comp.length
    radius = comp.diameter/2.
    if capool.thick > radius:
        capool.thick = radius
    if capool.length:
        vol = np.pi * comp.length * (radius**2 - (radius-capool.thick)**2)
    else:
        vol = 4./3.*np.pi*(radius**3-(radius-capool.thick)**3)
    if tau is not None:
        capool.tau = tau#*np.pi*comp.diameter*comp.length *0.125e10 #/(np.pi*comp.length*(comp.diameter/2)**2) #
        if tauScale is not None:
            if tauScale == 'SurfaceArea':
                capool.tau = tau * (np.pi * comp.diameter * comp.length) / 8.478e-11 # normalize to primdend surface area
            elif tauScale == 'Volume':
                capool.tau = tau / vol
            elif tauScale == 'SVR': #surface to volume ratio
                capool.tau = tau / (np.pi * comp.diameter * comp.length)/vol


    capool.B = 1. / (constants.Faraday*vol*2) / BufCapacity #volume correction

    connectVDCC_KCa(model,comp,capool,'current','concOut')
    connectNMDA(comp,capool,'current','concOut')
    #print('Adding CaConc to '+capool.path)
    return capool
开发者ID:neurord,项目名称:spspine,代码行数:30,代码来源:calcium.py


示例11: copyChannel

    def copyChannel(self, chdens, comp, condDensity, erev):
        """Copy moose prototype for `chdens` condutcance density to `comp`
        compartment.

        """
        proto_chan = None
        if chdens.ion_channel in self.proto_chans:
            proto_chan = self.proto_chans[chdens.ion_channel]
        else:
            for innerReader in self.includes.values():
                if chdens.ionChannel in innerReader.proto_chans:
                    proto_chan = innerReader.proto_chans[chdens.ion_channel]
                    break
        if not proto_chan:
            raise Exception('No prototype channel for %s referred to by %s' % (chdens.ion_channel, chdens.id))

        if self.verbose:
            print('Copying %s to %s, %s; erev=%s'%(chdens.id, comp, condDensity, erev))
        orig = chdens.id
        chid = moose.copy(proto_chan, comp, chdens.id)
        chan = moose.element(chid)
        for p in self.paths_to_chan_elements.keys():
            pp = p.replace('%s/'%chdens.ion_channel,'%s/'%orig)
            self.paths_to_chan_elements[pp] = self.paths_to_chan_elements[p].replace('%s/'%chdens.ion_channel,'%s/'%orig)
        #print(self.paths_to_chan_elements)
        chan.Gbar = sarea(comp) * condDensity
        chan.Ek = erev
        moose.connect(chan, 'channel', comp, 'channel')
        return chan    
开发者ID:pgleeson,项目名称:moose-core,代码行数:29,代码来源:reader.py


示例12: create_neuron

def create_neuron(model, ntype, ghkYN):
    p_file = find_morph_file(model,ntype)
    try:
        cellproto=moose.loadModel(p_file, ntype)
    except IOError:
        print('could not load model from {!r}'.format(p_file))
        raise
    #######channels
    Cond = model.Condset[ntype]
    for comp in moose.wildcardFind('{}/#[TYPE=Compartment]'.format(ntype)):
        #If we are using GHK, just create one GHK per compartment, connect it to comp
        #calcium concentration is connected in a different function
        if ghkYN:
            ghkproto=moose.element('/library/ghk')
            ghk=moose.copy(ghkproto,comp,'ghk')[0]
            moose.connect(ghk,'channel',comp,'channel')
        else:
            ghk=[]
        for channame in Cond.keys():
            c = _util.distance_mapping(Cond[channame], comp)
            if c > 0:
                log.debug('Testing Cond If {} {}', channame, c)
                calciumPermeable = model.Channels[channame].calciumPermeable
                add_channel.addOneChan(channame, c, comp, ghkYN, ghk, calciumPermeable=calciumPermeable)

        #Compensate for actual, experimentally estimated spine density.
        #This gives a model that can be simulated with no explicit spines or
        #any number of explicitly modeled spines up to the actual spine density:
        spines.compensate_for_spines(model,comp,model.param_cond.NAME_SOMA)

    return cellproto
开发者ID:neurord,项目名称:spspine,代码行数:31,代码来源:cell_proto.py


示例13: create_population

def create_population(container, netparams, name_soma):
    netpath = container.path
    proto=[]
    neurXclass={}
    locationlist=[]
    #determine total number of neurons
    size,numneurons,vol=count_neurons(netparams)
    pop_percent=[]
    for neurtype in netparams.pop_dict.keys():
        if moose.exists(neurtype):
            proto.append(moose.element(neurtype))
            neurXclass[neurtype]=[]
            pop_percent.append(netparams.pop_dict[neurtype].percent)
    #create cumulative array of probabilities for selecting neuron type
    choicearray=np.cumsum(pop_percent)
    if choicearray[-1]<1.0:
        log.info("Warning!!!! fractional populations sum to {}",choicearray[-1])
    #array of random numbers that will be used to select neuron type
    rannum = np.random.uniform(0,choicearray[-1],numneurons)
    #Error check for last element in choicearray equal to 1.0
    log.info("numneurons= {} {} choicarray={}", size, numneurons, choicearray)
    log.debug("rannum={}", rannum)
    for i,xloc in enumerate(np.linspace(netparams.grid[0]['xyzmin'], netparams.grid[0]['xyzmax'], size[0])):
        for j,yloc in enumerate(np.linspace(netparams.grid[1]['xyzmin'], netparams.grid[1]['xyzmax'], size[1])):
            for k,zloc in enumerate(np.linspace(netparams.grid[2]['xyzmin'], netparams.grid[2]['xyzmax'], size[2])):
                #for each location in grid, assign neuron type, update soma location, add in spike generator
                neurnumber=i*size[2]*size[1]+j*size[2]+k
                neurtypenum=np.min(np.where(rannum[neurnumber]<choicearray))
                log.debug("i,j,k {} {} {} neurnumber {} type {}", i,j,k, neurnumber, neurtypenum)
                typename = proto[neurtypenum].name
                tag = '{}_{}'.format(typename, neurnumber)
                new_neuron=moose.copy(proto[neurtypenum],netpath, tag)
                neurXclass[typename].append(container.path + '/' + tag)
                comp=moose.element(new_neuron.path + '/'+name_soma)
                comp.x=i*xloc
                comp.y=j*yloc
                comp.z=k*zloc
                log.debug("x,y,z={},{},{} {}", comp.x, comp.y, comp.z, new_neuron.path)
                locationlist.append([new_neuron.name,comp.x,comp.y,comp.z])
                #spike generator - can this be done to the neuron prototype?
                spikegen = moose.SpikeGen(comp.path + '/spikegen')
                #should these be parameters in netparams?
                spikegen.threshold = 0.0
                spikegen.refractT=1e-3
                m = moose.connect(comp, 'VmOut', spikegen, 'Vm')
    #Create variability in neurons of network
    for neurtype in netparams.chanvar.keys():
        for chan,var in netparams.chanvar[neurtype].items():
            #single multiplier for Gbar for all the channels compartments
            if var>0:
                log.debug('adding variability to {} soma {}, variance: {}', neurtype,chan, var)
                GbarArray=abs(np.random.normal(1.0, var, len(neurXclass[neurtype])))
                for ii,neurname in enumerate(neurXclass[neurtype]):
                    soma_chan_path=neurname+'/'+name_soma+'/'+chan
                    if moose.exists(soma_chan_path):
                        chancomp=moose.element(soma_chan_path)
                        chancomp.Gbar=chancomp.Gbar*GbarArray[ii]
    #
    return {'location': locationlist,
            'pop':neurXclass}
开发者ID:neurord,项目名称:spspine,代码行数:60,代码来源:pop_funcs.py


示例14: make_new_synapse

def make_new_synapse(syn_name, postcomp, syn_name_full, nml_params):
    ## if channel does not exist in library load it from xml file
    if not moose.exists("/library/" + syn_name):
        cmlR = ChannelML(nml_params)
        model_filename = syn_name + ".xml"
        model_path = utils.find_first_file(model_filename, nml_params["model_dir"])
        if model_path is not None:
            cmlR.readChannelMLFromFile(model_path)
        else:
            raise IOError(
                "For mechanism {0}: files {1} not found under {2}.".format(
                    mechanismname, model_filename, self.model_dir
                )
            )
    ## deep copies the library SynChan and SynHandler
    ## to instances under postcomp named as <arg3>
    synid = moose.copy(moose.element("/library/" + syn_name), postcomp, syn_name_full)
    # synhandlerid = moose.copy(moose.element('/library/'+syn_name+'/handler'), postcomp,syn_name_full+'/handler') This line was a bug: double handler
    synhandler = moose.element(synid.path + "/handler")
    syn = moose.SynChan(synid)
    synhandler = moose.element(synid.path + "/handler")  # returns SimpleSynHandler or STDPSynHandler

    ## connect the SimpleSynHandler or the STDPSynHandler to the SynChan (double exp)
    moose.connect(synhandler, "activationOut", syn, "activation")
    # mgblock connections if required
    childmgblock = moose_utils.get_child_Mstring(syn, "mgblockStr")
    #### connect the post compartment to the synapse
    if childmgblock.value == "True":  # If NMDA synapse based on mgblock, connect to mgblock
        mgblock = moose.Mg_block(syn.path + "/mgblock")
        moose.connect(postcomp, "channel", mgblock, "channel")
    else:  # if SynChan or even NMDAChan, connect normally
        moose.connect(postcomp, "channel", syn, "channel")
开发者ID:BhallaLab,项目名称:moose,代码行数:32,代码来源:ChannelML.py


示例15: create_LIF

def create_LIF():
    neuromlR = NeuroML()
    neuromlR.readNeuroMLFromFile('cells_channels/LIF.morph.xml')
    libcell = moose.Neuron('/library/LIF')
    LIFCellid = moose.copy(libcell,moose.Neutral('/cells'),'IF1')
    LIFCell = moose.Neuron(LIFCellid)
    return LIFCell
开发者ID:dilawar,项目名称:moose-examples,代码行数:7,代码来源:LIFxml_firing.py


示例16: setup_model

def setup_model(model_path, synapse_locations, passive=False, solver='hsolve'):
    """Set up a single cell model under `model_path` with synapses
    created in the compartments listed in `synapse_locations`.


    `model_path` - location where the model should be created.

    `synapse_locations`: compartment names for the synapses.

    """
    cell = moose.copy(make_prototype(passive), model_path)
    if solver.lower() == 'hsolve':
        hsolve = moose.HSolve( '%s/solve' % (cell.path))
        hsolve.dt = simdt
        hsolve.target = cell.path
    syninfo_list = []
    for compname in synapse_locations:
        comppath = '%s/%s' % (cell.path, compname)
        print('1111 Creating synapse in', comppath)
        compartment = moose.element(comppath)
        syninfo = make_synapse(compartment)
        syninfo_list.append(syninfo)
        # connect  pulse stimulus
        stim_path = '%s/%s/stim' % (cell.path, compname)
        print('2222 Creating stimuls in', stim_path)
        stim = moose.PulseGen(stim_path)
        moose.connect(stim, 'output', syninfo['spike'], 'Vm')
        syninfo['stimulus'] = stim
    return {'neuron': cell,
            'syninfo': syninfo_list}
开发者ID:hrani,项目名称:moose-core,代码行数:30,代码来源:rc19.py


示例17: 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


示例18: _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 )
开发者ID:DineshDevPandey,项目名称:moose,代码行数:25,代码来源:rdesigneur.py


示例19: insert_channel

def insert_channel(compartment, channeclass, gbar, density=False):
    channel = moose.copy(channeclass.prototype, compartment)[0]
    if not density:
        channel.Gbar = gbar
    else:
        channel.Gbar = gbar * np.pi * compartment.length * compartment.diameter
    moose.connect(channel, 'channel', compartment, 'channel')
    return channel
开发者ID:2pysarthak,项目名称:moose-examples,代码行数:8,代码来源:test_singlecomp.py


示例20: create_LIF

def create_LIF():
    neuromlR = NeuroML()
    neuromlR.readNeuroMLFromFile('cells_channels/LIF.morph.xml')
    libcell = moose.Neuron('/library/LIF')
    LIFCellid = moose.copy(libcell,moose.Neutral('/cells'),'IF1')
    # FIXME: No LeakyIaF is found in MOOSE.
    LIFCell = moose.LeakyIaF(LIFCellid)
    return LIFCell
开发者ID:BhallaLab,项目名称:moose-examples,代码行数:8,代码来源:LIFxml_firing_hsolve.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python moose.delete函数代码示例发布时间:2022-05-27
下一篇:
Python moose.connect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap