当前位置: 首页>>代码示例>>Python>>正文


Python spiNNaker.setup函数代码示例

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


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

示例1: setupModel

def setupModel(settings,params, dt,simTime,populationsInput, populationsNoiseSource, populationsRN,populationsPN,populationsAN,projectionsPNAN):
    
    maxDelay = max([params['MAX_DELAY_RATECODE_TO_CLUSTER_RN'],params['MAX_DELAY_CLASS_ACTIVITY_TO_CLUSTER_AN']])
    spynnaker.setup(timestep=dt,min_delay=1,max_delay=maxDelay)        
    rnSpikeInjectionPort = settings['RN_SPIKE_INJECTION_PORT']
    rnSpikeInjectionPopLabel = settings['RN_SPIKE_INJECTION_POP_LABEL']
    classActivationSpikeInjectionPort = settings['CLASS_ACTIVATION_SPIKE_INJECTION_PORT']
    classActivationSpikeInjectionPopLabel = settings['CLASS_ACTIVATION_SPIKE_INJECTION_POP_LABEL']
    
    learning = settings['LEARNING']
    
    print 'Setting up input layer..'
    numInjectionPops = setupLayerInput(params,rnSpikeInjectionPort,rnSpikeInjectionPopLabel, classActivationSpikeInjectionPort,classActivationSpikeInjectionPopLabel, populationsInput,learning)
    print numInjectionPops , ' spikeInjection populations were needed to accomodate ', params['NUM_VR'], " VRs"
    print 'Setting up noise source layer..'
    setupLayerNoiseSource(params, simTime, populationsNoiseSource)
    print 'Setting up RN layer..'
    numInputPops = len(populationsInput)
    injectionPops = populationsInput[1:len(populationsInput)]
    numInjectionPops = len(injectionPops)
    setupLayerRN(params,neuronModel, cell_params, injectionPops, populationsNoiseSource[0], populationsRN)
    #setupLayerRN(params,neuronModel, cell_params, injectionPops, populationsRN)
    print 'Setting up PN layer..'
    setupLayerPN(params, neuronModel, cell_params, populationsRN, populationsPN)
    print 'Setting up AN layer..'
    setupLayerAN(params, settings, neuronModel, cell_params, populationsInput[0], populationsNoiseSource[0], populationsPN, populationsAN,learning,projectionsPNAN)
    
    printModelConfigurationSummary(params, populationsInput, populationsNoiseSource, populationsRN, populationsPN, populationsAN)
开发者ID:alandiamond,项目名称:spinnaker-neuromorphic-classifier,代码行数:28,代码来源:Classifier_LiveSpikingInput.py

示例2: __init__

    def __init__( self, time, num_neurons ):
        threading.Thread.__init__( self )

        p.setup( timestep=1.0, min_delay=1.0, max_delay=144.0 )

        self.time             = time
        self.num_neurons      = num_neurons
        self.loop_connections = list()
        self.weight_to_spike  = 2.0
        self.delay            = 17

        self.cell_params      = {
                'cm'        : 0.25,
                'i_offset'  : 0.0,
                'tau_m'     : 20.0,
                'tau_refrac': 2.0,
                'tau_syn_E' : 5.0,
                'tau_syn_I' : 5.0,
                'v_reset'   : -70.0,
                'v_rest'    : -65.0,
                'v_thresh'  : -50.0
        }

        self.injector_cell_params = {
            'host_port_number' : 12345,
            'host_ip_address'  : "localhost",
            'virtual_key'      : 458752,
            'prefix'           : 7,
            'prefix_type'      : q.EIEIOPrefixType.UPPER_HALF_WORD
        }
       
        for i in range( 0, self.num_neurons - 1 ):
            single_connection = ( i, ( ( i + 1 ) % self.num_neurons ), self.weight_to_spike, self.delay )
            self.loop_connections.append( single_connection )

        self.injection_connections = {
                'pop1' : [( 0, 0, self.weight_to_spike, 1 )],
                'pop2' : [( 1, 0, self.weight_to_spike, 1 )]
        }

        self.populations = {
        #       pop name                   num neurons       neuron type                    cell parameters            label
                "injector" : p.Population( 2,                q.ReverseIpTagMultiCastSource, self.injector_cell_params, label='spike_injector' ),
                "pop1"     : p.Population( self.num_neurons, p.IF_curr_exp,                 self.cell_params,          label='pop1'           ),
                "pop2"     : p.Population( self.num_neurons, p.IF_curr_exp,                 self.cell_params,          label='pop2'           ),
                "pop3"     : p.Population( self.num_neurons, p.IF_curr_exp,                 self.cell_params,          label='pop3'           )
        }

        self.projections = [
                p.Projection( self.populations['pop1'],      self.populations['pop1'], p.FromListConnector( self.loop_connections              ) ),
                p.Projection( self.populations['pop2'],      self.populations['pop2'], p.FromListConnector( self.loop_connections              ) ),
                p.Projection( self.populations['pop2'],      self.populations['pop3'], p.FromListConnector( self.loop_connections              ) ),
                p.Projection( self.populations['injector'],  self.populations['pop1'], p.FromListConnector( self.injection_connections['pop1'] ) ),
                p.Projection( self.populations['injector'],  self.populations['pop2'], p.FromListConnector( self.injection_connections['pop2'] ) )
        ]
开发者ID:msil,项目名称:spinnaker-workshop,代码行数:55,代码来源:synfire_if_curr_exp6.py

示例3: setupModel

def setupModel(settings,params, dt,simTime,populationsInput, populationsNoiseSource, populationsRN,populationsPN,populationsAN,projectionsPNAN):
    
    maxDelay = max([params['MAX_DELAY_RATECODE_TO_CLUSTER_RN'],params['MAX_DELAY_CLASS_ACTIVITY_TO_CLUSTER_AN']])
    spynnaker.setup(timestep=dt,min_delay=1,max_delay=maxDelay)        
    spikeSourceVrResponsePath = settings['SPIKE_SOURCE_VR_RESPONSE_PATH']
    spikeSourceActiveClassPath = settings['SPIKE_SOURCE_ACTIVE_CLASS_PATH']
    learning = settings['LEARNING']
    
    setupLayerInput(params, spikeSourceVrResponsePath, spikeSourceActiveClassPath, populationsInput,learning)
    setupLayerNoiseSource(params, simTime, populationsNoiseSource)
    setupLayerRN(params,neuronModel, cell_params, populationsInput[0], populationsNoiseSource[0], populationsRN)
    setupLayerPN(params, neuronModel, cell_params, populationsRN, populationsPN)
    setupLayerAN(params, settings, neuronModel, cell_params, populationsInput[1], populationsNoiseSource[0], populationsPN, populationsAN,learning,projectionsPNAN)
    
    printModelConfigurationSummary(params, populationsInput, populationsNoiseSource, populationsRN, populationsPN, populationsAN)
开发者ID:alandiamond,项目名称:spinnaker-neuromorphic-classifier,代码行数:15,代码来源:Classifier.py

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

示例5: setupModel

def setupModel(
    params,
    settings,
    dt,
    simTime,
    populationsInput,
    populationsNoiseSource,
    populationsRN,
    populationsPN,
    populationsAN,
    projectionsPNAN,
):

    maxDelay = max([params["MAX_DELAY_RATECODE_TO_CLUSTER_RN"], params["MAX_DELAY_CLASS_ACTIVITY_TO_CLUSTER_AN"]])

    spynnaker.setup(timestep=dt, min_delay=1, max_delay=maxDelay)

    setupLayerInput(params, settings, populationsInput)

    setupLayerNoiseSource(params, simTime, populationsNoiseSource)

    setupLayerRN(params, neuronModel, cell_params, populationsInput[0], populationsNoiseSource[0], populationsRN)

    setupLayerPN(params, neuronModel, cell_params, populationsRN, populationsPN)

    setupLayerAN(
        params,
        settings,
        neuronModel,
        cell_params,
        populationsInput[1],
        populationsNoiseSource[0],
        populationsPN,
        populationsAN,
        projectionsPNAN,
    )

    printModelConfigurationSummary(
        params, populationsInput, populationsNoiseSource, populationsRN, populationsPN, populationsAN
    )
开发者ID:iulialexandra,项目名称:neuromorphic_odour_classifier,代码行数:40,代码来源:Classifier.py

示例6: general_cell

LOGDEBUG = 1
LOGINFO = 2

LOGLEVEL = LOGINFO


#### DEFAULTS
tau_syn = 100                # default value
neurons_per_core = 100       # default value

#### COUNTERS
n_outs = 0                  # output counter for placing NEF_out populations in chip 0,0


# Setting up the connection with the DB and the number of cells
spinn.setup(db_name = os.path.abspath('%s/nengo_model.sqlite' % pacman.BINARIES_DIRECTORY))

spinn.get_db().set_number_of_neurons_per_core('NEF_out_2d', neurons_per_core*2)        # this will set one population per core
#spinn.get_db().set_number_of_neurons_per_core('IF_curr_exp_32', neurons_per_core)        # this will set one population per core
spinn.get_db().set_number_of_neurons_per_core('IF_NEF_input_2d', neurons_per_core*2)        # this will set one population per core


# PACMAN INTERFACES

class general_cell():
    """
    PACMAN Interface class giving a cell type with parameters, class, size, label, id and mapping constraints
    """
    def __init__(self, cellname):
        self.__name__ = cellname
开发者ID:galluppf,项目名称:spackage_conv,代码行数:30,代码来源:compile_nengo_model.py

示例7:

  return spike_times_1, spike_times_2


#millisecond*second*minutes*hour in a day
#runtime = 1000*60*60*24 
runtime  = 1000#*60*10 #10 min
stimtime = 500
weight_to_spike = 8.

timestep = 1.
min_delay = 1.
max_delay = 20.


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

max_weight = 10.
min_weight = 0.0
a_plus = 0.1
a_minus = 0.12
tau_plus = 20.
tau_minus = 20.

num_exc = 800
num_inh = 200
total_neurons = num_exc + num_inh
max_conn_per_neuron = 100
conn_prob = 0.1#float(max_conn_per_neuron)/float(total_neurons)

cell_type = sim.IZK_curr_exp
开发者ID:AlexBoro,项目名称:polychronization,代码行数:30,代码来源:full-paper.py

示例8: range

#!/usr/bin/env python
import IPython
import pyNN.spiNNaker as p
#import pyNN.neuron as p
from pylab import *
from pyNN.utility import init_logging
from pyNN.utility import get_script_args
from pyNN.errors import RecordingError

spin_control = p.setup(timestep=0.1, min_delay=0.1, max_delay=4.0)
#init_logging("logfile", debug=True)

ifcell = p.Population(10, p.IF_cond_exp, {  'i_offset' : 0.1,    'tau_refrac' : 3.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.}, label = "myFinalCell_PLOT")

spike_sourceE = p.Population(10, p.SpikeSourceArray, {'spike_times': [float(i) for i in range(0,9000,100)]}, label = "mySourceE_PLOT")
spike_sourceI = p.Population(10, p.SpikeSourceArray, {'spike_times': [float(i) for i in range(1000,5000,50)]}, label = "mySourceI_PLOT")

connE = p.Projection(spike_sourceE, ifcell, p.AllToAllConnector(weights=1.0, delays=0.2), target='excitatory')
connI = p.Projection(spike_sourceI, ifcell, p.AllToAllConnector(weights=3.0, delays=0.2), target='inhibitory')

#p1 = Population(100, IF_curr_alpha, structure=space.Grid2D())

#prepop = p.Population(100 ,p.SpikeSourceArray,{'spike_times':[[i for i in arange(10,duration,100)], [i for i in arange(50,duration,100)]]*(nn/2)})


#prj2_1 = Projection(p2, p1, method=AllToAllConnector(), target='excitatory')

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

示例9: get_pops

import pyNN.spiNNaker as pynn


# helper function for populations
def get_pops(n_in_pop, n_used_neuronblocks=7):
    l = []
    model_type = pynn.IF_cond_exp

    for _ in xrange(n_used_neuronblocks):
        pop = pynn.Population(n_in_pop, model_type, params)
        pop.record()
        l.append(pop)

    return l

pynn.setup(timestep=1.0)

duration = 1 * 30000  # ms

params = {
    'cm': 0.2,
    'v_reset': -70,
    'v_rest': -50,
    'v_thresh': -47,
    'e_rev_I': -60,
    'e_rev_E': -40,
}


n_in_pop = 12
开发者ID:electronicvisions,项目名称:hbp_platform_demo,代码行数:30,代码来源:run.py

示例10: neurons




Each population has 256 neurons (4 neurons x 64 channels).
Neurons in each population (ear) are numbered from 0 to 255, where::

   id = ( channel * 4 ) + neuron

.. moduleauthor:: Francesco Galluppi, SpiNNaker Project, [email protected]
"""
from pyNN.utility import get_script_args
from pyNN.errors import RecordingError
import pyNN.spiNNaker as p

p.setup(timestep=1.0,min_delay=1.0,max_delay=10.0, db_name='cochlea_example.sqlite')

nNeurons = 4 * 64 # 4 neurons and 64 channels per ear

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

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

示例11:

import pyNN.spiNNaker as p
import memory_for_parser as mem
import parse as parser
import get_text as sp

NUMBER_PEOPLE = 10
NUMBER_LOCS = 10
NUMBER_OBJS = 10

max_delay = 100.0

p.setup(timestep=1.0, min_delay = 1.0, max_delay = max_delay)

# parser.parse_no_run('spiNNaker', "daniel went to the bathroom. john went to the hallway. where is john?")

sent1 = sp.getSentence(parser.words, "Say your first assertion now")
sent2 = sp.getSentence(parser.words, "Say your second assertion now")
sent3 = sp.getSentence(parser.words, "Ask your question now")

parser.parse_no_run('spiNNaker', sent1+sent2+sent3)


[input_populations, state_populations, output_populations, projections] = mem.memory(NUMBER_PEOPLE, NUMBER_LOCS, NUMBER_OBJS)

cell_params_lif = {'cm'        : 0.25, # nF
                     'i_offset'  : 0.0,
                     'tau_m'     : 20.0,
                     'tau_refrac': 2.0,
                     'tau_syn_E' : 5.0,
                     'tau_syn_I' : 5.0,
                     'v_reset'   : -70.0,
开发者ID:pmhastings,项目名称:spikeparse,代码行数:31,代码来源:main.py

示例12:

"""
Synfirechain-like example

Expected results in
  .. figure::  ./examples/results/synfire_chain_lif.png

"""
#!/usr/bin/python
import pyNN.spiNNaker as p
import numpy, pylab



p.setup(timestep=1.0, min_delay = 1.0, max_delay = 8.0, db_name='synfire.sqlite')

n_pop = 16    # number of populations
nNeurons = 10  # number of neurons in each population

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

# random distributions
rng = p.NumpyRNG(seed=28374)
delay_distr = p.RandomDistribution('uniform', [1,10], rng=rng)
weight_distr = p.RandomDistribution('uniform', [0,2], rng=rng)
v_distr = p.RandomDistribution('uniform', [-55,-95], rng)


cell_params_lif_in = { 'tau_m'      : 32,
                'v_init'    : -80,
                'v_rest'     : -75,   
                'v_reset'    : -95,  
开发者ID:galluppf,项目名称:spackage_conv,代码行数:31,代码来源:synfire_chain_lif.py

示例13:

import pyNN.spiNNaker as sim

sim.setup()

p1 = sim.Population(3, sim.SpikeSourceArray, {"spike_times":  [1.0, 2.0, 3.0]})
p2 = sim.Population(3, sim.SpikeSourceArray, {"spike_times":  [[10.0], [20.0], [30.0]]})
p3 = sim.Population(4, sim.IF_cond_exp, {})

sim.Projection(p2, p3, sim.FromListConnector([
    (0, 0, 0.1, 1.0), (1, 1, 0.1, 1.0), (2, 2, 0.1, 1.0)]))
#sim.Projection(p1, p3, sim.FromListConnector([(0, 3, 0.1, 1.0)])) # works if this line is added

sim.run(100.0)
开发者ID:SpikeFrame,项目名称:sPyNNaker,代码行数:13,代码来源:test.py

示例14: get_pops


# helper function for populations
def get_pops(n_in_pop, n_used_neuronblocks=7):
    l = []
    model_type = pynn.IF_curr_exp

    for _ in xrange(n_used_neuronblocks):
        pop = pynn.Population(n_in_pop, model_type, params)
        pop.record()
        l.append(pop)

    return l


pynn.setup(timestep=0.1)

duration = 1 * 3000  # ms

params = {"cm": 0.2, "v_reset": -70, "v_rest": -50, "v_thresh": -47}

n_in_pop = 12

# prepare populations
all_pops = []
all_pops.extend(get_pops(n_in_pop))
all_pops.extend(get_pops(n_in_pop))
# -> makes 14 population

# synaptic weight, must be tuned for spinnaker
w_exc = 0.25
开发者ID:rowleya,项目名称:PyNNSynfireChainExample,代码行数:29,代码来源:run.py

示例15:

   $ ./stdp_example

This example requires that the NeuroTools package is installed
(http://neuralensemble.org/trac/NeuroTools)

Authors : Catherine Wacongne < [email protected] >
          Xavier Lagorce < [email protected] >

April 2013
"""
import pylab
import pyNN.spiNNaker as sim

# SpiNNaker setup
sim.setup(timestep=1.0, min_delay=1.0, max_delay=10.0)

# +-------------------------------------------------------------------+
# | General Parameters                                                |
# +-------------------------------------------------------------------+

# Population parameters
model = sim.IF_curr_exp

cell_params = {'cm': 0.25,
               'i_offset': 0.0,
               'tau_m': 20.0,
               'tau_refrac': 2.0,
               'tau_syn_E': 5.0,
               'tau_syn_I': 5.0,
               'v_reset': -70.0,
开发者ID:AlexBoro,项目名称:polychronization,代码行数:30,代码来源:stdp_example.py


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