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

Python neuron.run函数代码示例

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

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



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

示例1: exercise1

def exercise1(v_rest = 65.0):
    ssp = p.Population(1, cellclass=p.SpikeSourcePoisson)
    ssp.set('rate', 30.)
    ssp.record()
    n = p.Population(1, cellclass=p.IF_cond_exp)

    n.record_v()
    n.record()
    n.record_gsyn()
    n.set('v_rest', v_rest) 
    prj = p.Projection(ssp, n, target="excitatory", method=p.AllToAllConnector())
    prj.setWeights(0.001)
    p.run(1000)
    gsyn = n.get_gsyn()
    pot = n.get_v()
    spikes = ssp.getSpikes()
    plot(pot[:,1], pot[:,2])
    plot(spikes[:,1], [max(pot[:,2])]*len(spikes), '|', color='r', markersize=20.0)

    xlabel('Time/ms')
    ylabel('Membrane potential/mV')
    title('EPSPs after excitatory postsynaptic signal')

    plot(gsyn[:,1], gsyn[:,2])
    plot(spikes[:,1], [0]*len(spikes), '|', color='r', markersize=20.0)

    xlabel('Time/ms')
    ylabel('Membrane potential/mV')
    title('Excitatory conductance')

    savefig('../output/day5figure2.png')

    return pot, gsyn, spikes
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:33,代码来源:day5exercise1.py


示例2: exercise4_iandf

def exercise4_iandf():
    startTime = time.clock()
    hugs = p.Population(1, cellclass=p.IF_cond_exp)
    dcsource = p.DCSource(amplitude=0.9, start=100., stop=100000)
    dcsource.inject_into(hugs)
    p.run(100000.)
    print(time.clock() - startTime)
开发者ID:nebw,项目名称:NeuronaleProzesse2011,代码行数:7,代码来源:day4exercise1.py


示例3: run_simulation

def run_simulation(parameters, plot_figure=False):
    """

    """
    import pyNN.neuron as sim

    timestamp = datetime.now()
    model = build_model(**parameters["network"])
    if "full_filename" in parameters["experiment"]:
        xml_file = os.path.splitext(parameters["experiment"]["full_filename"])[0] + ".xml"
    else:
        xml_file = "{}.xml".format(parameters["experiment"]["base_filename"])
    model.write(xml_file)
    print("Exported model to file {}".format(xml_file))

    sim.setup(timestep=parameters["experiment"]["timestep"])

    print("Building network")
    net = Network(sim, xml_file)

    if plot_figure:
        stim = net.populations["Ext"]
        stim[:100].record('spikes')
        exc = net.populations["Exc"]
        exc.sample(50).record("spikes")
        exc.sample(1).record(["nrn_v", "syn_a"])
        inh = net.populations["Inh"]
        inh.sample(50).record("spikes")
        inh.sample(1).record(["nrn_v", "syn_a"])
    else:
        ##all = net.assemblies["All"]
        ##all.sample(parameters["experiment"]["n_record"]).record("spikes")
        net.populations["Ext"].sample(parameters["experiment"]["n_record"]).record("spikes")  ## debugging

    print("Running simulation")
    t_stop = parameters["experiment"]["duration"]
    pb = SimulationProgressBar(t_stop/80, t_stop)
    sim.run(t_stop, callbacks=[pb])

    print("Handling data")
    data = {}
    if plot_figure:
        data["stim"] = stim.get_data().segments[0]
        data["exc"] = exc.get_data().segments[0]
        data["inh"] = inh.get_data().segments[0]
    else:
        if "full_filename" in parameters["experiment"]:
            filename = parameters["experiment"]["full_filename"]
        else:
            filename = "{}_nineml_{:%Y%m%d%H%M%S}.h5".format(parameters["experiment"]["base_filename"],
                                                             timestamp)
        print("Writing data to {}".format(filename))
        ##all.write_data(filename)  ## debugging
        net.populations["Ext"].write_data(filename)

    sim.end()
    return data
开发者ID:INCF,项目名称:NineML_demo_2016,代码行数:57,代码来源:brunel_network_nineml.py


示例4: model_network

def model_network(param_dict):
    """
    This model network consists of a spike source and a neuron (IF_curr_alpha). 
    The spike rate of the source and the weight can be specified in the 
    param_dict. Returns the number of spikes fired during 1000 ms of simulation.
    
    Parameters:
    param_dict - dictionary with keys
                 rate - the rate of the spike source (spikes/second)
                 weight - weight of the connection source -> neuron
                 
    Returns:
    dictionary with keys:
        source_rate - the rate of the spike source
        weight - weight of the connection source -> neuron
        neuron_rate - spike rate of the neuron
    """ 
    #set up the network
    import pyNN.neuron as sim
    sim.setup(dt = 0.01,  min_delay = 1.,  max_delay = 1.,  debug = False,  
              quit_on_end = False)
    
    weight = param_dict['weight']
    
    import NeuroTools.stgen as stgen
    stgen = stgen.StGen()
    spiketrain = stgen.poisson_generator(param_dict['rate'], t_stop = 1000.)
    source = sim.Population(1, sim.SpikeSourceArray,  
                            {'spike_times':spiketrain.spike_times})
    neuron = sim.Population(1, sim.IF_cond_alpha)
    sim.Projection(source, neuron, 
                   method = sim.OneToOneConnector(weights = param_dict['weight'], 
                                                  delays = 1.))
    
    #set recorder
    neuron.record()
    neuron.record_v()
    
    #run the simulation
    sim.run(1001.)
    sim.end()
    
    # count the number of spikes
    spikes = neuron.getSpikes()
    numspikes = len(spikes)
    
    # return everything, including the input parameters
    return {'source_rate':param_dict['rate'], 
            'weight':param_dict['weight'], 
            'neuron_rate':numspikes }
开发者ID:JuergenNeubauer,项目名称:NeuroTools,代码行数:50,代码来源:parameter_search_example.py


示例5: run_simulation

def run_simulation(parameters, plot_figure=False):
    """

    """
    import pyNN.neuron as sim

    timestamp = datetime.now()
    model = build_model(**parameters["network"])
    if "full_filename" in parameters["experiment"]:
        xml_file = parameters["experiment"]["full_filename"].replace(".h5", ".xml")
    else:
        xml_file = "{}.xml".format(parameters["experiment"]["base_filename"])
    model.write(xml_file)
    print("Exported model to file {}".format(xml_file))

    sim.setup()

    print("Building network")
    net = Network(sim, xml_file)

    stim = net.populations["Ext"]
    stim.record('spikes')
    exc = net.populations["Exc"]
    exc.record("spikes")
    n_record = int(parameters["experiment"]["n_record"])
    exc[:n_record].record(["nrn_v", "syn_a"])

    print("Running simulation")
    t_stop = parameters["experiment"]["duration"]
    pb = SimulationProgressBar(t_stop/80, t_stop)
    sim.run(t_stop, callbacks=[pb])

    print("Handling data")
    data = {}
    if plot_figure:
        data["stim"] = stim.get_data().segments[0]
        data["exc"] = exc.get_data().segments[0]
        data["exc"].annotate(simulator="lib9ML with pyNN.neuron")
    else:
        if "full_filename" in parameters["experiment"]:
            filename = parameters["experiment"]["full_filename"]
        else:
            filename = "{}_nineml_{:%Y%m%d%H%M%S}.pkl".format(parameters["experiment"]["base_filename"],
                                                              timestamp)
        print("Writing data to {}".format(filename))
        exc.write_data(filename)

    sim.end()
    return data
开发者ID:INCF,项目名称:NineML_demo_2016,代码行数:49,代码来源:simple_network_nineml.py


示例6: exercise3

def exercise3():
    p.setup(quit_on_end=False, timestep=0.01)
    iandf = p.Population(1, cellclass=p.IF_cond_exp)
    dcsource = p.DCSource(amplitude=1.0, start=100.0, stop=1000.0)
    dcsource.inject_into(iandf)
    iandf.record()
    iandf.record_v()
    p.run(1200.0)
    pot = iandf.get_v()
    spikes = iandf.getSpikes()
    plot(pot[:, 1], pot[:, 2], color="b")
    plot(spikes[:, 1], [-60] * len(spikes), ".", color="r")
    line = axhline(y=-60, xmin=0, xmax=len(pot[:, 1]), color="r")
    xlabel("Time/ms")
    ylabel("Current/mV")
    savefig("../output/day4_figure3.png")
    show()
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:17,代码来源:day4exercise1.py


示例7: exercise4_curve

def exercise4_curve(tau_refrac):
  hugs = p.Population(1, cellclass=p.IF_cond_exp)
  hugs.set("tau_refrac", tau_refrac)
  start = 100.
  stop = 1100.
  frequency = []
  currentSpace = linspace(0.1,5.0,50)
  for current in currentSpace:
    hugs.record()
    hugs.record_v()
    dcsource = p.DCSource(amplitude=current, start=start, stop=stop)
    dcsource.inject_into(hugs)
    p.run(1100.)
    spikes = hugs.getSpikes()
    frequency.append(len(spikes) / (stop - start))
    print(current, frequency[-1])
    p.reset() 
  return currentSpace, frequency
开发者ID:nebw,项目名称:NeuronaleProzesse2011,代码行数:18,代码来源:day4exercise1.py


示例8: sim

def sim(trial):
    global direction
    global inspikes
    global outspikes
    global outspikes2
    global outvolts
    direction=0
    #print direction
    p.reset()
    #for direction in dirs:
    for n in range(len(neuron)):
      neuron[n].set('spike_times',DATA[direction][n][trial])

    p.run(2000)

    outspikes=[0,0]
    outspikes2=[]
    outvolts=[]
    for i,o in enumerate(out):
        outspikes[i]=o.get_spike_counts().values()[0]
        outspikes2.append(o.getSpikes())
        outvolts.append(o.get_v())
    inspikes=[0,0,0,0,0]

    for i,n in enumerate(neuron):
        inspikes[i]=n.get_spike_counts().values()[0]
        
    """  
    fig = figure()
    ax = fig.add_subplot(1,1,1)
    hold(True)
    for i in range(nout):
        ax.plot(outspikes2[i][:,1],i*ones_like(outspikes2[i][:,1]),'b|')
    ax.set_ylim(-6,5)
    for i in range(nneurons):
   
#    ax.plot(DATA[direction][i][trial],-1-i*ones_like(DATA[direction][i][trial]),'r|')
        inspikes2=neuron[i].getSpikes()
        ax.plot(inspikes2,-1-i*ones_like(inspikes2),'r|')
    #ax2=fig.add_subplot(2,1,2)
    #ax2.plot(outvolts[0][:,1],outvolts[0][:,2])
    """
    return inspikes,outspikes
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:43,代码来源:02basic.py


示例9: exercise3

def exercise3():
  figure(figsize=(10,6))
  p.setup(quit_on_end=False, timestep=0.01)
  iandf = p.Population(1, cellclass=p.IF_cond_exp)
  dcsource = p.DCSource(amplitude=1., start=100., stop=1000.)
  dcsource.inject_into(iandf)
  iandf.record()
  iandf.record_v()
  p.run(1200.)
  pot = iandf.get_v()
  spikes = iandf.getSpikes()
  plt = plot(pot[:,1], pot[:,2], color='b')
  spks = plot(spikes[:,1], [-49]*len(spikes), '.', color='r')
  legend((plt, spks), ('Membrane potential', 'Spike times'))
  xlabel('Time/ms')
  ylabel('Current/mV')
  title('Integrate and fire model neuron')
  savefig('../output/day4_figure3.png')
  show()
开发者ID:nebw,项目名称:NeuronaleProzesse2011,代码行数:19,代码来源:day4exercise1.py


示例10: exercise1

def exercise1():
    hugs = p.Population(1, cellclass=p.HH_cond_exp)
    dcsource = p.DCSource(amplitude=1.0, start=100.0, stop=600)
    dcsource.inject_into(hugs)

    hugs.record()
    hugs.record_v()

    p.run(1000.0)

    pot = hugs.get_v()
    spikes = hugs.getSpikes()

    plot(pot[:, 1], pot[:, 2])
    plot(spikes[:, 1], [-40] * len(spikes), ".", color="r")
    line = axhline(y=-40, xmin=0, xmax=len(pot[:, 1]), color="r")
    xlabel("Time/ms")
    ylabel("Current/mV")
    savefig("../output/day4_figure1.png")
    show()
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:20,代码来源:day4exercise1.py


示例11: exercise2

def exercise2():
    hugs = p.Population(1, cellclass=p.HH_cond_exp)
    start = 100.0
    stop = 1100.0
    frequency = []
    currentSpace = linspace(0.1, 10, 100)
    for current in currentSpace:
        hugs.record()
        hugs.record_v()
        dcsource = p.DCSource(amplitude=current, start=start, stop=stop)
        dcsource.inject_into(hugs)
        p.run(1100.0)
        spikes = hugs.getSpikes()
        frequency.append(len(spikes) / (stop - start))
        p.reset()
    plot(currentSpace, frequency)
    xlabel("Current/nA")
    ylabel("Frequency/kHz")
    savefig("../output/day4_figure2.png")
    show()
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:20,代码来源:day4exercise1.py


示例12: exercise1

def exercise1():
    figure(figsize=(10,6))

    hugs = p.Population(1, cellclass=p.HH_cond_exp)
    dcsource = p.DCSource(amplitude=1., start=100., stop=600)
    dcsource.inject_into(hugs)

    hugs.record()
    hugs.record_v()

    p.run(1000.)

    pot = hugs.get_v()
    spikes = hugs.getSpikes()

    plt = plot(pot[:,1], pot[:,2])
    spks = plot(spikes[:,1], [52]*len(spikes), 'D', color='r')
    xlabel('Time/ms')
    ylabel('Current/mV')
    legend((plt, spks), ('Membrane potential', 'Spike times'))
    title('Hodgkin-Huxley model neuron')
    savefig('../output/day4_figure1.png')
    show()
开发者ID:nebw,项目名称:NeuronaleProzesse2011,代码行数:23,代码来源:day4exercise1.py


示例13: exercise2

def exercise2():
  figure(figsize=(10,6))

  hugs = p.Population(1, cellclass=p.HH_cond_exp)
  start = 100.
  stop = 1100.
  frequency = []
  currentSpace = linspace(0.1,10,100)
  for current in currentSpace:
    hugs.record()
    hugs.record_v()
    dcsource = p.DCSource(amplitude=current, start=start, stop=stop)
    dcsource.inject_into(hugs)
    p.run(1100.)
    spikes = hugs.getSpikes()
    frequency.append(len(spikes) / (stop - start))
    p.reset() 
  plot(currentSpace, frequency)
  title('Current-frequency diagram for a HH model neuron')
  xlabel('Current/nA')
  ylabel('Frequency/kHz')
  savefig('../output/day4_figure2.png')
  show()
开发者ID:nebw,项目名称:NeuronaleProzesse2011,代码行数:23,代码来源:day4exercise1.py


示例14: exercise5

def exercise5(tau_m, v_thresh=-55.0):
    hugs = p.Population(1, cellclass=p.IF_cond_exp)
    hugs.set("tau_refrac", 2.0)
    hugs.set("tau_m", tau_m)
    hugs.set("v_thresh", v_thresh)

    start = 100.0
    stop = 400.0

    dcsource = p.DCSource(amplitude=0.95, start=start, stop=stop)
    dcsource.inject_into(hugs)

    hugs.record()
    hugs.record_v()

    p.run(500.0)

    pot = hugs.get_v()
    spikes = hugs.getSpikes()

    p.reset()

    return pot, spikes, (stop - start)
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:23,代码来源:day4exercise1.py


示例15: simulate

def simulate():
    global direction
    global inspikes
    global outspikes
    global outspikes2
    global outvolts
    global prj
    print "Simulating..."
    # set inputs
    for ntrial in range(ntrials):
	for direction in dirs:
	    print "Training direction:", direction, ", trial:", ntrial+1
	    print "Reading data:"
	    trainingset = [DATA[direction][nneuron][ntrial] for nneuron in range(nneurons)]
	    trainingset = [trainingset[i][startstimulus < trainingset[i]] for i in range(nneurons)]
	    trainingset = [trainingset[i][trainingset[i] < endstimulus] for i in range(nneurons)]

	    # run simulation
	    p.reset()
	    for o in out:
		o.record()
		o.record_v()
	    for i, neuron in enumerate(neurons):
		neuron.set('spike_times', trainingset[i])
		#neuron[nneuron].set('spike_times',arange(1,1901,100))
		neuron.record()

	    p.run(2000)

	    outSpikeTimes = [[] for i in range(nout)]
	    outvolts = [[] for i in range(nout)]
	    ## plot spike trains
	    #fig = figure()
	    #hold(True)
	    #ax = fig.add_subplot(1,1,1)
	    #title("Direction "+str(direction)+", Trial "+str(ntrial+1))
	    for j, o in enumerate(out):
		spikes = list(o.getSpikes()[:,1])
		#print j, spikes, len(spikes), type(spikes)
		outSpikeTimes[j] = spikes
		outvolts[j] = o.get_v()
		print "--------------------------------"
		#print j, outSpikeTimes[j], len(outSpikeTimes[j])
		
		#ax.plot(outSpikeTimes[j], [j]*len(outSpikeTimes[j]), 'b|', markersize = 20.)

	    inspikes=[0 for i in range(nneurons)]
	    outspikes=[0 for i in range(nout)]
	    outspikes2=[]
	    outvolts=[]
	    for i,o in enumerate(out):
		outspikes[i] = o.get_spike_counts().values()[0]
		#outspikes2.append(o.getSpikes())
		outvolts.append(o.get_v())

	    for i,neuron in enumerate(neurons):
		inspikes[i] = neurons[i].get_spike_counts().values()[0]
		#print inspikes[i]

	    def learn():
		global direction
		global inspikes
		global outspikes
		global outspikes2
		global outvolts
		print "Learning..."
		#-----------------------------------------------------
		def updateWeights():
		    global direction
		    global inspikes
		    global outspikes
		    global outspikes2
		    global outvolts
		    global prj
		    print "outspikes:", outspikes
		    print "Updating..."
		    adjust=0.02
		    negadjust=0.02
		    nmax=inspikes.index(max(inspikes))
		    if (outspikes[0]<outspikes[1]) and (direction==dirs[1]):
			prj[2*nmax+1].setWeights(prj[2*nmax+1].getWeights()[0]+adjust)
			print 'correct 0'
			print "Updated to:", prj[2*nmax+1].getWeights()
		    elif (outspikes[0]>outspikes[1]) and (direction==dirs[0]): 
			prj[2*nmax+0].setWeights(prj[2*nmax+0].getWeights()[0]+adjust)
			print 'correct 3'
			print "Updated to:", prj[2*nmax+0].getWeights()
		    elif (outspikes[0]>=outspikes[1]) and (direction==dirs[1]):
			print 'wrong 0'
			prj[2*nmax+0].setWeights(max(0,prj[2*nmax+0].getWeights()[0]-negadjust))
			print "Updated to:", prj[2*nmax+0].getWeights()
		    elif (outspikes[0]<=outspikes[1]) and (direction==dirs[0]):
			prj[2*nmax+1].setWeights(max(0,prj[2*nmax+1].getWeights()[0]-negadjust))
			print 'wrong 3' 
			print "Updated to:", prj[2*nmax+1].getWeights()
		    else:
			print 'no 5'
		    print
		updateWeights()
		#-----------------------------------------------------
#.........这里部分代码省略.........
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:101,代码来源:03_train_and_validate.py


示例16: validate

def validate():
    global direction
    global inspikes
    global outspikes
    global outspikes2
    global outvolts
    global prj
    
    prj = []
    for i in range(nneurons):
	for j in range(nout):
	    prj.append(p.Projection(neurons[i], out[j], target="excitatory",method=p.AllToAllConnector()))
	    prj[-1].setWeights(initweight)
    goodWeights = pickle.load(open("goodWeightsFile.pkl"))
    for i, pr in enumerate(prj):
	print goodWeights[i], pr
	pr.setWeights(goodWeights[i])
    print "Validating..."
    # set inputs
    for ntrial in range(ntrials, ntrials+nindependents):
	for direction in dirs:
	    print "Checking direction:", direction, ", trial:", ntrial+1
	    print "Reading data:"
	    trainingset = [DATA[direction][nneuron][ntrial] for nneuron in range(nneurons)]
	    trainingset = [trainingset[i][startstimulus < trainingset[i]] for i in range(nneurons)]
	    trainingset = [trainingset[i][trainingset[i] < endstimulus] for i in range(nneurons)]
	    #import pdb; pdb.set_trace()

	    # run simulation
	    p.reset()
	    for o in out:
		o.record()
		o.record_v()
	    for i, neuron in enumerate(neurons):
		neuron.set('spike_times', trainingset[i])
		#neuron[nneuron].set('spike_times',arange(1,1901,100))
		neuron.record()

	    p.run(2000)

	    outSpikeTimes = [[] for i in range(nout)]
	    outvolts = [[] for i in range(nout)]
	    ## plot spike trains
	    #fig = figure()
	    #hold(True)
	    #ax = fig.add_subplot(1,1,1)
	    #title("Direction "+str(direction)+", Trial "+str(ntrial+1))
	    for j, o in enumerate(out):
		spikes = list(o.getSpikes()[:,1])
		#print j, spikes, len(spikes), type(spikes)
		outSpikeTimes[j] = spikes
		outvolts[j] = o.get_v()
		#print j, outSpikeTimes[j], len(outSpikeTimes[j])
		
		#ax.plot(outSpikeTimes[j], [j]*len(outSpikeTimes[j]), 'b|', markersize = 20.)

	    inspikes=[0 for i in range(nneurons)]
	    outspikes=[0 for i in range(nout)]
	    outspikes2=[]
	    outvolts=[]
	    for i,o in enumerate(out):
		outspikes[i] = o.get_spike_counts().values()[0]
		#outspikes2.append(o.getSpikes())
		outvolts.append(o.get_v())
	    print "outspikes:", outspikes

	    for i,neuron in enumerate(neurons):
		inspikes[i] = neurons[i].get_spike_counts().values()[0]
		#print inspikes[i]

	    def check():
		global direction
		global inspikes
		global outspikes
		global outspikes2
		global outvolts
		print "Learning..."
		#-----------------------------------------------------
		def printWeights():
		    global direction
		    global inspikes
		    global outspikes
		    global outspikes2
		    global outvolts
		    global prj
		    print "outspikes:", outspikes
		    adjust=0.02
		    negadjust=0.02
		    nmax=inspikes.index(max(inspikes))
		    if (outspikes[0]<outspikes[1]) and (direction==dirs[1]):
			print 'correct 0'
		    elif (outspikes[0]>outspikes[1]) and (direction==dirs[0]): 
			print 'correct 3'
		    elif (outspikes[0]>=outspikes[1]) and (direction==dirs[1]):
			print 'wrong 0'
		    elif (outspikes[0]<=outspikes[1]) and (direction==dirs[0]):
			print 'wrong 3' 
		    else:
			print 'no 5'
		    print
#.........这里部分代码省略.........
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:101,代码来源:03_train_and_validate.py


示例17: gen

        return gen()
assert generate_spike_times(0).max() > simtime

spike_source = sim.Population(n, sim.SpikeSourceArray(spike_times=generate_spike_times))

spike_source.record('spikes')
cells.record('spikes')
cells[0:2].record('m')

syn = sim.StaticSynapse(weight=w, delay=syn_delay)
input_conns = sim.Projection(spike_source, cells, sim.FixedProbabilityConnector(0.5), syn,
                             receptor_type="default")

# === Run simulation ===========================================================

sim.run(simtime)

filename = normalized_filename("Results", "small_network", "pkl",
                               "neuron", sim.num_processes())
cells.write_data(filename, annotations={'script_name': __file__})

print("Mean firing rate: ", cells.mean_spike_count() * 1000.0 / simtime, "Hz")

plot_figure = True
if plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = filename.replace("pkl", "png")
    data = cells.get_data().segments[0]
    m = data.filter(name="m")[0]
    Figure(
        Panel(m, ylabel="Membrane potential (dimensionless)", yticks=True, ylim=(0,1)),
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:31,代码来源:nrn_artificial_cell.py


示例18: range

	print "Reading data:"
	trainingset = [DATA[direction][nneuron][ntrial] for nneuron in range(nneurons)]
	trainingset = [trainingset[i][startstimulus < trainingset[i]] for i in range(nneurons)]
	trainingset = [trainingset[i][trainingset[i] < endstimulus] for i in range(nneurons)]

	# run simulation
	p.reset()
	for o in out:
	    o.record()
	    o.record_v()
	for i, neuron in enumerate(neurons):
	    neuron.set('spike_times', trainingset[i])
	    #neuron[nneuron].set('spike_times',arange(1,1901,100))
	    neuron.record()

	p.run(2000)

	outSpikeTimes = [[] for i in range(nout)]
	outvolts = [[] for i in range(nout)]
	## plot spike trains
	#fig = figure()
	#hold(True)
	#ax = fig.add_subplot(1,1,1)
	#title("Direction "+str(direction)+", Trial "+str(ntrial+1))
	for j, o in enumerate(out):
	    spikes = list(o.getSpikes()[:,1])
	    #print j, spikes, len(spikes), type(spikes)
	    outSpikeTimes[j] = spikes
	    outvolts[j] = o.get_v()
	    print "--------------------------------"
	    #print j, outSpikeTimes[j], len(outSpikeTimes[j])
开发者ID:gittenberg,项目名称:NeuronaleProzesse2011,代码行数:31,代码来源:01createDATA.py


示例19:

"""

"""

from plot_helper import plot_current_source
import pyNN.neuron as sim

sim.setup()

population = sim.Population(30, sim.IF_cond_exp(tau_m=10.0))
population[0:1].record_v()

noise = sim.NoisyCurrentSource(mean=1.5, stdev=1.0, start=50.0, stop=450.0,
                               dt=1.0)
population.inject(noise)
noise._record()

sim.run(500.0)

t, i_inj = noise._get_data()
v = population.get_data().segments[0].analogsignals[0]

plot_current_source(t, i_inj, v,
                    v_range=(-66, -48),
                    v_ticks=(-65, -60, -55, -50),
                    i_range=(-3, 5),
                    i_ticks=range(-2, 6, 2),
                    t_range=(0, 500))
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:28,代码来源:noise_source.py


示例20:

"""

"""

from plot_helper import plot_current_source
import pyNN.neuron as sim

sim.setup()

population = sim.Population(30, sim.IF_cond_exp(tau_m=10.0))
population[27:28].record_v()

steps = sim.StepCurrentSource(times=[50.0, 110.0, 150.0, 210.0],
                              amplitudes=[0.4, 0.6, -0.2, 0.2])
steps.inject_into(population[(6, 11, 27)])
steps._record()

sim.run(250.0)

t, i_inj = steps._get_data()
v = population.get_data().segments[0].analogsignalarrays[0]

plot_current_source(t, i_inj, v,
                    #v_range=(-66, -49),
                    v_ticks=(-66, -64, -62, -60),
                    i_range=(-0.3, 0.7),
                    i_ticks=(-0.2, 0.0, 0.2, 0.4, 0.6),
                    t_range=(0, 250))
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:28,代码来源:step_source.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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