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

Python nest.run函数代码示例

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

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



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

示例1: main

def main():
    # setup timestep of simulation and minimum and maximum synaptic delays
    setup(timestep=simulationTimestep, min_delay=minSynapseDelay, max_delay=maxSynapseDelay)
    
    # create a spike sources
    retinaLeft = createSpikeSource("Retina Left")
    retinaRight = createSpikeSource("Retina Right")
    
    # create network and attach the spike sources 
    network = createCooperativeNetwork(retinaLeft=retinaLeft, retinaRight=retinaRight)
    
    # run simulation for time in milliseconds
    print "Simulation started..."
    run(simulationTime)
    print "Simulation ended."
    # plot results 
    from itertools import repeat
    numberOfLayersToPlot = 4
    layers = zip(repeat(network, numberOfLayersToPlot), range(1, numberOfLayersToPlot+1), repeat(False, numberOfLayersToPlot))
    customLayers = [(network, 20, False),(network, 40, False),(network, 60, False),(network, 80, False)]
    for proc in range(0, numberOfLayersToPlot):
        p = Process(target=plotSimulationResults, args=customLayers[proc])
        p.start()
    
    # finalise program and simulation
    end()
开发者ID:AMFtech,项目名称:StereoMatching,代码行数:26,代码来源:CooperativeNetwork.py


示例2: two_neuron_example

def two_neuron_example(
    current=1000.0,
    time_simulation=2000.0,
    weight=0.4,
    neuron_parameters={"v_rest": -50.0, "cm": 1, "tau_m": 20.0, "tau_refrac": 5.0, "v_thresh": -40.0, "v_reset": -50.0},
):

    sim.setup(timestep=0.1, min_delay=0.1)

    pulse = sim.DCSource(amplitude=current, start=0.0, stop=time_simulation)

    pre = sim.Population(1, sim.IF_curr_exp(**neuron_parameters))

    pre.record("spikes")

    pulse.inject_into(pre)

    sim.run(time_simulation)

    # rates in Hz
    rate_pre = len(pre.get_data("spikes").segments[0].spiketrains[0]) / time_simulation * 1000.0

    sim.end()

    return rate_pre
开发者ID:knly,项目名称:bic-ws1516,代码行数:25,代码来源:exercise2.py


示例3: run

    def run(self, spiketimes):
        assert spiketimes.shape[0] == self.n_spike_source, 'spiketimes length should be equal to input neurons'
        start = time.clock()
        sim.reset()
        end = time.clock()
        print "reset uses %f s." % (end - start)
        for i in range(self.n_spike_source):
            spiketime = np.array(spiketimes[i], dtype=float)
            if spiketimes[i].any():
                self.spike_source[i].spike_times = spiketime

        sim.initialize(self.hidden_neurons, V_m=0)
        sim.initialize(self.output_neurons, V_m=0.)
        sim.run(self.sim_time)

        spiketrains = self.output_neurons.get_data(clear=True).segments[0].spiketrains

        # vtrace = self.hidden_neurons.get_data(clear=True).segments[0].filter(name='V_m')[0]
        # plt.figure()
        # plt.plot(vtrace.times, vtrace)
        # plt.show()

        hidden_spiketrains = self.hidden_neurons.get_data(clear=True).segments[0].spiketrains
        spike_cnts = 0
        for spiketrain in hidden_spiketrains:
            spike_cnts += len(list(np.array(spiketrain)))
        self.hidden_spike_cnts.append(spike_cnts)
        print 'hidden spikes: ', spike_cnts

        spiketimes_out = []
        for spiketrain in spiketrains:
            spiketimes_out.append(list(np.array(spiketrain)))


        return np.array(spiketimes_out)
开发者ID:starlitnext,项目名称:SpikingRNN,代码行数:35,代码来源:rsnn_sim_int.py


示例4: sim_neuron

def sim_neuron(rate):
	neuron_parameters={
            'v_rest'     : -50.0,
            'cm'         : 1,
            'tau_m'      : 20.0,
            'tau_syn_E'  : 5.0,
            'tau_syn_I'  : 5.0,
            'v_reset'    : -50.0,
            'v_thresh'   : 10000000000000000000000000000000000000000000000000000000000000000000000.0,
            'e_rev_E'	 : 0.0,
            'e_rev_I'	 : -100,
	}
	time_simulation = 100000 # don't choose to small number in order to get good statistics
	weight = 0.1 # is this value allreight
	sim.setup(timestep=0.1, min_delay=0.1)
	
	pois_exc = sim.SpikeSourcePoisson(duration=time_simulation,start=0.0,rate=rate) # generate poisson rate stimulus
	pois_inh = sim.SpikeSourcePoisson(duration=time_simulation,start=0.0,rate=rate) # generate poisson rate stimulus
	exc = sim.Population(1, cellclass=pois_exc) # simulate excitatory cell
	inh = sim.Population(1, cellclass=pois_inh) # simulate inhibitory cell
	
	rec = sim.Population(1, sim.IF_cond_exp(**neuron_parameters)) # simulate receiving neuron

	sim.Projection(exc, rec, connector=sim.OneToOneConnector(),synapse_type=sim.StaticSynapse(weight=weight),receptor_type='excitatory') # connect excitatory neuron to receiver
	sim.Projection(inh, rec, connector=sim.OneToOneConnector(),synapse_type=sim.StaticSynapse(weight=weight),receptor_type='inhibitory') # connect inhibitory neuron to receiver

	rec.record('v') # record membrane potential
	rec.record('gsyn_exc') # record excitatory conductance
	rec.record('gsyn_inh') # record inhibitory conductance
	sim.run(time_simulation) # start simulation

	return rec.get_data('v').segments[0].analogsignalarrays[0], rec.get_data('gsyn_exc').segments[0].analogsignalarrays[0], rec.get_data('gsyn_inh').segments[0].analogsignalarrays[0] # return membrane potential, excitatory conductance, inhibitory conductance
开发者ID:knly,项目名称:bic-ws1516,代码行数:32,代码来源:exercise1.py


示例5: main

def main(args):

    setup(timestep=0.1)

    random_image = np.random.rand(2,2)
    size = random_image.size


    input_population_arr = Population(random_image.size, SpikeSourceArray, {'spike_times': [0 for i in range(0, random_image.size)]})

    cell_params = {'tau_refrac': 2.0, 'v_thresh': -50.0, 'tau_syn_E': 2.0, 'tau_syn_I': 2.0}
    output_population = Population(1, IF_curr_alpha, cell_params, label="output")

    projection = Projection(input_population_arr, output_population, AllToAllConnector())
    projection.setWeights(1.0)

    input_population_arr.record('spikes')
    output_population.record('spikes')

    tstop = 1000.0

    run(tstop)

    output_population.write_data("simpleNetwork_output.pkl",'spikes')
    input_population_arr.write_data("simpleNetwork_input.pkl",'spikes')
    #output_population.print_v("simpleNetwork.v")
    end()
开发者ID:danielgeier,项目名称:ml2-spiking,代码行数:27,代码来源:population_example.py


示例6: run_test

def run_test(w_list, cell_para, spike_source_data):
    pop_list = []
    p.setup(timestep=1.0, min_delay=1.0, max_delay=3.0)
    #input poisson layer
    input_size = w_list[0].shape[0]
    pop_in = p.Population(input_size, p.SpikeSourceArray, {'spike_times' : []})
    for j in range(input_size):
        pop_in[j].spike_times = spike_source_data[j]
    pop_list.append(pop_in)
    
    for w in w_list:        
        pos_w = np.copy(w)
        pos_w[pos_w < 0] = 0
        neg_w = np.copy(w)
        neg_w[neg_w > 0] = 0
        
        output_size = w.shape[1]
        pop_out = p.Population(output_size, p.IF_curr_exp, cell_para)
        p.Projection(pop_in, pop_out, p.AllToAllConnector(weights = pos_w), target='excitatory')
        p.Projection(pop_in, pop_out, p.AllToAllConnector(weights = neg_w), target='inhibitory')
        pop_list.append(pop_out)
        pop_in = pop_out

    pop_out.record()
    run_time = np.ceil(np.max(spike_source_data)[0]/1000.)*1000
    p.run(run_time)
    spikes = pop_out.getSpikes(compatible_output=True)
    return spikes
开发者ID:qian-liu,项目名称:iconip2016,代码行数:28,代码来源:spiking_relu.py


示例7: compute

    def compute(self, proximal, distal=None):
        if distal is not None:
            for i, times in enumerate(distal):
                self.distal_input[i].spike_times = times

        active = []
        predictive = []

        if not (isinstance(proximal[0], list) or isinstance(proximal[0], np.ndarray)):
            proximal = [proximal]

        timestep = self.parameters.config.timestep

        for p in proximal:
            t = pynn.get_current_time()
            for c in p:
                self.proximal_input[int(c)].spike_times = np.array([t + 0.01])
            pynn.run(self.parameters.config.timestep)

            spikes_soma = self.soma.getSpikes()
            mask = (spikes_soma[:,1] >= t) & (spikes_soma[:,1] < t + timestep)
            active.append(np.unique(spikes_soma[mask,0]))

            spikes_distal = self.distal.getSpikes()
            mask = (spikes_distal[:,1] >= t) & (spikes_distal[:,1] < t + timestep)
            predictive.append(np.unique(spikes_distal[mask,0].astype(np.int16)/2))

        return (active, predictive)
开发者ID:subutai,项目名称:htm-hardware,代码行数:28,代码来源:temporal_memory.py


示例8: test_ticket244

def test_ticket244():
    nest = pyNN.nest
    nest.setup(threads=4)
    p1 = nest.Population(4, nest.IF_curr_exp())
    p1.record('spikes')
    poisson_generator = nest.Population(3, nest.SpikeSourcePoisson(rate=1000.0))
    conn = nest.OneToOneConnector()
    syn = nest.StaticSynapse(weight=1.0)
    nest.Projection(poisson_generator, p1.sample(3), conn, syn, receptor_type="excitatory")
    nest.run(15)
    p1.get_data()
开发者ID:mfraezz,项目名称:PyNN,代码行数:11,代码来源:test_nest.py


示例9: two_neuron_example

def two_neuron_example(
        current=1000.0,
        time_simulation=2000.,
        weight=0.4,
        neuron_parameters={
            'v_rest'     : -65.0,
            'cm'         : 0.1,
            'tau_m'      : 1.0,
            'tau_refrac' : 2.0,
            'tau_syn_E'  : 10.0,
            'tau_syn_I'  : 10.0,
            'i_offset'   : 0.0,
            'v_reset'    : -65.0,
            'v_thresh'   : -50.0,
        },
    ):
    """
        Connects to neurons with corresponding parameters.

        The first is stimulated via current injection while the second receives
        the other one's spikes.
    """

    sim.setup(timestep=0.1, min_delay=0.1)

    pulse = sim.DCSource(amplitude=current, start=0.0, stop=time_simulation)

    pre = sim.Population(1, sim.IF_curr_exp(**neuron_parameters))
    post = sim.Population(1, sim.IF_curr_exp(**neuron_parameters))

    pre.record('spikes')
    post.record('spikes')

    sim.Projection(pre, post, connector=sim.OneToOneConnector(),
            synapse_type=sim.StaticSynapse(weight=weight),
            receptor_type='excitatory')

    pulse.inject_into(pre)

    sim.run(time_simulation)

    # rates in Hz
    rate_pre = len(pre.get_data('spikes').segments[0].spiketrains[0])\
            / time_simulation * 1000.

    rate_post = len(post.get_data('spikes').segments[0].spiketrains[0])\
            / time_simulation * 1000.

    sim.end()

    return rate_pre, rate_post
开发者ID:knly,项目名称:bic-ws1516,代码行数:51,代码来源:bic_sh01_ex03_code.py


示例10: loop

def loop():
    for device_instance in Interfaces.DeviceMeta._instances:
        device_instance._create_device()
    print "Entered loop"
    i = 0
    
    while(True):
        sim.run(20.0)
        Observers.Observer.notify()
        Setters.Setter.notify()
        SimulatorPorts.RPCPort.execute()
        for pop_view in population_register.values():
            pass
            #print pop_view.meanSpikeCount()
            #print 'amplitude', pop_view.get_data().segments[0].filter(name='v')
            #print nest.GetStatus(map(int, [pop_view.all_cells[0]]), 'V_m')

        i += 1
    sim.end()
开发者ID:uahic,项目名称:music_wizard,代码行数:19,代码来源:simulator_node.py


示例11: test_record_native_model

def test_record_native_model():
    if not have_nest:
        raise SkipTest
    nest = pyNN.nest
    from pyNN.random import RandomDistribution

    init_logging(logfile=None, debug=True)

    nest.setup()

    parameters = {'tau_m': 17.0}
    n_cells = 10
    p1 = nest.Population(n_cells, nest.native_cell_type("ht_neuron")(**parameters))
    p1.initialize(V_m=-70.0, Theta=-50.0)
    p1.set(theta_eq=-51.5)
    #assert_arrays_equal(p1.get('theta_eq'), -51.5*numpy.ones((10,)))
    assert_equal(p1.get('theta_eq'), -51.5)
    print(p1.get('tau_m'))
    p1.set(tau_m=RandomDistribution('uniform', low=15.0, high=20.0))
    print(p1.get('tau_m'))

    current_source = nest.StepCurrentSource(times=[50.0, 110.0, 150.0, 210.0],
                                            amplitudes=[0.01, 0.02, -0.02, 0.01])
    p1.inject(current_source)

    p2 = nest.Population(1, nest.native_cell_type("poisson_generator")(rate=200.0))

    print("Setting up recording")
    p2.record('spikes')
    p1.record('V_m')

    connector = nest.AllToAllConnector()
    syn = nest.StaticSynapse(weight=0.001)

    prj_ampa = nest.Projection(p2, p1, connector, syn, receptor_type='AMPA')

    tstop = 250.0
    nest.run(tstop)

    vm = p1.get_data().segments[0].analogsignals[0]
    n_points = int(tstop / nest.get_time_step()) + 1
    assert_equal(vm.shape, (n_points, n_cells))
    assert vm.max() > 0.0  # should have some spikes
开发者ID:antolikjan,项目名称:PyNN,代码行数:43,代码来源:test_nest.py


示例12: scnn_test

def scnn_test(l_cnn, w_cnn, num_test, test, max_rate, dur_test, silence):
    p.setup(timestep=1.0, min_delay=1.0, max_delay=3.0)
    L = l_cnn
    random.seed(0)
    input_size = L[0][1]
    pops_list = []
    pops_list.append(init_inputlayer(input_size, test[:num_test, :], max_rate, dur_test, silence))
    for l in range(len(w_cnn)):
        pops_list.append(construct_layer(pops_list[l], L[l+1][0], L[l+1][1], w_cnn[l]))
    result = pops_list[-1][0]
    result.record()
    
    p.run((dur_test+silence)*num_test)
    spike_result = result.getSpikes(compatible_output=True)
    p.end()
    
    spike_result_count = count_spikes(spike_result, 10, num_test, dur_test, silence)
    predict = np.argmax(spike_result_count, axis=0)
#     prob = np.exp(spike_result_count)/np.sum(np.exp(spike_result_count), axis=0)
    return predict
开发者ID:qian-liu,项目名称:iconip2016,代码行数:20,代码来源:scnn_sim.py


示例13: test_record_native_model

def test_record_native_model():
    nest = pyNN.nest
    from pyNN.random import RandomDistribution
    from pyNN.utility import init_logging

    init_logging(logfile=None, debug=True)
    
    nest.setup()
    
    parameters = {'Tau_m': 17.0}
    n_cells = 10
    p1 = nest.Population(n_cells, nest.native_cell_type("ht_neuron"), parameters)
    p1.initialize('V_m', -70.0)
    p1.initialize('Theta', -50.0)
    p1.set('Theta_eq', -51.5)
    assert_equal(p1.get('Theta_eq'), [-51.5]*10)
    print p1.get('Tau_m')
    p1.rset('Tau_m', RandomDistribution('uniform', [15.0, 20.0]))
    print p1.get('Tau_m')
    
    current_source = nest.StepCurrentSource({'times' : [50.0, 110.0, 150.0, 210.0],
                                            'amplitudes' : [0.01, 0.02, -0.02, 0.01]})
    p1.inject(current_source)
    
    p2 = nest.Population(1, nest.native_cell_type("poisson_generator"), {'rate': 200.0})
    
    print "Setting up recording"
    p2.record()
    p1._record('V_m')
    
    connector = nest.AllToAllConnector(weights=0.001)
    
    prj_ampa = nest.Projection(p2, p1, connector, target='AMPA')
    
    tstop = 250.0
    nest.run(tstop)
    
    n_points = int(tstop/nest.get_time_step()) + 1
    assert_equal(p1.recorders['V_m'].get().shape, (n_points*n_cells, 3))
    id, t, v = p1.recorders['V_m'].get().T
    assert v.max() > 0.0 # should have some spikes
开发者ID:agravier,项目名称:pynn,代码行数:41,代码来源:test_nest.py


示例14: compute

    def compute(self, data, learn=True):
        """Perform the actual computation"""

        timestep = self.parameters.config.timestep

        # run simulation
        for i, d in enumerate(data):
            t = pynn.get_current_time()
            d = d.astype(np.int32)
            activity = np.array(self.calculate_activity([d]))
            train = np.ndarray((np.sum(activity), 2))
            pos = 0
            for j in range(len(self.stimulus)):
                spikes = np.sort(np.random.normal(1.0 + t, 0.01, activity[0][j]))
                train[pos:pos+activity[0][j],:] = np.vstack([np.ones(spikes.size)*j, spikes]).T
                pos += activity[0][j]
            for j, s in enumerate(self.stimulus):
                s.spike_times = train[train[:,0] == j,1]

            pynn.run(timestep)

            # extract spikes and calculate activity
            spikes = self.columns.getSpikes()
            mask = (spikes[:,1] > t) & (spikes[:,1] < t + timestep)
            active_columns = np.unique(spikes[mask,0]).astype(np.int32)
            yield active_columns

            if learn > 0:
                # wake up, school's starting in five minutes!
                c = np.zeros(self.permanences.shape[0], dtype=np.bool)
                c[active_columns] = 1
                d = d.astype(np.bool)
                self.permanences[np.outer(c, d)] += 0.01
                self.permanences[np.outer(c, np.invert(d))] -= 0.01
                self.permanences = np.minimum(np.maximum(self.permanences, 0), 1)

                if type(learn) == int:
                    learn -= 1
开发者ID:subutai,项目名称:htm-hardware,代码行数:38,代码来源:spatial_pooler.py


示例15: test_column_input

def test_column_input():
    """
    Tests whether all neurons receive the same feedforward input from
    common proximal dendrite.
    """
    
    LOG.info('Testing column input...')
    
    # reset the simulator
    sim.reset()
    
    column = Column.Column()
    sim.run(1000)
    spikes = column.FetchSpikes()
    print('Spikes before: {}'.format(spikes))
    
    # now stream some input into the column
    column.SetFeedforwardDendrite(1000.0)
    sim.run(1000)
    spikes = column.FetchSpikes().segments[0]
    print('Spikes after: {}'.format(spikes))
    
    LOG.info('Test complete.')
开发者ID:codeteam17,项目名称:spiked,代码行数:23,代码来源:test_column.py


示例16: test_encoder_rate_1

def test_encoder_rate_1():
    """
    Checks if encoder is properly encoding provided values.
    """

    encoder = ScalarEncoder.ScalarEncoder(
        size=10, width=1, min_val=0, max_val=10)
    encoder.encode(5.0)

    sim.run(100)

    rate = encoder.population.getSpikes()
    voltages = encoder.population.get_v().segments[0]
    
    pdb.set_trace()
    
    plot_signal(voltages, 1)
    
    # get index of maximum rate neuron
    idx_max = np.argmax(rate)
    LOG.info(rate)
    LOG.info('Max firing rate: {}'.format(idx_max))

    assert idx_max == 4  # indexing starts from zero
开发者ID:codeteam17,项目名称:spiked,代码行数:24,代码来源:test_encoder.py


示例17: _run_microcircuit

def _run_microcircuit(plot_filename, conf):
    import plotting
    import logging

    simulator = conf['simulator']
    # we here only need nest as simulator, simulator = 'nest'
    import pyNN.nest as sim

    # prepare simulation
    logging.basicConfig()

    # extract parameters from config file
    master_seed = conf['params_dict']['nest']['master_seed']
    layers = conf['layers']
    pops = conf['pops']
    plot_spiking_activity = conf['plot_spiking_activity']
    raster_t_min = conf['raster_t_min']
    raster_t_max = conf['raster_t_max']
    frac_to_plot = conf['frac_to_plot']
    record_corr = conf['params_dict']['nest']['record_corr']
    tau_max = conf['tau_max']

    # Numbers of neurons from which to record spikes
    n_rec = helper_functions.get_n_rec(conf)

    sim.setup(**conf['simulator_params'][simulator])

    if simulator == 'nest':
        n_vp = sim.nest.GetKernelStatus('total_num_virtual_procs')
        if sim.rank() == 0:
            print 'n_vp: ', n_vp
            print 'master_seed: ', master_seed
        sim.nest.SetKernelStatus({'print_time': False,
                                  'dict_miss_is_error': False,
                                  'grng_seed': master_seed,
                                  'rng_seeds': range(master_seed + 1,
                                                     master_seed + n_vp + 1),
                                  'data_path': conf['system_params'] \
                                                   ['output_path']})

    import network

    # result of export-files
    results = []

    # create network
    start_netw = time.time()
    n = network.Network(sim)

    # contains the GIDs of the spike detectors and voltmeters needed for
    # retrieving filenames later
    device_list = n.setup(sim, conf)

    end_netw = time.time()
    if sim.rank() == 0:
        print 'Creating the network took ', end_netw - start_netw, ' s'

    # simulate
    if sim.rank() == 0:
        print "Simulating..."
    start_sim = time.time()
    sim.run(conf['simulator_params'][simulator]['sim_duration'])
    end_sim = time.time()
    if sim.rank() == 0:
        print 'Simulation took ', end_sim - start_sim, ' s'

    # extract filename from device_list (spikedetector/voltmeter),
    # gid of neuron and thread. merge outputs from all threads
    # into a single file which is then added to the task output.
    for dev in device_list:
        label = sim.nest.GetStatus(dev)[0]['label']
        gid = sim.nest.GetStatus(dev)[0]['global_id']
        # use the file extension to distinguish between spike and voltage
        # output
        extension = sim.nest.GetStatus(dev)[0]['file_extension']
        if extension == 'gdf':  # spikes
            data = np.empty((0, 2))
        elif extension == 'dat':  # voltages
            data = np.empty((0, 3))
        for thread in xrange(conf['simulator_params']['nest']['threads']):
            filenames = glob.glob(conf['system_params']['output_path']
                                  + '%s-*%d-%d.%s' % (label, gid, thread, extension))
            assert(
                len(filenames) == 1), 'Multiple input files found. Use a clean output directory.'
            data = np.vstack([data, np.loadtxt(filenames[0])])
            # delete original files
            os.remove(filenames[0])
        order = np.argsort(data[:, 1])
        data = data[order]
        outputfile_name = 'collected_%s-%d.%s' % (label, gid, extension)
        outputfile = open(outputfile_name, 'w')
        # the outputfile should have same format as output from NEST.
        # i.e., [int, float] for spikes and [int, float, float] for voltages,
        # hence we write it line by line and assign the corresponding filetype
        if extension == 'gdf':  # spikes
            for line in data:
                outputfile.write('%d\t%.3f\n' % (line[0], line[1]))
            outputfile.close()
            filetype = 'application/vnd.juelich.nest.spike_times'

#.........这里部分代码省略.........
开发者ID:BerndSchuller,项目名称:UP-Tasks,代码行数:101,代码来源:microcircuit_task.py


示例18:


conn = [
    sim.Projection(input[0:1], cells, connector, target="AMPA_spikeinput"),
    sim.Projection(input[1:2], cells, connector, target="GABAa_spikeinput"),
    sim.Projection(input[2:3], cells, connector, target="GABAb_spikeinput"),
]


cells._record("iaf_V")
cells._record("AMPA_g")
cells._record("GABAa_g")
cells._record("GABAb_g")
cells.record()

sim.run(100.0)

cells.recorders["iaf_V"].write("Results/nineml_neuron.V", filter=[cells[0]])
cells.recorders["AMPA_g"].write("Results/nineml_neuron.g_exc", filter=[cells[0]])
cells.recorders["GABAa_g"].write("Results/nineml_neuron.g_gabaA", filter=[cells[0]])
cells.recorders["GABAb_g"].write("Results/nineml_neuron.g_gagaB", filter=[cells[0]])


t = cells.recorders["iaf_V"].get()[:, 1]
v = cells.recorders["iaf_V"].get()[:, 2]
gInhA = cells.recorders["GABAa_g"].get()[:, 2]
gInhB = cells.recorders["GABAb_g"].get()[:, 2]
gExc = cells.recorders["AMPA_g"].get()[:, 2]

import pylab
开发者ID:pgleeson,项目名称:nineml,代码行数:28,代码来源:example_modular_iaf_3coba_to_pynn_nest.py


示例19: xrange

        'e_rev_leak': ELeak,
        'e_rev_E'   : EIs[1],
        'e_rev_I'   : EIs[2],
        'tau_syn_E' : 0.2,
        'tau_syn_I' : 2.0,
        'i_offset'  : 0.0,
}

#vs = np.linspace(-75.0, EIs[0] + 5, 3)
vs = [-80.0, -61.0, -60.0]
neurons = [sim.create(sim.HH_cond_exp(**cellparams)) for _ in vs]
for i in xrange(len(vs)):
    neurons[i].record(["v"])
    neurons[i].initialize(v=vs[i])

sim.run(tEnd)

fig = plt.figure(figsize=(cm2inch(12.4), cm2inch(7)))
ax = fig.add_subplot(111)

#cmap = plt.cm.rainbow
#cmap = colors.LinearSegmentedColormap.from_list('blues', ['#729fcf', '#3465a4',
#        '#193a6b'])
lss = ['--', ':', '-']
#colors = iter(cmap(np.linspace(0, 1, len(vs))))
colors = iter(['#204a87'] * 3)
for i in xrange(len(vs)):
    data = neurons[i].get_data()
    signal_names = [s.name for s in data.segments[0].analogsignalarrays]
    vm = data.segments[0].analogsignalarrays[signal_names.index('v')]
    ax.plot(vm.times, vm, lss[i], color=next(colors),
开发者ID:hbp-sanncs,项目名称:master-thesis-astoeckel-2015,代码行数:31,代码来源:plot_hh_ap2.py


示例20: nt

import pyNN.nest as sim

parameters = {
 u'E_L': 0.0,
 u'I_e': 0.9, # 用这个参数来表示leaky
 u'V_reset': 0.0,
 u'V_th': 0.5,
 u't_ref': .0,
}

sim.setup(timestep=01.0)
nt = sim.native_cell_type('iaf_psc_delta_xxq')
n = sim.Population(1, nt(**parameters))
s = sim.Population(1, sim.SpikeSourceArray())
s[0].spike_times = [10, 15, 20, 30, 40]
p = sim.Projection(s, n, sim.FromListConnector([(0, 0, 0.00025, 0.01)]))
# p1 = sim.Projection(n, n, sim.FromListConnector([(0, 0, 0.00025, 1.0)]))
n.record('V_m')
n.record('V_m')
sim.initialize(n, V_m=0.)
sim.run(128.0)

vtrace = n.get_data(clear=True).segments[0].filter(name='V_m')[0]
print p.get(['weight'], format='array')

plt.figure()
plt.plot(vtrace.times, vtrace, 'o')
plt.ylim([0, 0.6])
plt.show()

sim.end()
开发者ID:starlitnext,项目名称:SpikingRNN,代码行数:31,代码来源:cell_type_test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python nest.setup函数代码示例发布时间:2022-05-25
下一篇:
Python mock.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