spynnaker.pyNN.models.neural_projections.connectors package¶
Module contents¶
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractConnector(safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
objectAbstract class that all PyNN Connectors extend.
- Parameters:
- NUMPY_SYNAPSES_DTYPE = dtype([('source', '<u4'), ('target', '<u2'), ('weight', '<f8'), ('delay', '<f8'), ('synapse_type', 'u1')])¶
- connect(projection: Projection) Never[source]¶
Apply this connector to a projection.
Warning
Do not call this! SpyNNaker does not work that way.
- Parameters:
projection (Projection)
- Raises:
SpynnakerException – Always. Method not supported; profiled out.
- delay_type_exception(delays: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]]) SpynnakerException[source]¶
Returns an Exception explaining incorrect delay type
- Parameters:
delays
- Raises:
SpynnakerException
- get_connected_vertices(s_info: SynapseInformation, source_vertex: ApplicationVertex, target_vertex: ApplicationVertex) Sequence[Tuple[MachineVertex, Sequence[AbstractVertex]]][source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- abstractmethod get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- abstractmethod get_delay_minimum(synapse_info: SynapseInformation) float | None[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_delay_variance(delays: Delay_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the delays.
- Parameters:
delays (RandomDistribution or int or float or str)
- Return type:
- abstractmethod get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- abstractmethod get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_provenance_data(synapse_info: SynapseInformation) None[source]¶
- Parameters:
synapse_info (SynapseInformation)
- abstractmethod get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_mean(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the mean of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- get_weight_variance(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- set_space(space: Space) None[source]¶
Set the space object (allowed after instantiation).
- Parameters:
space (Space)
- property space: Space | None¶
The space object (may be updated after instantiation).
- Return type:
Space or None
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnHost¶
Bases:
objectA connector that can be generated on host.
- abstractmethod create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnMachine(safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractConnectorIndicates that the connectivity can be generated on the machine.
- Parameters:
- abstract property gen_connector_id: int¶
The ID of the connection generator on the machine.
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- gen_delay_params(delays: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]]) ndarray[tuple[int, ...], dtype[uint32]][source]¶
Get the parameters of the delay generator on the machine.
- Parameters:
delays (RandomDistribution or int or float)
- Return type:
ndarray(uint32)
- gen_delay_params_size_in_bytes(delays: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]]) int[source]¶
The size of the delay parameters in bytes.
- Parameters:
delays (RandomDistribution or int or float)
- Return type:
- gen_delays_id(delays: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]]) int[source]¶
Get the id of the delay generator on the machine.
- Parameters:
delays (RandomDistribution or int or float)
- Return type:
- gen_weight_params_size_in_bytes(weights: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]] | None) int[source]¶
The size of the weight parameters in bytes.
- Parameters:
weights (RandomDistribution or int or float)
- Return type:
- gen_weights_id(weights: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]] | None) int[source]¶
Get the id of the weight generator on the machine.
- Parameters:
weights (RandomDistribution or int or float)
- Return type:
- gen_weights_params(weights: float | str | RandomDistribution | ndarray[tuple[int, ...], dtype[float64]] | None) ndarray[tuple[int, ...], dtype[uint32]][source]¶
Get the parameters of the weight generator on the machine.
- Parameters:
weights (RandomDistribution or int or float)
- Return type:
ndarray(uint32)
- generate_on_machine(synapse_info: SynapseInformation) bool[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
- Parameters:
synapse_info (SynapseInformation) – The synapse information
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.AllButMeConnector(n_neurons_per_group: int | None = None, weights: ndarray[tuple[int, ...], dtype[float64]] | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostA Connector that connect all the neurons except the one with the same id.
This will connect each neuron in each group (default a single group for the whole Population) to the target neurons in that group except the one with the same id.
There is also an option to add weights. These are then used for each group.
The know use case is multiple potential winner-takes-all groups where the connector each time a neurons spikes will inhibit all other neurons in the group.
As the only know use case is source and target population of the same size (including self connections) whose size is an exact positive integer multiple of the n_neurons_per_group so that is all currently supported.
- Parameters:
n_neurons_per_group – The number of neurons in each winner-takes-all group. Must be a positive integer divisor of source.size
weights – The weights for one group of neurons Single Value, RandomDistribution and string values not supported.
safe – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose – Whether to output extra information about the connectivity to a CSV file
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_mean(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the mean of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- get_weight_variance(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.AllToAllConnector(allow_self_connections: bool = True, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostConnects 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.
safe (bool) – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.ArrayConnector(array: ndarray[tuple[int, ...], dtype[uint8]], safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostMake connections using an array of integers based on the IDs of the neurons in the pre- and post-populations.
- Parameters:
array (ndarray(2, uint8)) – An explicit Boolean matrix that specifies the connections between the pre- and post-populations (see PyNN documentation). Must be 2D in practice.
safe (bool) – Whether to check that weights and delays have valid values. If False, this check is skipped.
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.CSAConnector(cset: CSet, safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostMake connections using a Connection Set Algebra (Djurfeldt 2012) description between the neurons in the pre- and post-populations.
Note
If you get TypeError in Python 3 see: https://github.com/INCF/csa/issues/10
- Parameters:
cset (csa.connset.CSet) – A description of the connection set between populations
safe (bool) – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- Raises:
ImportError – if the csa library isn’t present; it’s tricky to install in some environments so we don’t force it to be present unless you want to actually use this class.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.ConvolutionConnector(kernel_weights: int | float | List[int | float] | Tuple[int | float, ...] | ndarray[tuple[int, ...], dtype[float64]] | RandomDistribution, kernel_shape: int | Tuple[int, int] | None = None, strides: int | Tuple[int, int] | None = None, padding: bool | int | Tuple[int, int] | None = None, pool_shape: int | Tuple[int, int] | None = None, pool_stride: int | Tuple[int, int] | None = None, positive_receptor_type: str = 'excitatory', negative_receptor_type: str = 'inhibitory', safe: bool = True, verbose: bool = False, callback: None = None, filter_edges: bool = True)¶
Bases:
AbstractConnectorA 2D connector that centres on a post neuron.
Special connector which dynamically maps a 2D kernel over a 2D plane, so that when the kernel is centred on a post-neuron, that post-neuron receives input from each pre-neuron that the kernel touches, and the weights of those pre-post connections are then the values of the kernel.
- Parameters:
kernel_weights (int or list or ndarray or RandomDistribution) –
The synaptic strengths, shared by neurons in the post population. Can be:
single value: kernel_shape must be provided; the same value will be used for all weights
simple list: kernel_shape must be provided; the list must be sized shape width * height
2D list: If kernel_shape is provided, it must match
ndarray: As above for simple or 2D listRandomDistribution: kernel_shape must be provided; weights will be drawn from the distribution
kernel_shape (int or tuple(int,int)) – The shape of the kernel if it cannot be determined from kernel_weights. If a single value is provided, a square kernel will be assumed. If two values are provided, it will be assumed to be (n_rows, n_columns)
strides (int or tuple(int, int)) – Spatial sampling frequency, jumps between the post neurons. This matches the meaning of standard ML packages. If a single value is provided, the same stride will be used for rows and columns. If two values are provided it will be assumed to be (stride_rows, stride_columns)
padding (bool or int or tuple(int, int) or None) – How many ‘extra pixels’ around the pre-population will be added, only zero-valued pixels are currently supported. If a single value is provided, the same padding will be used for rows and columns. If two values are provided it will be assumed to be (padding_rows, padding_columns). If True, automatic padding will be used based on the kernel shape. If False or None, no padding will be used.
pool_shape (int or tuple(int, int) or None) – Area of pooling, only average pooling is supported (and seems to make sense). If a single value is provided, the pooling area will be square. If two values are provided it will be assumed to be (pooling_rows, pooling_columns).
pool_stride (int or tuple(int, int) or None) – Jumps between pooling regions. If a single value is provided, the same stride will be used for rows and columns. If two values are provided it will be assumed to be (stride_rows, stride_columns)
positive_receptor_type (str) – The receptor type to add the positive weights to. By default this is “
excitatory”.negative_receptor_type (str) – The receptor type to add the negative weights to. By default this is “
inhibitory”.safe (bool)
verbose (bool)
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
filter_edges (bool) – Whether to filter the edges based on connectivity or not; filtered means that the receiving cores will receive fewer packets, whereas non-filtered means that receiving cores will receive all packets whether relevant or not. However non-filtered may be more efficient in the routing tables, so may be needed if routing compression doesn’t work.
- get_connected_vertices(s_info: SynapseInformation, source_vertex: ApplicationVertex, target_vertex: ApplicationVertex) Sequence[Tuple[MachineVertex, Sequence[AbstractVertex]]][source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_encoded_kernel_weights(app_edge: ProjectionApplicationEdge, weight_scales: NDArray[floating]) NDArray[int16][source]¶
Encode weights with weight scaling.
- Parameters:
app_edge (ProjectionApplicationEdge)
weight_scales (ndarray)
- Return type:
ndarray
- get_local_only_data(app_edge: ProjectionApplicationEdge, local_delay: int, delay_stage: int, weight_index: int) NDArray[uint32][source]¶
Gets the local only data
- Parameters:
app_edge (ProjectionApplicationEdge)
local_delay (int)
delay_stage (int)
weight_index (int)
- Return type:
ndarray
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_post_shape(shape: Tuple[int, ...]) Tuple[int, ...][source]¶
Get the shape of the post image given the pre-image shape.
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- property kernel_weights: ndarray[tuple[int, ...], dtype[float64]]¶
The weights for this connection.
- Return type:
ndarray
- property negative_receptor_type: str¶
The receptor type to add the negative weights to.
- Return type:
- property positive_receptor_type: str¶
The receptor type to add the positive weights to.
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.DistanceDependentProbabilityConnector(d_expression: str, allow_self_connections: bool = True, n_connections: int | None = None, rng: NumpyRNG | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostMake connections using a distribution which varies with distance.
- Parameters:
d_expression (str) – 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 byeval(), that computes the distance dependent distribution.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.
safe (bool) – if
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
n_connections (int or None) – The number of efferent synaptic connections per neuron.
rng (NumpyRNG or None) – Seeded random number generator, or
Noneto make one when needed.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPostConnector(n: int, *, allow_self_connections: bool = True, with_replacement: bool = False, rng: NumpyRNG | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostConnects 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.
safe (bool) – Whether to check that weights and delays have valid values; if
False, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
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; ifFalse, then once a post-synaptic neuron has been connected to a pre-neuron, it can’t be connected again.rng (NumpyRNG or None) – Seeded random number generator, or
Noneto make one when needed.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property allow_self_connections: bool¶
Do we include connections from a neuron/id to itself?
- Return type:
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FixedNumberPreConnector(n: int, *, allow_self_connections: bool = True, with_replacement: bool = False, rng: NumpyRNG | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostConnects 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.
safe (bool) – Whether to check that weights and delays have valid values. If
False, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
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.
rng (NumpyRNG or None) – Seeded random number generator, or None to make one when needed
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property allow_self_connections: bool¶
Do we include connections from a neuron/id to itself?
- Return type:
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FixedProbabilityConnector(p_connect: float, allow_self_connections: bool = True, safe: bool = True, verbose: bool = False, rng: NumpyRNG | None = None, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostFor each pair of pre-post cells, the connection probability is constant.
- Parameters:
p_connect (float) – a value 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.
safe (bool) – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
rng (NumpyRNG or None) – Seeded random number generator, or None to make one when needed
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- property p_connect: float¶
Probability for each potential connection.
A value between zero and one. (inclusive)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.FromFileConnector(file: str | BaseFile, distributed: bool = False, safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
FromListConnectorMake connections according to a list read from a file.
- Parameters:
Either an open file object or the filename of a file containing a list of connections, in the format required by
FromListConnector. Column headers, if included in the file, must be specified using a list or tuple, e.g.:# columns = ["i", "j", "weight", "delay", "U", "tau_rec"]Note
The header requires # at the beginning of the line.
distributed (bool) –
Basic pyNN says:
if this is
True, then each node will read connections from a file calledfilename.x, wherexis the MPI rank. This speeds up loading connections for distributed simulations.Note
Always leave this as
Falsewith sPyNNaker, which is not MPI-based.safe (bool) – Whether to check that weights and delays have valid values. If
False, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- class spynnaker.pyNN.models.neural_projections.connectors.FromListConnector(conn_list: None | ndarray[tuple[int, ...], dtype[_ScalarType_co]] | List[Tuple[int, ...]], column_names: Sequence[str] | None = None, *, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostMake connections according to a list.
- Parameters:
conn_list (ndarray or list(tuple(int,int,...))) –
A numpy array or a list of tuples, one tuple for each connection. Each tuple should contain:
(pre_idx, post_idx, p1, p2, ..., pn)
where
pre_idxis the index (i.e. order in the Population, not the ID) of the presynaptic neuron,post_idxis the index of the postsynaptic neuron, andp1,p2, etc. are the synaptic parameters (e.g., weight, delay, plasticity parameters). All tuples/rows must have the same number of items.safe (bool) – if
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
column_names (None or tuple(str) or list(str)) – the names of the parameters
p1,p2, etc. If not provided, it is assumed the parameters areweight, delay(for backwards compatibility).callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- property column_names: Sequence[str] | None¶
The names of the columns in the array after the first two. Of particular interest is whether
weightanddelaycolumns are present.
- property conn_list: ndarray[tuple[int, ...], dtype[_ScalarType_co]]¶
The connection list.
- Return type:
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_connected_vertices(s_info: SynapseInformation, source_vertex: ApplicationVertex, target_vertex: ApplicationVertex) Sequence[Tuple[MachineVertex, Sequence[AbstractVertex]]][source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_delay_variance(delays: Delay_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the delays.
- Parameters:
delays (RandomDistribution or int or float or str)
- Return type:
- get_extra_parameters() ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None[source]¶
Getter for the extra parameters. Excludes
weightanddelaycolumns.- Returns:
The extra parameters
- Return type:
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_mean(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the mean of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- get_weight_variance(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.IndexBasedProbabilityConnector(index_expression: str, allow_self_connections: bool = True, rng: NumpyRNG | None = None, safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostMake connections using a probability distribution which varies dependent upon the indices of the pre- and post-populations.
- Parameters:
index_expression (str) – 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 distribution; the indices will be given as variables
iandjwhen the expression is evaluated.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.
rng (NumpyRNG or None) – Seeded random number generator, or
Noneto make one when needed.safe (bool) – Whether to check that weights and delays have valid values. If
False, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- property allow_self_connections: bool¶
When 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.
- Return type:
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.KernelConnector(shape_pre: _TwoD, shape_post: _TwoD, shape_kernel: _TwoD, weight_kernel: _Kernel | None = None, delay_kernel: _Kernel | None = None, shape_common: _TwoD | None = None, pre_sample_steps_in_post: _TwoD | None = None, pre_start_coords_in_post: _TwoD | None = None, post_sample_steps_in_pre: _TwoD | None = None, post_start_coords_in_pre: _TwoD | None = None, safe: bool = True, space: Space | None = None, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostWhere the pre- and post-synaptic populations are considered as a 2D array. Connect every post(row, column) neuron to many pre(row, column, kernel) through a (kernel) set of weights and/or delays.
- Parameters:
shape_pre (list(int) or tuple(int,int)) – 2D shape of the pre-population (rows/height, columns/width, usually the input image shape)
shape_post (list(int) or tuple(int,int)) – 2D shape of the post-population (rows/height, columns/width)
shape_kernel (list(int) or tuple(int,int)) – 2D shape of the kernel (rows/height, columns/width)
weight_kernel (ndarray or RandomDistribution or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the weights
delay_kernel (ndarray or RandomDistribution or int or float or list(int) or list(float) or None) – (optional) 2D matrix of size shape_kernel describing the delays
shape_common (list(int) or tuple(int,int) or None) – (optional) 2D shape of common coordinate system (for both pre- and post-, usually the input image sizes)
pre_sample_steps_in_post (None or list(int) or tuple(int,int)) – (optional) Sampling steps/jumps for pre-population <=> (stepX, stepY)
pre_start_coords_in_post (None or list(int) or tuple(int,int)) – (optional) Starting row/column for pre-population sampling <=> (offX, offY)
post_sample_steps_in_pre (None or list(int) or tuple(int,int)) – (optional) Sampling steps/jumps for post-population <=> (stepX, stepY)
post_start_coords_in_pre (None or list(int) or tuple(int,int)) – (optional) Starting row/column for post-population sampling <=> (offX, offY)
safe (bool) – Whether to check that weights and delays have valid values. If
False, this check is skipped.space (Space) – Currently ignored; for future compatibility.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_connected_vertices(s_info: SynapseInformation, source_vertex: ApplicationVertex, target_vertex: ApplicationVertex) Sequence[Tuple[MachineVertex, Sequence[AbstractVertex]]][source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_delay_variance(delays: Delay_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the delays.
- Parameters:
delays (RandomDistribution or int or float or str)
- Return type:
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_mean(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the mean of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- get_weight_variance(weights: Weight_Types, synapse_info: SynapseInformation) float[source]¶
Get the variance of the weights.
- Parameters:
weights (RandomDistribution or int or float or str)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.MultapseConnector(n: int, allow_self_connections: bool = True, with_replacement: bool = True, rng: NumpyRNG | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostCreate 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:
n (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.
safe (bool) – Whether to check that weights and delays have valid values. If
False, this check is skipped.verbose (bool) – Whether to output extra information about the connectivity to a CSV file
rng (NumpyRNG or None) – Seeded random number generator, or
Noneto make one when needed.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_rng_next(num_synapses: int, prob_connect: Sequence[float], rng: NumpyRNG) ndarray[tuple[int, ...], dtype[integer]][source]¶
Get the required RNGs.
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.OneToOneConnector(safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostWhere the pre- and postsynaptic populations have the same size, connect cell i in the presynaptic population to cell i in the postsynaptic population, for all i.
- Parameters:
safe (bool) – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- generate_on_machine(synapse_info: SynapseInformation) bool[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
- Parameters:
synapse_info (SynapseInformation) – The synapse information
- Return type:
- get_connected_vertices(s_info: SynapseInformation, source_vertex: ApplicationVertex, target_vertex: ApplicationVertex) Sequence[Tuple[MachineVertex, Sequence[MachineVertex]]][source]¶
Get the machine vertices that are connected to each other with this connector
- Parameters:
s_info (SynapseInformation) – The synapse information of the connection
source_vertex (ApplicationVertex) – The source of the spikes
target_vertex (ApplicationVertex) – The target of the spikes
- Returns:
A list of tuples of (target machine vertex, list of sources)
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- class spynnaker.pyNN.models.neural_projections.connectors.OneToOneOffsetConnector(offset: int, wrap: bool, n_neurons_per_group: int | None = None, safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractGenerateConnectorOnMachine,AbstractGenerateConnectorOnHostA Connector that connects each pre-neuron to a post-neuron offset by a specific amount, positive or negative. If this goes beyond the start or end of the post neurons, it can optionally wrap around. Additional options include a group size, where the offset and wrap is applied repeatedly to subsets of neurons.
In the current implementation it is assumed that the pre- and post-populations have the same number of neurons, and that the number of neurons is divisible by the group size if specified. The offset must also be smaller than the group size or the number of neurons.
- Parameters:
offset – The offset to apply to the pre-neuron index to get the post neuron index. This can be positive or negative.
wrap – Whether to wrap around the start or end of the post neurons if the post neuron id is out of range.
n_neurons_per_group – The number of neurons in each group. Must be a positive integer divisor of source.size
safe – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.verbose – Whether to output extra information about the connectivity to a CSV file
callback –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]¶
Get the parameters of the on machine generation.
- Parameters:
synapse_info (SynapseInformation) – The synaptic information
- Return type:
ndarray(uint32)
- property gen_connector_params_size_in_bytes: int¶
The size of the connector parameters, in bytes.
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.PoolDenseConnector(weights: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], pool_shape: int | Tuple[int] | None = None, pool_stride: int | Tuple[int] | None = None, positive_receptor_type: str = 'excitatory', negative_receptor_type: str = 'inhibitory', safe: bool = True, verbose: bool = False, callback: None = None)¶
Bases:
AbstractConnectorA multidimensional connector based on weight and pool shape and stride.
A weight is provided for every pre-post pair of neurons, where the post-population size is determined by the pre-population size and a pool shape, which how many pre-neurons are connected to each post-neuron in each dimension, and pool stride, which decides how the shape moves over the image in each dimension to choose the pre-neurons for each post-neuron.
- Parameters:
weights (int or float or list(int or float) or ndarray or RandomDistribution) –
The synaptic strengths. Can be:
pool_shape (int or tuple(int) or None) – Shape of average pooling. If a single value is provided, it will be used for every dimension, otherwise must be the same number of values as there are dimensions in the source.
pool_stride (int or tuple(int) or None) – Jumps between pooling regions. If a single value is provided, the same stride will be used for all dimensions, otherwise must be the same number of values as there are dimensions in the source. If None, and pool_shape is provided, pool_stride will be set to pool_shape.
positive_receptor_type (str) – The receptor type to add the positive weights to. By default this is “excitatory”.
negative_receptor_type (str) – The receptor type to add the negative weights to. By default this is “inhibitory”.
safe (bool) – (ignored)
verbose (bool) – (ignored)
callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_local_only_data(app_edge: ProjectionApplicationEdge, local_delay: int, delay_stage: int, post_vertex_slice: Slice, weight_scales: NDArray[floating]) NDArray[uint32][source]¶
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- classmethod get_post_pool_shape(pre_shape: Tuple[int, ...], pool_shape: int | Tuple[int, ...] | None = None, pool_stride: int | Tuple[int, ...] | None = None) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]¶
The shape considering the stride
- Parameters:
pre_shape – tuple(int)
- Return type:
ndarray
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- validate_connection(application_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]¶
Checks that the edge supports the connector. Returns nothing; it is assumed that an Exception will be raised if anything is wrong.
By default this checks only that the views are not used on multi-dimensional vertices.
- Parameters:
application_edge (ApplicationEdge) – The edge of the connection
synapse_info (SynapseInformation) – The synaptic information
- class spynnaker.pyNN.models.neural_projections.connectors.SmallWorldConnector(degree: float, rewiring: float, allow_self_connections: bool = True, n_connections: int | None = None, rng: NumpyRNG | None = None, safe: bool = True, callback: None = None, verbose: bool = False)¶
Bases:
AbstractConnector,AbstractGenerateConnectorOnHostA connector that uses connection statistics based on the Small World network connectivity model.
Note
This is typically used from a population to itself.
- Parameters:
degree (float) – the region length where nodes will be connected locally
rewiring (float) – the probability of rewiring each edge
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.
n_connections (int or None) – if specified, the number of efferent synaptic connections per neuron
rng (NumpyRNG or None) – Seeded random number generator, or
Noneto make one when needed.safe (bool) – If
True, check that weights and delays have valid values. IfFalse, this check is skipped.callback (callable) –
if given, a callable that display a progress bar on the terminal.
Note
Not supported by sPyNNaker.
verbose (bool) – Whether to output extra information about the connectivity to a CSV file
- create_synaptic_block(post_slices: Sequence[Slice], post_vertex_slice: Slice, synapse_type: int, synapse_info: SynapseInformation) NDArray[source]¶
Create a synaptic block from the data.
- Parameters:
post_vertex_slice (Slice)
synapse_type (AbstractSynapseType)
synapse_info (SynapseInformation)
- Returns:
The synaptic matrix data to go to the machine, as a Numpy array
- Return type:
- get_delay_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum delay specified by the user in ms,.
- Parameters:
synapse_info (SynapseInformation) – the synapse info
- get_delay_minimum(synapse_info: SynapseInformation) float[source]¶
Get the minimum delay specified by the user in ms, or None if unbounded.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
int or None
- get_n_connections_from_pre_vertex_maximum(n_post_atoms: int, synapse_info: SynapseInformation, min_delay: float | None = None, max_delay: float | None = None) int[source]¶
Get the maximum number of connections 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).
Not all concrete connectors support omitting the delay range.
- Parameters:
delays (RandomDistribution or int or float or str)
n_post_atoms (int)
synapse_info (SynapseInformation)
min_delay (float)
max_delay (float)
- Return type:
- get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]¶
Get the maximum number of connections to any neuron in the post vertex from neurons in the pre vertex.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- get_weight_maximum(synapse_info: SynapseInformation) float[source]¶
Get the maximum of the weights for this connection.
- Parameters:
synapse_info (SynapseInformation)
- Return type:
- set_projection_information(synapse_info: SynapseInformation) None[source]¶
Sets a connectors projection info.
- Parameters:
synapse_info (SynapseInformation) – the synapse info