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

Python spiNNaker.run函数代码示例

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

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



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

示例1: run

    def run( self ):
        print( "starting simulation. length: %d" % self.time )
        self.populations['pop1'].record()
        self.populations['pop2'].record()
        self.populations['pop3'].record()

        p.run( self.time )

        self.plot_spikes( populations['pop1'], "population 1" )
        self.plot_spikes( populations['pop2'], "population 2" )
        self.plot_spikes( populations['pop3'], "population 3" )
开发者ID:msil,项目名称:spinnaker-workshop,代码行数:11,代码来源:synfire_if_curr_exp6.py


示例2: main

def main():
    # setup timestep of simulation and minimum and maximum synaptic delays
    setup(timestep=simulationTimestep, min_delay=minSynapseDelay, max_delay=maxSynapseDelay, threads=4)

    # 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  
    plotExperiment(retinaLeft, retinaRight, network)
    # finalise program and simulation
    end()
开发者ID:AMFtech,项目名称:StereoMatching,代码行数:20,代码来源:CooperativeNetwork.py


示例3:

what_statement_gate.record()
who_query_gate.record()
who_query_gate.record_v()
who_query_gate.record_gsyn()
where_query_gate.record()
what_query_gate.record()

dst_who.record()
dst_where.record()
dst_what.record()

who.record()
where.record()
what.record()

p.run(10 * 1000)

# src_pop_spikes = src_pop.getSpikes(compatible_output=True)
# who_statement_gate_spikes = who_statement_gate.getSpikes(compatible_output=True)
# who_statement_gate_v = who_statement_gate.get_v()
# who_statement_gate_i = who_statement_gate.get_gsyn()
# where_statement_gate_spikes = where_statement_gate.getSpikes(compatible_output=True)
# what_statement_gate_spikes = what_statement_gate.getSpikes(compatible_output=True)
# who_query_gate_spikes = who_query_gate.getSpikes(compatible_output=True)
# who_query_gate_v = who_query_gate.get_v()
# who_query_gate_i = who_query_gate.get_gsyn()
# where_query_gate_spikes = where_query_gate.getSpikes(compatible_output=True)
# what_query_gate_spikes = what_query_gate.getSpikes(compatible_output=True)
# dst_who_spikes = dst_who.getSpikes(compatible_output=True)
# dst_where_spikes = dst_where.getSpikes(compatible_output=True)
# dst_what_spikes = dst_what.getSpikes(compatible_output=True)
开发者ID:pmhastings,项目名称:spikeparse,代码行数:31,代码来源:main.py


示例4:

p.get_db().set_number_of_neurons_per_core('IF_curr_exp', nNeurons)      # this will set 256 neurons per core

cell_params = {     'i_offset' : .1,    'tau_refrac' : 3.0, 'v_rest' : -65.0,
                    'v_thresh' : -51.0,  'tau_syn_E'  : 2.0,
                    'tau_syn_I': 5.0,    'v_reset'    : -70.0,
                    'e_rev_E'  : 0.,     'e_rev_I'    : -80.}

left_cochlea_ear = p.Population(nNeurons, p.ProxyNeuron, {'x_source':254, 'y_source':254}, label='left_cochlea_ear')
left_cochlea_ear.set_mapping_constraint({'x':0, 'y':0})
left_cochlea_ear.record()   #    this should record spikes from the cochlea


right_cochlea_ear = p.Population(nNeurons, p.SpikeSource, {}, label='right_cochlea_ear')
right_cochlea_ear = p.Population(nNeurons, p.ProxyNeuron, {'x_source':254, 'y_source':255}, label='left_cochlea_ear')
right_cochlea_ear.set_mapping_constraint({'x':0, 'y':0})

right_cochlea_ear.record()   #    this should record spikes from the cochlea

ifcell = p.Population(nNeurons, p.IF_curr_exp, cell_params, label='IF_curr_exp')
ifcell.record_v()

p1 = p.Projection(left_cochlea_ear, ifcell, p.OneToOneConnector(weights=1, delays=1), target='excitatory')
p2 = p.Projection(right_cochlea_ear, ifcell, p.OneToOneConnector(weights=1, delays=1), target='excitatory')

p.run(200.0)

p.end()


开发者ID:galluppf,项目名称:spackage_conv,代码行数:27,代码来源:cochlea_example.py


示例5: get_outgoing_edge_constraints

        AbstractOutgoingEdgeSameContiguousKeysRestrictor.__init__(self)

    def get_outgoing_edge_constraints(self, partitioned_edge, graph_mapper):
        constraints = AbstractOutgoingEdgeSameContiguousKeysRestrictor\
            .get_outgoing_edge_constraints(
                self, partitioned_edge, graph_mapper)
        constraints.append(KeyAllocatorFixedKeyAndMaskConstraint(
            [KeyAndMask(0x42000000, 0xFFFF0000)]))
        return constraints

    def is_virtual_vertex(self):
        return True

    def model_name(self):
        return "My External Device"


import pyNN.spiNNaker as p
from pacman.model.partitionable_graph.multi_cast_partitionable_edge \
    import MultiCastPartitionableEdge


p.setup(1.0)

device = p.Population(20, MyExternalDevice, {"spinnaker_link_id": 0},
                      label="external device")
pop = p.Population(20, p.IF_curr_exp, {}, label="population")
p.Projection(device, pop, p.OneToOneConnector())

p.run(10)
开发者ID:SpiNNakerManchester,项目名称:SpiNNakerManchester.github.io,代码行数:30,代码来源:advanced_external_devices_task_3.py


示例6:

spikeArray = {'spike_times': [[0, 1050]]}
populations.append(p.Population(nNeurons, p.IF_curr_exp, cell_params_lif,
                   label='pop_1'))
populations.append(p.Population(1, p.SpikeSourceArray, spikeArray,
                   label='inputSpikes_1'))

projections.append(p.Projection(populations[0], populations[0],
                   p.FromListConnector(loopConnections)))
projections.append(p.Projection(populations[1], populations[0],
                   p.FromListConnector(injectionConnection)))

populations[0].record_v()
populations[0].record_gsyn()
populations[0].record()

p.run(runtime)

v = None
gsyn = None
spikes = None

v = populations[0].get_v(compatible_output=True)
gsyn = populations[0].get_gsyn(compatible_output=True)
spikes = populations[0].getSpikes(compatible_output=True)

if spikes is not None:
    print spikes
    pylab.figure()
    pylab.plot([i[1] for i in spikes], [i[0] for i in spikes], ".")
    pylab.xlabel('Time/ms')
    pylab.ylabel('spikes')
开发者ID:SpikeFrame,项目名称:sPyNNaker,代码行数:31,代码来源:synfire_2_run_extraction_if_curr_exp_lower_second_run.py


示例7:

spikeArray = {'spike_times': [[0]]}
populations.append(p.Population(nNeurons, p.IF_curr_exp, cell_params_lif,
                   label='pop_1'))
populations.append(p.Population(1, p.SpikeSourceArray, spikeArray,
                   label='inputSpikes_1'))

projections.append(p.Projection(populations[0], populations[0],
                   p.FromListConnector(loopConnections)))
projections.append(p.Projection(populations[1], populations[0],
                   p.FromListConnector(injectionConnection)))

populations[0].record_v()
populations[0].record_gsyn()
populations[0].record()

p.run(526)
p.run(526)
p.run(526)
p.run(526)
p.run(526)
p.run(370)

v = None
gsyn = None
spikes = None

v = populations[0].get_v(compatible_output=True)
gsyn = populations[0].get_gsyn(compatible_output=True)
spikes = populations[0].getSpikes(compatible_output=True)

if spikes is not None:
开发者ID:SpikeFrame,项目名称:sPyNNaker,代码行数:31,代码来源:synfire_1_run_no_extraction_if_curr_exp_mapped_to_auto_pause.py


示例8: len

    if i == 1:
        projections.append(p.Projection(
            populations[i - 1], dual_stim_population, p.OneToOneConnector(
                weights=weight_to_spike, delays=10), target='excitatory'))
        projections.append(p.Projection(
            populations[i], dual_stim_population, p.OneToOneConnector(
                weights=weight_to_spike, delays=10), target='excitatory2'))
    if i > 0:
        projections.append(p.Projection(
            populations[i - 1], populations[i], p.OneToOneConnector(
                weights=weight_to_spike, delays=10)))

    populations[i].record_v()
    populations[i].record()

p.run(simulation_time)

id_accumulator = 0
colour_divider = 0x600 / n_pop
for i in range(n_pop):
    colour = 0x000000
    colour_scale = (i / 6) * colour_divider
    if (i % 6) < 2 or (i % 6) == 5:
        colour += 0xFF0000 - (colour_scale * 0x10000)
    if (i % 6) > 0 and (i % 6) < 4:
        colour += 0x00FF00 - (colour_scale * 0x100)
    if (i % 6) > 2:
        colour += 0x0000FF - colour_scale
    data = numpy.asarray(populations[i].getSpikes())
    if len(data) > 0:
        py_plot.scatter(
开发者ID:ruthvik92,项目名称:PyNNExamples,代码行数:31,代码来源:synfire_if_curr_dual_exp.py


示例9:

what_statement_gate.record()
who_query_gate.record()
who_query_gate.record_v()
who_query_gate.record_gsyn()
where_query_gate.record()
what_query_gate.record()

dst_who.record()
dst_where.record()
dst_what.record()

who.record()
where.record()
what.record()

p.run(15 * 1000)

src_pop_spikes = src_pop.getSpikes(compatible_output=True)
who_statement_gate_spikes = who_statement_gate.getSpikes(compatible_output=True)
who_statement_gate_v = who_statement_gate.get_v()
who_statement_gate_i = who_statement_gate.get_gsyn()
where_statement_gate_spikes = where_statement_gate.getSpikes(compatible_output=True)
what_statement_gate_spikes = what_statement_gate.getSpikes(compatible_output=True)
who_query_gate_spikes = who_query_gate.getSpikes(compatible_output=True)
who_query_gate_v = who_query_gate.get_v()
who_query_gate_i = who_query_gate.get_gsyn()
where_query_gate_spikes = where_query_gate.getSpikes(compatible_output=True)
what_query_gate_spikes = what_query_gate.getSpikes(compatible_output=True)
dst_who_spikes = dst_who.getSpikes(compatible_output=True)
dst_where_spikes = dst_where.getSpikes(compatible_output=True)
dst_what_spikes = dst_what.getSpikes(compatible_output=True)
开发者ID:pmhastings,项目名称:spikeparse,代码行数:31,代码来源:mainTxt.py


示例10: spike

# stimulate the first population with a single spike (3 times)
spike_times = [0, 1000, 2000]
in_0 = pynn.Population(1, pynn.SpikeSourceArray, {'spike_times': spike_times})

pynn.Projection(in_0, all_pops[0], con_alltoall, target="excitatory")


def shift(seq, n):
    n = n % len(seq)
    return seq[n:] + seq[:n]

# connect all populations, but don't close the chain
for pop_a, pop_b in zip(all_pops, shift(all_pops, 1)[:-1]):
    pynn.Projection(pop_a, pop_b, con_fixednumberpre, target='excitatory')

pynn.run(duration)

spikes = None

# Collect and record spikes
for pop in all_pops:
    new_spikes = pop.getSpikes(compatible_output=True)
    if new_spikes is not None:
        numpy.fliplr(new_spikes)
        new_spikes = new_spikes / [1, 1000.0]
        if spikes is None:
            spikes = new_spikes
        else:
            new_spikes = new_spikes + [len(spikes), 0]
            spikes = numpy.concatenate((spikes, new_spikes), axis=0)
if spikes is None:
开发者ID:electronicvisions,项目名称:hbp_platform_demo,代码行数:31,代码来源:run.py


示例11: open

                   'tau_syn_E' : 5.0,    #The excitatory input current decay time-constant
                   'tau_syn_I' : 5.0,    #The inhibitory input current decay time-constant
                   'v_reset'   : -70.0,  #The voltage to set the neuron at immediately after a spike
                   'v_rest'    : -65.0,  #The ambient rest voltage of the neuron
                   'v_thresh'  : -50.0    #The threshold voltage at which the neuron will spike.
                   }


stim_pop1 = p.Population(n_neurons, p.SpikeSourcePoisson,{"rate": 60.0,"start":0, "duration":50 } ) #Stimuluspopultn
ip_pop = p.Population(n_neurons, p.IF_curr_exp, cell_params_lif, label="inputneurons")


project_stim_pop_ip_pop = p.Projection( stim_pop1,ip_pop, p.OneToOneConnector(weights=10, delays=0.0), target="excitatory")

stim_pop1.record()
p.run(50)
spikes4 = stim_pop1.getSpikes()


with open('/home/ruthvik/Desktop/spikefile_800_50ms','w') as f:   ##make a pickle of spike data
    pickle.dump(spikes4,f)

spike_time4 = [i[1] for i in spikes4]
spike_id4 = [i[0] for i in spikes4]
pylab.plot(spike_time4, spike_id4, ".")
pylab.xlabel("Time (ms)")
pylab.ylabel("Neuron ID")
pylab.axis([0,50,0,800])
pylab.show()

开发者ID:ruthvik92,项目名称:spiNNaker-Codes.,代码行数:29,代码来源:poisn_50ms_patrn.py


示例12: max

grcpc_weights_distribution = p.RandomDistribution("uniform", [0.05, 0.5], rng)
pro_grcpcsynapsis_connector = p.FixedProbabilityConnector(0.8, weights=grcpc_weights_distribution)
pro_grcpcsynapsis_left = p.Projection(
    prepop,
    postpop,
    pro_grcpcsynapsis_connector,
    target="excitatory",
    synapse_dynamics=syndyn_grcpcsynapsis,
    label="grcpcsynapsis",
)

proj = pro_grcpcsynapsis_left
proj.projection_edge.postvertex.custom_max_atoms_per_core = max(1, 4000 / proj.projection_edge.prevertex.atoms)

# plasticsyn.projection_edge.postvertex.custom_max_atoms_per_core = 100
p.run(duration)
# IPython.embed()

prespikes = prepop.getSpikes()

if prespikes != None:
    plot(prespikes[:, 0], prespikes[:, 1], "gd", markersize=10, alpha=0.6)

teachspikes = teachpop.getSpikes()
if teachspikes != None:
    plot(teachspikes[:, 0], teachspikes[:, 1], "ro", markersize=10, alpha=0.6)

postspikes = postpop.getSpikes()
if postspikes != None:
    plot(postspikes[:, 0], postspikes[:, 1], "bs", markersize=10, alpha=0.6)
开发者ID:BRML,项目名称:HBP-spinnaker-cerebellum,代码行数:30,代码来源:minimal_learning.py


示例13: run_sim

    def run_sim(self):
        """
        Sets up and runs the simulation
        """
        num_neurons = 1471  # total neurons in network
        num_inputs = 14     # number of neurons considered inputs
        num_runs = 1        # number of times to loop the learning
        num_samples = 1     # number of samples to learn`
        sim_time = 1000.0    # time to run sim for`
        inhibitory_split = 0.2
        connection_probability_factor = 0.02
        plot_spikes = True
        save_figures = True
        show_figures = True
        sim_start_time = strftime("%Y-%m-%d_%H:%M")

        cell_params_lif = {'cm': 0.25, 'i_offset': 0.0, 'tau_m': 10.0, 'tau_refrac': 2.0, 'tau_syn_E': 3.0,
                           'tau_syn_I': 3.0, 'v_reset': -65.0, 'v_rest': -65.0, 'v_thresh': -50.0}

        # Create the 3d structure of the NeuCube based on the user's given structure file
        network_structure = NetworkStructure()
        network_structure.load_structure_file()
        network_structure.load_input_location_file()
        # Calculate the inter-neuron distance to be used in the small world connections
        network_structure.calculate_distances()
        # Generate two connection matrices for excitatory and inhibitory neurons based on your defined split
        network_structure.calculate_connection_matrix(inhibitory_split, connection_probability_factor)
        # Get these lists to be used when connecting the neurons later
        excitatory_connection_list = network_structure.get_excitatory_connection_list()
        inhibitory_connection_list = network_structure.get_inhibitory_connection_list()
        # Choose the correct neurons to connect them to, based on your a-priori knowledge of the data source -- eg, EEG
        # to 10-20 locations, fMRI to voxel locations, etc.
        input_neuron_indexes = network_structure.find_input_neurons()
        # Make the input connections based on this new list
        input_weight = 4.0
        input_connection_list = []
        for index, input_neuron_index in enumerate(input_neuron_indexes):
            input_connection_list.append((index, input_neuron_index, input_weight, 0))

        for run_number in xrange(num_runs):
            excitatory_weights = []
            inhibitory_weights = []
            for sample_number in xrange(num_samples):
                # At the moment with the limitations of the SpiNNaker hardware we have to reinstantiate EVERYTHING
                # each run. In future there will be some form of repetition added, where the structure stays in memory
                # on the SpiNNaker and only the input spikes need to be updated.

                data_prefix = sim_start_time + "_r" + str(run_number + 1) + "-s" + str(sample_number + 1)

                # Set up the hardware - min_delay should never be less than the timestep.
                # Timestep should = 1.0 (ms) for normal realtime applications
                p.setup(timestep=1.0, min_delay=1.0)
                p.set_number_of_neurons_per_core("IF_curr_exp", 100)

                # Create a population of neurons for the reservoir
                neurons = p.Population(num_neurons, p.IF_curr_exp, cell_params_lif, label="Reservoir")

                # Setup excitatory STDP
                timing_rule_ex = p.SpikePairRule(tau_plus=20.0, tau_minus=20.0)
                weight_rule_ex = p.AdditiveWeightDependence(w_min=0.1, w_max=1.0, A_plus=0.02, A_minus=0.02)
                stdp_model_ex  = p.STDPMechanism(timing_dependence=timing_rule_ex, weight_dependence=weight_rule_ex)
                # Setup inhibitory STDP
                timing_rule_inh = p.SpikePairRule(tau_plus=20.0, tau_minus=20.0)
                weight_rule_inh = p.AdditiveWeightDependence(w_min=0.0, w_max=0.6, A_plus=0.02, A_minus=0.02)
                stdp_model_inh  = p.STDPMechanism(timing_dependence=timing_rule_inh, weight_dependence=weight_rule_inh)

                # record the spikes from that population
                neurons.record('spikes')

                # Generate a population of SpikeSourceArrays containing the encoded input spike data
                # eg. spike_sources = p.Population(14, p.SpikeSourceArray, {'spike_times': [[]]})
                # for the moment I'm going to cheat and just use poisson trains as I don't have data with me
                spike_sources = p.Population(num_inputs, p.SpikeSourcePoisson, {'rate': rand.randint(20, 80)},
                                             label="Poisson_pop_E")

                # Connect the input spike sources with the "input" neurons
                connected_inputs = p.Projection(spike_sources, neurons, p.FromListConnector(input_connection_list))

                # If we have weights saved/recorded from a previous run of this network, load them into the structure
                # population.set(weights=weights_list) and population.setWeights(weight_list) are not supported in
                # SpiNNaker at the moment so we have to do this manually.
                if excitatory_weights and inhibitory_weights:
                    for index, ex_connection in enumerate(excitatory_connection_list):
                        ex_connection[2] = excitatory_weights[index]
                    for index, in_connection in enumerate(inhibitory_connection_list):
                        in_connection[2] = inhibitory_weights[index]

                # Setup the connectors
                excitatory_connector = p.FromListConnector(excitatory_connection_list)
                inhibitory_connector = p.FromListConnector(inhibitory_connection_list)

                # Connect the excitatory and inhibitory neuron populations
                connected_excitatory_neurons = p.Projection(neurons, neurons, excitatory_connector,
                                                            synapse_dynamics=p.SynapseDynamics(slow=stdp_model_ex),
                                                            target="excitatory")
                connected_inhibitory_neurons = p.Projection(neurons, neurons, inhibitory_connector,
                                                            synapse_dynamics=p.SynapseDynamics(slow=stdp_model_inh),
                                                            target="inhibitory")

                # Set up recording the spike trains of all the neurons
#.........这里部分代码省略.........
开发者ID:starlitnext,项目名称:NeuCubePyNN,代码行数:101,代码来源:NeuCubeReservoir.py


示例14: addressed

hostname="192.168.240.254" #ipaddress of packets to be sent to
strip_sdp=True



#p.activate_live_output_for(populations[0], portNo, hostname,  tag, strip_sdp, use_prefix, right_shift,
#				payload_as_time_stamps, use_payload_prefix, 
#				payload_prefix, payload_right_shift,
#				number_of_packets_sent_per_time_step)



p.activate_live_output_for(populations[0], portNo, hostname,tag=1,  strip_sdp=strip_sdp)



#populations[0].set_constraint( p.PartitionerMaximumSizeConstraint(5))
# 4 chips addressed (0,0) (0,1) (1,0) (1,1) so (2,2) out of range
#populations[0].set_mapping_constraint({'x':2, 'y':2, 'p':0})
#However (1,1) should work, but doesn't?
#populations[0].set_mapping_constraint({'x':1, 'y':1, 'p':0})

#same problem as above
#populations[0].set_constraint( p.PlacerChipAndCoreConstraint(2,2,0))

#populations[0].set_constraint( p.PlacerChipAndCoreConstraint(0,0,0))

p.run(400)

# p.end()
开发者ID:msil,项目名称:spinnaker-workshop,代码行数:30,代码来源:synfire_if_curr_exp3.py


示例15: open

                   'tau_syn_I' : 5.0,    #The inhibitory input current decay time-constant
                   'v_reset'   : -70.0,  #The voltage to set the neuron at immediately after a spike
                   'v_rest'    : -65.0,  #The ambient rest voltage of the neuron
                   'v_thresh'  : -50.0    #The threshold voltage at which the neuron will spike.
                   }


stim_pop1 = p.Population(n_neurons, p.SpikeSourcePoisson,{"rate": Hz,"start":0, "duration":pattern_length } ) #Stimuluspopultn
ip_pop = p.Population(n_neurons, p.IF_curr_exp, cell_params_lif, label="inputneurons")


project_stim_pop_ip_pop = p.Projection( stim_pop1,ip_pop, p.OneToOneConnector(weights=10, delays=1.0), target="excitatory")

ip_pop.record()
stim_pop1.record()
p.run(70)
spikes4 = ip_pop.getSpikes()
spikes5=stim_pop1.getSpikes()

with open('/home/ruthvik/Desktop/spikefile_'+str(Neurons)+'_'+str(pattern_length)+'ms'+'_'+str(Hz)+'Hz','w') as f:   ##make a pickle of spike data
    pickle.dump(spikes4,f)


spike_time4 = [i[1] for i in spikes4]
spike_id4 = [i[0] for i in spikes4]
pylab.plot(spike_time4, spike_id4, ".")
pylab.xlabel("Time (ms)_stim_population")
pylab.ylabel("Neuron ID")
pylab.axis([0,70,0,Neurons])
pylab.show()
开发者ID:ruthvik92,项目名称:spiNNaker-Codes.,代码行数:30,代码来源:poisson_pattern.py


示例16: list

else:
    plt.ylabel("Voltage")
plt.show(block=False)

while running:
    if last_spike_fast < total_run_time + time_to_run:
        fast_spikes = list(islice(fast_spike_iter, 10))
        last_spike_fast = fast_spikes[-1]
        fast_injector.set("spike_times", [fast_spikes] + [[]] * 9)

    if last_spike_slow < total_run_time + time_to_run:
        slow_spikes = list(islice(slow_spike_iter, 10))
        last_spike_slow = slow_spikes[-1]
        slow_injector.set("spike_times", [slow_spikes] + [[]] * 9)

    sim.run(time_to_run)
    total_run_time += time_to_run

    plt.xlim(max(0, total_run_time - 5*time_to_run), total_run_time)
    if mode == "spikes":
        plt.ylim(-1, 101)
        all_spikes = populations[-1].getSpikes()
        print "Total spikes %d" % len(all_spikes)
        spikes = list(takewhile(lambda x: x[1] > total_run_time - time_to_run, all_spikes))
        plt.plot([i[1] for i in spikes], [i[0] for i in spikes], ".", markersize=2)
    else:
        plt.ylim(v_reset - 5, v_thresh + 5)
        voltages = list(ifilter(lambda x: x[0] == 1 and x[1] >= total_run_time - time_to_run,
            reversed(populations[0].get_v())))
        plt.plot([i[1] for i in voltages], [i[2] for i in voltages], "b-", markersize=1)
开发者ID:Scaatis,项目名称:SpiNNakerTests,代码行数:30,代码来源:dummy_net_multi_run.py


示例17: enumerate

poispops=[]
for k,(mini,maxi) in [(0xFEFFFE20,(1220.,2880.)),
                      (0xFEFFFE03,(-20.,500.)),
                      (0xFEFFFE07,(-20.,500.)),
                      (0xFEFFFE02,(0.,1000.)),
                      (0xFEFFFE06,(0.,1000.)),
                      (0xFEFFFE00,(-50.,50.)),
                      (0xFEFFFE04,(-50.,50.))]:
    poi = p.Population(32,p.SpikeSourceRemote,{'max_rate':100,'min_rate':.1,'overlap':10./(maxi-mini),'sensormin':mini,'sensormax':maxi, 'src_type': 'rbf_pois', 'listen_key': k})
    poi.record()
    poispops.append(poi)
    

#errorprop=p.Projection(myopop,pois1,p.OneToOneConnector(weights=1.0,delays=1.0))

p.run(15000)

figure()

for i,pois1 in enumerate(poispops):
    spk=pois1.getSpikes()
#    subplot(len(poispops),1,i)
    plot(spk[:,0],spk[:,1],"s",alpha=0.4)

#figure()
#hist(spk[:,1],bins=32)

IPython.embed()
p.end()

开发者ID:BRML,项目名称:HBP-spinnaker-cerebellum,代码行数:29,代码来源:remote-source_example+CAN.py


示例18: higher

#                      (0xFEFFFE00,(-800.,800.)), # omega = delta PWM, not useful!
#                      (0xFEFFFE04,(-800.,800.)), # could go much higher (~PWM=800/4000)
#                      (0xFEFFFE01,((-2<<18) + 1, (2<<18) - 1)), # spindle encoders
#                      (0xFEFFFE05,((-2<<18) + 1, (2<<18) - 1))]: # these will be auto-downscaled
    poi = p.Population(32,p.SpikeSourceRemote,{'max_rate':50,'min_rate':.1,'gauss_width':0.666,'sensormin':mini,'sensormax':maxi, 'src_type': 'rbf_det', 'listen_key': k}, label=hex(k)+"_PLOT")
    poi.record()
    poispops.append(poi)

iosource = p.Population(32,p.SpikeSourceRemote,{'max_rate':10,'min_rate':.1,'sensormin':1220,'sensormax':2880, 'src_type': 'glob_pois', 'listen_key': 0xFEFFFE30}, label=hex(k)+"_PLOT")
iosource.record()
#pois1 = p.Population(100,p.SpikeSourceRemote,{'max_rate':100,'overlap':0.2})
#pois1.record()

#errorprop=p.Projection(myopop,pois1,p.OneToOneConnector(weights=1.0,delays=1.0))

p.run(rt)
#myospikes=myopop.getSpikes()
#inpspikes=inppop.getSpikes()

#testspikes=testpop.getSpikes()
#plot(inpspikes[:,0],inpspikes[:,1],"s")
#plot(testspikes[:,0],testspikes[:,1],"s")


figure()

for i,pois1 in enumerate(poispops):
    spk=pois1.getSpikes()
#    subplot(len(poispops),1,i)
    plot(spk[:,0],spk[:,1],"s",alpha=0.4,label=pois1.vertex.label)
开发者ID:BRML,项目名称:HBP-spinnaker-cerebellum,代码行数:30,代码来源:myoexample.py


示例19:

import pyNN.spiNNaker as p
import spynnaker_external_devices_plugin.pyNN as q
import pylab

p.setup(1.0)

injector = p.Population(
    10, q.SpikeInjector, {"virtual_key": 0x4200, "port": 18000},
    label="injector")
pop = p.Population(10, p.IF_curr_exp, {}, label="pop")
pop.record()

p.Projection(injector, pop, p.OneToOneConnector(weights=5.0))

p.run(7000)

spikes = pop.getSpikes()
spike_time = [i[1] for i in spikes]
spike_id = [i[0] for i in spikes]
pylab.plot(spike_time, spike_id, ".")
pylab.xlabel("Time (ms)")
pylab.ylabel("Neuron ID")
pylab.axis([0, 7000, -1, 10])
pylab.show()
开发者ID:SpiNNakerManchester,项目名称:SpiNNakerManchester.github.io,代码行数:24,代码来源:advanced_external_devices_task_1.py


示例20:


##PROJECTING IP_POP ONTO OP_POP WITH STDP DYNAMIC SYNAPSES
project_ip_op = p.Projection( ip_pop,op_pop, p.AllToAllConnector(weights=weights, delays=1), synapse_dynamics = s_d, target="excitatory")

########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$END OF STDPMechanism ####################################################################
                                           ##################################################
                                                 ####################################
                                                           ################
##############################################$$$$$$$$$$$$$$$$$$$$PLOTTING AND RECORDING #######################################################
stimlus_pop.record()
ip_pop.record()
op_pop.record()
op_pop.record_v()

p.run((pattern_gap+k)*n)


c=stimlus_pop.getSpikes()
v=ip_pop.getSpikes()
l=op_pop.getSpikes()
vo=op_pop.get_v()

print "Output Population voltage", vo
print "Output Population voltage", vo[1]

spike_id = [i[0] for i in v]
spike_time = [i[1] for i in v]
#***pylab.subplot(3,1,1)
pylab.plot(spike_time, spike_id, ".")
pylab.xlabel("Time(ms)")
开发者ID:ruthvik92,项目名称:spiNNaker-Codes.,代码行数:29,代码来源:nessler.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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