spynnaker.pyNN.models.neural_projections.connectors package

Submodules

spynnaker.pyNN.models.neural_projections.connectors.abstract_connector module

class spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector(safe=True, verbose=False, rng=None)[source]

Bases: object

Abstract class that all PyNN Connectors extend.

NUMPY_SYNAPSES_DTYPE = [('source', 'uint32'), ('target', 'uint16'), ('weight', 'float64'), ('delay', 'float64'), ('synapse_type', 'uint8')]
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays)[source]

Get the variance of the delays.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_provenance_data()[source]
get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

get_weight_mean(weights)[source]

Get the mean of the weights.

get_weight_variance(weights)[source]

Get the variance of the weights.

post_population
pre_population
safe
set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
set_space(space)[source]

Set the space object (allowed after instantiation).

Parameters:space
Returns:
space
verbose

spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine module

class spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine(safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Indicates that the connectivity can be generated on the machine

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
gen_delay_params(delays, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the delay generator on the machine

Return type:numpy array of uint32
gen_delay_params_size_in_bytes(delays)[source]

The size of the delay parameters in bytes

Return type:int
gen_delays_id(delays)[source]

Get the id of the delay generator on the machine

Return type:int
gen_weight_params_size_in_bytes(weights)[source]

The size of the weight parameters in bytes

Return type:int
gen_weights_id(weights)[source]

Get the id of the weight generator on the machine

Return type:int
gen_weights_params(weights, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the weight generator on the machine

Return type:numpy array of uint32
generate_on_machine(weights, delays)[source]

Determine if this instance can generate on the machine.

Default implementation returns True if the weights and delays can be generated on the machine

Return type:bool
class spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.ConnectorIDs[source]

Bases: enum.Enum

An enumeration.

ALL_TO_ALL_CONNECTOR = 1
FIXED_NUMBER_POST_CONNECTOR = 5
FIXED_NUMBER_PRE_CONNECTOR = 4
FIXED_PROBABILITY_CONNECTOR = 2
FIXED_TOTAL_NUMBER_CONNECTOR = 3
KERNEL_CONNECTOR = 6
ONE_TO_ONE_CONNECTOR = 0

spynnaker.pyNN.models.neural_projections.connectors.all_to_all_connector module

class spynnaker.pyNN.models.neural_projections.connectors.all_to_all_connector.AllToAllConnector(allow_self_connections=True, safe=True, verbose=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects all cells in the presynaptic population to all cells in the postsynaptic population.

Parameters:allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

spynnaker.pyNN.models.neural_projections.connectors.array_connector module

class spynnaker.pyNN.models.neural_projections.connectors.array_connector.ArrayConnector(array, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using an array of integers based on the IDs of the neurons in the pre- and post-populations.

Parameters:array – An explicit boolean matrix that specifies the connections between the pre- and post-populations (see PyNN documentation)
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

spynnaker.pyNN.models.neural_projections.connectors.csa_connector module

class spynnaker.pyNN.models.neural_projections.connectors.csa_connector.CSAConnector(cset, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a Connection Set Algebra (Djurfeldt 2012) description between the neurons in the pre- and post-populations. If you get TypeError in Python 3 see: https://github.com/INCF/csa/issues/10

Parameters:cset ('?') – A description of the connection set between populations
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

show_connection_set()[source]

spynnaker.pyNN.models.neural_projections.connectors.distance_dependent_probability_connector module

class spynnaker.pyNN.models.neural_projections.connectors.distance_dependent_probability_connector.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a distribution which varies with distance.

Parameters:
  • d_expression (bool) – the right-hand side of a valid python expression for probability, involving ‘d’, e.g. “exp(-abs(d))”, or “d<3”, that can be parsed by eval(), that computes the distance dependent distribution.
  • allow_self_connections – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance-dependent weights or delays.
  • n_connections (int or None) – The number of efferent synaptic connections per neuron.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

d_expression
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]

spynnaker.pyNN.models.neural_projections.connectors.fixed_number_post_connector module

class spynnaker.pyNN.models.neural_projections.connectors.fixed_number_post_connector.FixedNumberPostConnector(n, allow_self_connections=True, with_replacement=False, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects a fixed number of post-synaptic neurons selected at random, to all pre-synaptic neurons.

Parameters:
  • n (int) – number of random post-synaptic neurons connected to pre-neurons.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • with_replacement (bool) – this flag determines how the random selection of post-synaptic neurons is performed; if true, then every post-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; if false, then once a post-synaptic neuron has been connected to a pre-neuron, it can’t be connected again.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]

spynnaker.pyNN.models.neural_projections.connectors.fixed_number_pre_connector module

class spynnaker.pyNN.models.neural_projections.connectors.fixed_number_pre_connector.FixedNumberPreConnector(n, allow_self_connections=True, with_replacement=False, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects a fixed number of pre-synaptic neurons selected at random, to all post-synaptic neurons.

Parameters:
  • n (int) – number of random pre-synaptic neurons connected to output
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • with_replacement (bool) – this flag determines how the random selection of pre-synaptic neurons is performed; if true, then every pre-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; if false, then once a pre-synaptic neuron has been connected to a post-neuron, it can’t be connected again.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]

spynnaker.pyNN.models.neural_projections.connectors.fixed_probability_connector module

class spynnaker.pyNN.models.neural_projections.connectors.fixed_probability_connector.FixedProbabilityConnector(p_connect, allow_self_connections=True, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

For each pair of pre-post cells, the connection probability is constant.

Parameters:
  • p_connect (float) – a float between zero and one. Each potential connection is created with this probability.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance-dependent weights or delays - not implemented
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

spynnaker.pyNN.models.neural_projections.connectors.from_list_connector module

class spynnaker.pyNN.models.neural_projections.connectors.from_list_connector.FromListConnector(conn_list, safe=True, verbose=False, column_names=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections according to a list.

Param:

conn_list: a list of tuples, one tuple for each connection. Each tuple should contain at least:

(pre_idx, post_idx)

where pre_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, and post_idx is the index of the postsynaptic neuron.

Additional items per synapse are acceptable but all synapses should have the same number of items.

column_names
conn_list
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays)[source]

Get the variance of the delays.

get_extra_parameter_names()[source]

Getter for the names of the extra parameters

get_extra_parameters()[source]

Getter for the extra parameters.

Returns:The extra parameters
get_n_connections(pre_slices, post_slices, pre_hi, post_hi)[source]
get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

get_weight_mean(weights)[source]

Get the mean of the weights.

get_weight_variance(weights)[source]

Get the variance of the weights.

spynnaker.pyNN.models.neural_projections.connectors.index_based_probability_connector module

class spynnaker.pyNN.models.neural_projections.connectors.index_based_probability_connector.IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a probability distribution which varies dependent upon the indices of the pre- and post-populations.

Parameters:
  • index_expression (string) – the right-hand side of a valid python expression for probability, involving the indices of the pre and post populations, that can be parsed by eval(), that computes a probability dist.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

index_expression

spynnaker.pyNN.models.neural_projections.connectors.kernel_connector module

class spynnaker.pyNN.models.neural_projections.connectors.kernel_connector.ConvolutionKernel[source]

Bases: numpy.ndarray

class spynnaker.pyNN.models.neural_projections.connectors.kernel_connector.KernelConnector(shape_pre, shape_post, shape_kernel, weight_kernel, delay_kernel, shape_common, pre_sample_steps, pre_start_coords, post_sample_steps, post_start_coords, safe, space, verbose)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, col) neuron to many pre(row, col, kernel) through a (kernel) set of weights and/or delays.

TODO: should these include allow_self_connections and with_replacement?

Parameters:
  • shape_pre – 2D shape of the pre population (rows/height, cols/width, usually the input image shape)
  • shape_post – 2D shape of the post population (rows/height, cols/width)
  • shape_kernel – 2D shape of the kernel (rows/height, cols/width)
  • (optional) (pre/post_start_coords) – 2D matrix of size shape_kernel describing the weights
  • (optional) – 2D matrix of size shape_kernel describing the delays
  • (optional) – 2D shape of common coordinate system (for both pre and post, usually the input image sizes)
  • (optional) – Sampling steps/jumps for pre/post pop <=> (startX, endX, _stepX_) None or 2-item array
  • (optional) – Starting row/col for pre/post sampling <=> (_startX_, endX, stepX) None or 2-item array
compute_statistics(weights, delays, pre_vertex_slice, post_vertex_slice)[source]
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
gen_delay_params(delays, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the delay generator on the machine

Return type:numpy array of uint32
gen_delay_params_size_in_bytes(delays)[source]

The size of the delay parameters in bytes

Return type:int
gen_delays_id(delays)[source]

Get the id of the delay generator on the machine

Return type:int
gen_weight_params_size_in_bytes(weights)[source]

The size of the weight parameters in bytes

Return type:int
gen_weights_id(weights)[source]

Get the id of the weight generator on the machine

Return type:int
gen_weights_params(weights, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the weight generator on the machine

Return type:numpy array of uint32
generate_on_machine

Determine if this instance can generate on the machine.

Default implementation returns True if the weights and delays can be generated on the machine

Return type:bool
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_kernel_vals(vals)[source]
get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

map_to_pre_coords(post_r, post_c)[source]
post_as_pre(post_vertex_slice)[source]
pre_as_post(coords)[source]
to_post_coords(post_vertex_slice)[source]
spynnaker.pyNN.models.neural_projections.connectors.kernel_connector.shape2word(sw, sh)[source]

spynnaker.pyNN.models.neural_projections.connectors.multapse_connector module

class spynnaker.pyNN.models.neural_projections.connectors.multapse_connector.MultapseConnector(num_synapses, allow_self_connections=True, with_replacement=True, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Create a multapse connector. The size of the source and destination populations are obtained when the projection is connected. The number of synapses is specified. when instantiated, the required number of synapses is created by selecting at random from the source and target populations with replacement. Uniform selection probability is assumed.

Parameters:
  • num_synapses (int) – This is the total number of synapses in the connection.
  • allow_self_connections (bool) – Allow a neuron to connect to itself or not.
  • with_replacement (bool) – When selecting, allow a neuron to be re-selected or not.
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_rng_next(num_synapses, prob_connect)[source]

Get the required RNGs

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

spynnaker.pyNN.models.neural_projections.connectors.one_to_one_connector module

class spynnaker.pyNN.models.neural_projections.connectors.one_to_one_connector.OneToOneConnector(random_number_class, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Where the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic pynn_population.py to cell i in the postsynaptic pynn_population.py for all i.

create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

spynnaker.pyNN.models.neural_projections.connectors.small_world_connector module

class spynnaker.pyNN.models.neural_projections.connectors.small_world_connector.SmallWorldConnector(degree, rewiring, allow_self_connections=True, safe=True, verbose=False, n_connections=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]

Module contents

class spynnaker.pyNN.models.neural_projections.connectors.AbstractConnector(safe=True, verbose=False, rng=None)[source]

Bases: object

Abstract class that all PyNN Connectors extend.

NUMPY_SYNAPSES_DTYPE = [('source', 'uint32'), ('target', 'uint16'), ('weight', 'float64'), ('delay', 'float64'), ('synapse_type', 'uint8')]
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays)[source]

Get the variance of the delays.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_provenance_data()[source]
get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

get_weight_mean(weights)[source]

Get the mean of the weights.

get_weight_variance(weights)[source]

Get the variance of the weights.

post_population
pre_population
safe
set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
set_space(space)[source]

Set the space object (allowed after instantiation).

Parameters:space
Returns:
space
verbose
class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnMachine(safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Indicates that the connectivity can be generated on the machine

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
gen_delay_params(delays, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the delay generator on the machine

Return type:numpy array of uint32
gen_delay_params_size_in_bytes(delays)[source]

The size of the delay parameters in bytes

Return type:int
gen_delays_id(delays)[source]

Get the id of the delay generator on the machine

Return type:int
gen_weight_params_size_in_bytes(weights)[source]

The size of the weight parameters in bytes

Return type:int
gen_weights_id(weights)[source]

Get the id of the weight generator on the machine

Return type:int
gen_weights_params(weights, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the weight generator on the machine

Return type:numpy array of uint32
generate_on_machine(weights, delays)[source]

Determine if this instance can generate on the machine.

Default implementation returns True if the weights and delays can be generated on the machine

Return type:bool
class spynnaker.pyNN.models.neural_projections.connectors.AllToAllConnector(allow_self_connections=True, safe=True, verbose=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects all cells in the presynaptic population to all cells in the postsynaptic population.

Parameters:allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.ArrayConnector(array, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using an array of integers based on the IDs of the neurons in the pre- and post-populations.

Parameters:array – An explicit boolean matrix that specifies the connections between the pre- and post-populations (see PyNN documentation)
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.CSAConnector(cset, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a Connection Set Algebra (Djurfeldt 2012) description between the neurons in the pre- and post-populations. If you get TypeError in Python 3 see: https://github.com/INCF/csa/issues/10

Parameters:cset ('?') – A description of the connection set between populations
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

show_connection_set()[source]
class spynnaker.pyNN.models.neural_projections.connectors.DistanceDependentProbabilityConnector(d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a distribution which varies with distance.

Parameters:
  • d_expression (bool) – the right-hand side of a valid python expression for probability, involving ‘d’, e.g. “exp(-abs(d))”, or “d<3”, that can be parsed by eval(), that computes the distance dependent distribution.
  • allow_self_connections – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance-dependent weights or delays.
  • n_connections (int or None) – The number of efferent synaptic connections per neuron.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

d_expression
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPostConnector(n, allow_self_connections=True, with_replacement=False, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects a fixed number of post-synaptic neurons selected at random, to all pre-synaptic neurons.

Parameters:
  • n (int) – number of random post-synaptic neurons connected to pre-neurons.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • with_replacement (bool) – this flag determines how the random selection of post-synaptic neurons is performed; if true, then every post-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; if false, then once a post-synaptic neuron has been connected to a pre-neuron, it can’t be connected again.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPreConnector(n, allow_self_connections=True, with_replacement=False, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Connects a fixed number of pre-synaptic neurons selected at random, to all post-synaptic neurons.

Parameters:
  • n (int) – number of random pre-synaptic neurons connected to output
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • with_replacement (bool) – this flag determines how the random selection of pre-synaptic neurons is performed; if true, then every pre-synaptic neuron can be chosen on each occasion, and so multiple connections between neuron pairs are possible; if false, then once a pre-synaptic neuron has been connected to a post-neuron, it can’t be connected again.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
class spynnaker.pyNN.models.neural_projections.connectors.FixedProbabilityConnector(p_connect, allow_self_connections=True, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

For each pair of pre-post cells, the connection probability is constant.

Parameters:
  • p_connect (float) – a float between zero and one. Each potential connection is created with this probability.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
  • space (pyNN.Space) – a Space object, needed if you wish to specify distance-dependent weights or delays - not implemented
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.FromListConnector(conn_list, safe=True, verbose=False, column_names=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections according to a list.

Param:

conn_list: a list of tuples, one tuple for each connection. Each tuple should contain at least:

(pre_idx, post_idx)

where pre_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, and post_idx is the index of the postsynaptic neuron.

Additional items per synapse are acceptable but all synapses should have the same number of items.

column_names
conn_list
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays)[source]

Get the variance of the delays.

get_extra_parameter_names()[source]

Getter for the names of the extra parameters

get_extra_parameters()[source]

Getter for the extra parameters.

Returns:The extra parameters
get_n_connections(pre_slices, post_slices, pre_hi, post_hi)[source]
get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

get_weight_mean(weights)[source]

Get the mean of the weights.

get_weight_variance(weights)[source]

Get the variance of the weights.

class spynnaker.pyNN.models.neural_projections.connectors.IndexBasedProbabilityConnector(index_expression, allow_self_connections=True, rng=None, safe=True, callback=None, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

Make connections using a probability distribution which varies dependent upon the indices of the pre- and post-populations.

Parameters:
  • index_expression (string) – the right-hand side of a valid python expression for probability, involving the indices of the pre and post populations, that can be parsed by eval(), that computes a probability dist.
  • allow_self_connections (bool) – if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population.
allow_self_connections
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

index_expression
class spynnaker.pyNN.models.neural_projections.connectors.MultapseConnector(num_synapses, allow_self_connections=True, with_replacement=True, safe=True, verbose=False, rng=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Create a multapse connector. The size of the source and destination populations are obtained when the projection is connected. The number of synapses is specified. when instantiated, the required number of synapses is created by selecting at random from the source and target populations with replacement. Uniform selection probability is assumed.

Parameters:
  • num_synapses (int) – This is the total number of synapses in the connection.
  • allow_self_connections (bool) – Allow a neuron to connect to itself or not.
  • with_replacement (bool) – When selecting, allow a neuron to be re-selected or not.
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_rng_next(num_synapses, prob_connect)[source]

Get the required RNGs

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.OneToOneConnector(random_number_class, safe=True, verbose=False)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Where the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic pynn_population.py to cell i in the postsynaptic pynn_population.py for all i.

create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.SmallWorldConnector(degree, rewiring, allow_self_connections=True, safe=True, verbose=False, n_connections=None)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_connector.AbstractConnector

create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

set_projection_information(pre_population, post_population, rng, machine_time_step)[source]
class spynnaker.pyNN.models.neural_projections.connectors.KernelConnector(shape_pre, shape_post, shape_kernel, weight_kernel, delay_kernel, shape_common, pre_sample_steps, pre_start_coords, post_sample_steps, post_start_coords, safe, space, verbose)[source]

Bases: spynnaker.pyNN.models.neural_projections.connectors.abstract_generate_connector_on_machine.AbstractGenerateConnectorOnMachine

Where the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, col) neuron to many pre(row, col, kernel) through a (kernel) set of weights and/or delays.

TODO: should these include allow_self_connections and with_replacement?

Parameters:
  • shape_pre – 2D shape of the pre population (rows/height, cols/width, usually the input image shape)
  • shape_post – 2D shape of the post population (rows/height, cols/width)
  • shape_kernel – 2D shape of the kernel (rows/height, cols/width)
  • (optional) (pre/post_start_coords) – 2D matrix of size shape_kernel describing the weights
  • (optional) – 2D matrix of size shape_kernel describing the delays
  • (optional) – 2D shape of common coordinate system (for both pre and post, usually the input image sizes)
  • (optional) – Sampling steps/jumps for pre/post pop <=> (startX, endX, _stepX_) None or 2-item array
  • (optional) – Starting row/col for pre/post sampling <=> (_startX_, endX, stepX) None or 2-item array
compute_statistics(weights, delays, pre_vertex_slice, post_vertex_slice)[source]
create_synaptic_block(weights, delays, pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Create a synaptic block from the data.

gen_connector_id

Get the id of the connection generator on the machine

Return type:int
gen_connector_params(pre_slices, pre_slice_index, post_slices, post_slice_index, pre_vertex_slice, post_vertex_slice, synapse_type)[source]

Get the parameters of the on machine generation.

Return type:numpy array of uint32
gen_connector_params_size_in_bytes

The size of the connector parameters in bytes.

Return type:int
gen_delay_params(delays, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the delay generator on the machine

Return type:numpy array of uint32
gen_delay_params_size_in_bytes(delays)[source]

The size of the delay parameters in bytes

Return type:int
gen_delays_id(delays)[source]

Get the id of the delay generator on the machine

Return type:int
gen_weight_params_size_in_bytes(weights)[source]

The size of the weight parameters in bytes

Return type:int
gen_weights_id(weights)[source]

Get the id of the weight generator on the machine

Return type:int
gen_weights_params(weights, pre_vertex_slice, post_vertex_slice)[source]

Get the parameters of the weight generator on the machine

Return type:numpy array of uint32
generate_on_machine

Determine if this instance can generate on the machine.

Default implementation returns True if the weights and delays can be generated on the machine

Return type:bool
get_delay_maximum(delays)[source]

Get the maximum delay specified by the user in ms, or None if unbounded.

get_kernel_vals(vals)[source]
get_n_connections_from_pre_vertex_maximum(delays, post_vertex_slice, min_delay=None, max_delay=None)[source]

Get the maximum number of connections between those from any neuron in the pre vertex to the neurons in the post_vertex_slice, for connections with a delay between min_delay and max_delay (inclusive) if both specified (otherwise all connections).

get_n_connections_to_post_vertex_maximum()[source]

Get the maximum number of connections between those to any neuron in the post vertex from neurons in the pre vertex.

get_weight_maximum(weights)[source]

Get the maximum of the weights for this connection.

map_to_pre_coords(post_r, post_c)[source]
post_as_pre(post_vertex_slice)[source]
pre_as_post(coords)[source]
to_post_coords(post_vertex_slice)[source]