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


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})
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

class population_interface():
    """
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,
    'v_thresh': -55,
    'tau_syn_E': 5,
    'tau_syn_I': 10,
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,  
                'v_thresh'   : -55,
                'tau_syn_E'   : 5,
                'tau_syn_I'   : 10,
Example #5
0
   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, {