spynnaker.pyNN.models package

Subpackages

Submodules

spynnaker.pyNN.models.abstract_pynn_model module

class spynnaker.pyNN.models.abstract_pynn_model.AbstractPyNNModel[source]

Bases: object

A Model that can be passed in to a Population object in PyNN

create_vertex(n_neurons, label, constraints)[source]

Create a vertex for a population of the model

Parameters:
  • n_neurons (int) – The number of neurons in the population
  • label (str) – The label to give to the vertex
  • constraints (list or None) – A list of constraints to give to the vertex, or None
Returns:

An application vertex for the population

Return type:

pacman.model.graphs.application.ApplicationVertex

default_initial_values = {}
default_parameters = {}
default_population_parameters
Get the default values for the parameters at the population level
These are parameters that can be passed in to the Population constructor in addition to the standard PyNN options
Return type:dict(str, object)
classmethod get_max_atoms_per_core()[source]

Get the maximum number of atoms per core for this model

Return type:int
classmethod get_parameter_names()[source]

Get the names of the parameters of the model

Return type:list(str)
classmethod has_parameter(name)[source]

Determine if the model has a parameter with the given name

Parameters:name (str) – The name of the parameter to check for
Return type:bool
classmethod set_model_max_atoms_per_core(n_atoms=9223372036854775807)[source]

Set the maximum number of atoms per core for this model

Parameters:n_atoms (int or None) – The new maximum, or None for the largest possible

spynnaker.pyNN.models.defaults module

spynnaker.pyNN.models.defaults.default_initial_values(state_variables)[source]

Specifies arguments which are state variables. Only works on the __init__ method of a class that is additionally decorated with defaults`()

Parameters:state_variables (set of str) – The names of the arguments that are state variables
spynnaker.pyNN.models.defaults.default_parameters(parameters)[source]

Specifies arguments which are parameters. Only works on the __init__ method of a class that is additionally decorated with defaults`()

Parameters:parameters (set of str) – The names of the arguments that are parameters
spynnaker.pyNN.models.defaults.defaults(cls)[source]

Get the default parameters and state variables from the arguments to the __init__ method. This uses the decorators default_parameters() and default_initial_values() to determine the parameters and state variables respectively. If only one is specified, the other is assumed to be the remaining arguments. If neither are specified, it is assumed that all default arguments are parameters.

spynnaker.pyNN.models.defaults.get_dict_from_init(init, skip=None, include=None)[source]

spynnaker.pyNN.models.pynn_population_common module

class spynnaker.pyNN.models.pynn_population_common.PyNNPopulationCommon(spinnaker_control, size, label, constraints, model, structure, initial_values, additional_parameters=None)[source]

Bases: object

add_placement_constraint(x, y, p=None)[source]

Add a placement constraint

Parameters:
  • x (int) – The x-coordinate of the placement constraint
  • y (int) – The y-coordinate of the placement constraint
  • p (int) – The processor ID of the placement constraint (optional)
conductance_based

True if the population uses conductance inputs

first_id
get(parameter_names, gather=True, simplify=True)[source]

Get the values of a parameter for every local cell in the population.

Parameters:
  • parameter_names – Name of parameter. This is either a single string or a list of strings
  • gather – pointless on sPyNNaker
Returns:

A single list of values (or possibly a single value) if paramter_names is a string, or a dict of these if parameter names is a list.

Return type:

str or list(str) or dict(str,str) or dict(str,list(str))

get_by_selector(selector, parameter_names)[source]

Get the values of a parameter for the selected cell in the population.

Parameters:
  • parameter_names – Name of parameter. This is either a single string or a list of strings
  • selector – a description of the subrange to accept. Or None for all. See: _selector_to_ids in SpiNNUtils.spinn_utilities.ranged.abstract_sized.py
Returns:

A single list of values (or possibly a single value) if paramter_names is a string or a dict of these if parameter names is a list.

Return type:

str or list(str) or dict(str,str) or dict(str,list(str))

get_spike_counts(spikes, gather=True)[source]

Return the number of spikes for each neuron.

Defined by http://neuralensemble.org/docs/PyNN/reference/populations.html

Parameters:gather – pointless on sPyNNaker
id_to_index(id)[source]

Given the ID(s) of cell(s) in the Population, return its (their) index (order in the Population).

Defined by http://neuralensemble.org/docs/PyNN/reference/populations.html

id_to_local_index(cell_id)[source]

Given the ID(s) of cell(s) in the Population, return its (their) index (order in the Population), counting only cells on the local MPI node. Defined by http://neuralensemble.org/docs/PyNN/reference/populations.html

index_to_id(index)[source]

Given the index (order in the Population) of cell(s) in the Population, return their ID(s)

inject(current_source)[source]

Connect a current source to all cells in the Population.

Defined by http://neuralensemble.org/docs/PyNN/reference/populations.html

label

The label of the population

last_id
local_size

The number of local cells

Defined by http://neuralensemble.org/docs/PyNN/reference/populations.html

mark_no_changes()[source]
positions

Return the position array for structured populations.

requires_mapping
set(parameter, value=None)[source]

Set one or more parameters for every cell in the population.

param can be a dict, in which case value should not be supplied, or a string giving the parameter name, in which case value is the parameter value. value can be a numeric value, or list of such (e.g. for setting spike times):

p.set("tau_m", 20.0).
p.set({'tau_m':20, 'v_rest':-65})
Parameters:
  • parameter (str or dict) – the parameter to set
  • value – the value of the parameter to set.
set_by_selector(selector, parameter, value=None)[source]

Set one or more parameters for selected cell in the population.

param can be a dict, in which case value should not be supplied, or a string giving the parameter name, in which case value is the parameter value. value can be a numeric value, or list of such (e.g. for setting spike times):

p.set("tau_m", 20.0).
p.set({'tau_m':20, 'v_rest':-65})
Parameters:
  • selector – See RangedList.set_value_by_selector as this is just a pass through method
  • parameter – the parameter to set
  • value – the value of the parameter to set.
set_constraint(constraint)[source]

Apply a constraint to a population that restricts the processor onto which its atoms will be placed.

set_mapping_constraint(constraint_dict)[source]

Add a placement constraint - for backwards compatibility

Parameters:constraint_dict (dict(str, int)) – A dictionary containing “x”, “y” and optionally “p” as keys, and ints as values
set_max_atoms_per_core(max_atoms_per_core)[source]

Supports the setting of this population’s max atoms per core

Parameters:max_atoms_per_core – the new value for the max atoms per core.
size

The number of neurons in the population

structure

Return the structure for the population.

spynnaker.pyNN.models.pynn_projection_common module

class spynnaker.pyNN.models.pynn_projection_common.PyNNProjectionCommon(spinnaker_control, connector, synapse_dynamics_stdp, target, pre_synaptic_population, post_synaptic_population, prepop_is_view, postpop_is_view, rng, machine_time_step, user_max_delay, label, time_scale_factor)[source]

Bases: object

A container for all the connections of a given type (same synapse type and plasticity mechanisms) between two populations, together with methods to set parameters of those connections, including of plasticity mechanisms.

mark_no_changes()[source]
requires_mapping
size(gather=True)[source]

Return the total number of connections.

Parameters:gather – If False, only get the number of connections locally. Which means nothing on SpiNNaker…

spynnaker.pyNN.models.recording_common module

class spynnaker.pyNN.models.recording_common.RecordingCommon(population)[source]

Bases: object

Object to hold recording behaviour.

Parameters:population – the population to record for

Module contents