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: object

Abstract class that all PyNN Connectors extend.

Parameters:
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped. (NB: SpiNNaker always checks.)

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – Whether to output extra information about the connectivity to a CSV file

NUMPY_SYNAPSES_DTYPE = dtype([('source', '<u4'), ('target', '<u2'), ('weight', '<f8'), ('delay', '<f8'), ('synapse_type', 'u1')])
clone() AbstractConnector[source]

Create a clone of the Connector at init point

This is a best effort attempt and its use is not recommended

Returns:

A clone of the Connector. Ignoring any SynapseInformation

connect(projection: Projection) Never[source]

Apply this connector to a projection.

Warning

Do not call this! SpyNNaker does not work that way.

Parameters:

projection

Raises:

SpynnakerException – Always. Method not supported; profiled out.

delay_type_exception(delays: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]]) SpynnakerException[source]
Parameters:

delays

Returns:

An Exception explaining incorrect delay type

describe(template: str | None = None, engine: str = 'default') str[source]

Returns a human-readable description of the connection method.

The output may be customized by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

Returns:

A human-readable description of the connector.

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 – The synapse information of the connection

  • source_vertex – The source of the spikes

  • target_vertex – The target of the spikes

Returns:

A list of tuples of (target machine vertex, list of sources)

abstractmethod get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

abstractmethod get_delay_minimum(synapse_info: SynapseInformation) float | None[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays: Delays, synapse_info: SynapseInformation) float[source]
Parameters:
  • delays

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the delays.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

abstractmethod get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_provenance_data(synapse_info: SynapseInformation) None[source]

Adds the synapse information to provenance database.

Parameters:

synapse_info

get_unused() AbstractConnector[source]

Checks the Connector is unused and clones if needed

This method should just check the connector is unused, mark it as used and return it.

If the Connector is used will attempt to make a clone, log warning that this is not recommended and may be incorrect, and returns the clone.

Returns:

Ideally this Connector

abstractmethod get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

get_weight_mean(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The mean of the weights.

get_weight_variance(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the weights.

property safe: bool

Safe value supplied. Note ignored by sPyNNaker

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – the synapse info

set_space(space: Space) None[source]

Set the space object (allowed after instantiation).

Parameters:

space

property space: Space | None

The space object (may be updated after instantiation).

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 – The edge of the connection

  • synapse_info – The synaptic information

property verbose: bool

verbose value supplied by user

weight_type_exception(weights: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]] | None) SpynnakerException[source]
Parameters:

weights

Returns:

An Exception explaining incorrect weight or delay type

class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnHost

Bases: object

A 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

class spynnaker.pyNN.models.neural_projections.connectors.AbstractGenerateConnectorOnMachine(safe: bool = True, callback: None = None, verbose: bool = False)

Bases: AbstractConnector

Indicates that the connectivity can be generated on the machine.

Parameters:
  • safe – if True, check that weights and delays have valid values. If False, this check is skipped. (NB: SpiNNaker always checks.)

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – Whether to output extra information about the connectivity to a CSV file

abstract property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

gen_delay_params(delays: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[uint32]][source]
Parameters:

delays

Returns:

The parameters of the delay generator on the machine.

gen_delay_params_size_in_bytes(delays: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]]) int[source]
Parameters:

delays

Returns:

The size of the delay parameters in bytes.

gen_delays_id(delays: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]]) int[source]
Parameters:

delays

Returns:

The id of the delay generator on the machine.

gen_weight_params_size_in_bytes(weights: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]] | None) int[source]
Parameters:

weights

Returns:

The size of the weight parameters in bytes.

gen_weights_id(weights: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]] | None) int[source]
Parameters:

weights

Returns:

The id of the weight generator on the machine.

gen_weights_params(weights: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]] | None) ndarray[tuple[Any, ...], dtype[uint32]][source]
Parameters:

weights

Returns:

The parameters of the weight generator on the machine.

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 – The synapse information

Returns:

True if this instance can generate on the machine.

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 – The edge of the connection

  • synapse_info – The synaptic information

class spynnaker.pyNN.models.neural_projections.connectors.AllButMeConnector(n_neurons_per_group: int | None = None, weights: ndarray[tuple[Any, ...], dtype[float64]] | None = None, safe: bool = True, verbose: bool = False, callback: None = None)

Bases: AbstractGenerateConnectorOnMachine, AbstractGenerateConnectorOnHost

A 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. If False, 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.

    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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

get_weight_mean(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The mean of the weights.

get_weight_variance(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the weights.

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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

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

Parameters:
  • 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.

  • safe – If True, check that weights and delays have valid values. If False, 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.

property allow_self_connections: bool

if the connector is used to connect a Population to itself

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.ArrayConnector(array: ndarray[tuple[Any, ...], dtype[uint8]], safe: bool = True, callback: None = None, verbose: bool = False)

Bases: AbstractConnector, AbstractGenerateConnectorOnHost

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). Must be 2D in practice.

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

class spynnaker.pyNN.models.neural_projections.connectors.CSAConnector(cset: CSet, safe: bool = True, callback: None = None, verbose: bool = False)

Bases: AbstractConnector, AbstractGenerateConnectorOnHost

Make 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 – A description of the connection set between populations

  • safe – If True, check that weights and delays have valid values. If False, this check is skipped.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

show_connection_set(n_pre_neurons: int, n_post_neurons: int) None[source]

Calls csa.show

Parameters:
  • n_pre_neurons

  • n_post_neurons

class spynnaker.pyNN.models.neural_projections.connectors.ConvolutionConnector(kernel_weights: int | float | List[int | float] | Tuple[int | float, ...] | ndarray[tuple[Any, ...], 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: AbstractConnector

A 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

    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 list

    • RandomDistribution: kernel_shape must be provided; weights will be drawn from the distribution

  • kernel_shape – 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 – 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 – 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 – 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 – 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 – The receptor type to add the positive weights to. By default this is “excitatory”.

  • negative_receptor_type – The receptor type to add the negative weights to. By default this is “inhibitory”.

  • safe

  • verbose

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • filter_edges – 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 – The synapse information of the connection

  • source_vertex – The source of the spikes

  • target_vertex – The target of the spikes

Returns:

A list of tuples of (target machine vertex, list of sources)

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

get_encoded_kernel_weights(app_edge: ProjectionApplicationEdge, weight_scales: NDArray[floating]) NDArray[int16][source]
Parameters:
  • app_edge

  • weight_scales

Returns:

Encoded weights with weight scaling.

get_local_only_data(app_edge: ProjectionApplicationEdge, local_delay: int, delay_stage: int, weight_index: int) NDArray[uint32][source]
Parameters:
  • app_edge

  • local_delay

  • delay_stage

  • weight_index

Returns:

The local only data

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_post_shape(shape: Tuple[int, ...]) Tuple[int, ...][source]
Returns:

The shape of the post image given the pre-image shape.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

property kernel_n_bytes: int

Size of the weights in bytes

property kernel_n_weights: int

Size of the weights.

property kernel_weights: ndarray[tuple[Any, ...], dtype[float64]]

The weights for this connection.

property negative_receptor_type: str

The receptor type to add the negative weights to.

property parameters_n_bytes: int

The size of the connector struct in bytes

property positive_receptor_type: str

The receptor type to add the positive weights to.

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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

Make connections using a distribution which varies with distance.

Parameters:
  • d_expression – 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.

  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • n_connections – The number of efferent synaptic connections per neuron.

  • rng – Seeded random number generator, or None to make one when needed.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

property allow_self_connections: bool

if the connector is used to connect a Population to itself

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property d_expression: str

The distance expression.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – 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, AbstractGenerateConnectorOnHost

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

Parameters:
  • n – number of random post-synaptic neurons connected to pre-neurons.

  • 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.

  • safe – Whether to check that weights and delays have valid values; if False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • with_replacement – 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.

  • rng – Seeded random number generator, or None to make one when needed.

  • callback

    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?

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – 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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

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

Parameters:
  • n – number of random pre-synaptic neurons connected to output

  • 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.

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • with_replacement – 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 – Seeded random number generator, or None to make one when needed

  • callback

    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?

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – 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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

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

Parameters:
  • p_connect – a value between zero and one. Each potential connection is created with this probability.

  • 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.

  • safe – If True, check that weights and delays have valid values. If False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • rng – Seeded random number generator, or None to make one when needed

  • 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

property p_connect: float

Probability for each potential connection.

A value between zero and one. (inclusive)

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 – The edge of the connection

  • synapse_info – 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: FromListConnector

Make connections according to a list read from a file.

Parameters:
  • file

    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

    Basic pyNN says:

    if this is True, then each node will read connections from a file called filename.x, where x is the MPI rank. This speeds up loading connections for distributed simulations.

    Note

    Always leave this as False with sPyNNaker, which is not MPI-based.

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – Whether to output extra information about the connectivity to a CSV file

clone() FromListConnector[source]

Create a clone of the Connector at init point

This is a best effort attempt and its use is not recommended

Returns:

A clone of the Connector. Ignoring any SynapseInformation

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_reader(file: str) BaseFile[source]

Get a file reader object using the PyNN methods.

Returns:

A pynn StandardTextFile or similar

class spynnaker.pyNN.models.neural_projections.connectors.FromListConnector(conn_list: ndarray[tuple[Any, ...], dtype[_ScalarT]] | List[Tuple[int, ...]], column_names: Sequence[str] | None = None, *, safe: bool = True, verbose: bool = False, callback: None = None)

Bases: AbstractConnector, AbstractGenerateConnectorOnHost

Make connections according to a list.

Parameters:
  • conn_list

    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_idx is the index (i.e. order in the Population, not the ID) of the presynaptic neuron, post_idx is the index of the postsynaptic neuron, and p1, p2, etc. are the synaptic parameters (e.g., weight, delay, plasticity parameters). All tuples/rows must have the same number of items.

  • safe – if True, check that weights and delays have valid values. If False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • column_names – the names of the parameters p1, p2, etc. If not provided, it is assumed the parameters are weight, delay (for backwards compatibility).

  • callback

    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 weight and delay columns are present.

property conn_list: ndarray[tuple[Any, ...], dtype[_ScalarT]]

The connection list.

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

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 – The synapse information of the connection

  • source_vertex – The source of the spikes

  • target_vertex – The target of the spikes

Returns:

A list of tuples of (target machine vertex, list of sources)

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays: Delays, synapse_info: SynapseInformation) float[source]
Parameters:
  • delays

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the delays.

get_extra_parameter_names() Sequence[str] | None[source]
Returns:

The names of the extra parameters or None if there are None

get_extra_parameters() ndarray[tuple[Any, ...], dtype[_ScalarT]] | None[source]

Getter for the extra parameters. Excludes weight and delay columns.

Returns:

The extra parameters

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

get_weight_mean(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The mean of the weights.

get_weight_variance(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the weights.

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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

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

Parameters:
  • index_expression – 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 i and j when the expression is evaluated.

  • 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.

  • rng – Seeded random number generator, or None to make one when needed.

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – 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.

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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

property 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.

class spynnaker.pyNN.models.neural_projections.connectors.KernelConnector(shape_pre: List[int] | Tuple[int, int], shape_post: List[int] | Tuple[int, int], shape_kernel: List[int] | Tuple[int, int], weight_kernel: float | int | List[float] | ndarray[tuple[Any, ...], dtype[floating]] | RandomDistribution | None = None, delay_kernel: float | int | List[float] | ndarray[tuple[Any, ...], dtype[floating]] | RandomDistribution | None = None, shape_common: List[int] | Tuple[int, int] | None = None, pre_sample_steps_in_post: List[int] | Tuple[int, int] | None = None, pre_start_coords_in_post: List[int] | Tuple[int, int] | None = None, post_sample_steps_in_pre: List[int] | Tuple[int, int] | None = None, post_start_coords_in_pre: List[int] | Tuple[int, int] | None = None, safe: bool = True, space: Space | None = None, verbose: bool = False, callback: None = None)

Bases: AbstractGenerateConnectorOnMachine, AbstractGenerateConnectorOnHost

Where 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 – 2D shape of the pre-population (rows/height, columns/width, usually the input image shape)

  • shape_post – 2D shape of the post-population (rows/height, columns/width)

  • shape_kernel – 2D shape of the kernel (rows/height, columns/width)

  • weight_kernel – (optional) 2D matrix of size shape_kernel describing the weights

  • delay_kernel – (optional) 2D matrix of size shape_kernel describing the delays

  • shape_common – (optional) 2D shape of common coordinate system (for both pre- and post-, usually the input image sizes)

  • pre_sample_steps_in_post – (optional) Sampling steps/jumps for pre-population <=> (stepX, stepY)

  • pre_start_coords_in_post – (optional) Starting row/column for pre-population sampling <=> (offX, offY)

  • post_sample_steps_in_pre – (optional) Sampling steps/jumps for post-population <=> (stepX, stepY)

  • post_start_coords_in_pre – (optional) Starting row/column for post-population sampling <=> (offX, offY)

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • space – Currently ignored; for future compatibility.

  • 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

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 – The synapse information of the connection

  • source_vertex – The source of the spikes

  • target_vertex – The target of the spikes

Returns:

A list of tuples of (target machine vertex, list of sources)

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

get_delay_variance(delays: Delays, synapse_info: SynapseInformation) float[source]
Parameters:
  • delays

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the delays.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

get_weight_mean(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The mean of the weights.

get_weight_variance(weights: Weights, synapse_info: SynapseInformation) float[source]
Parameters:
  • weights

  • synapse_info – Info to get distances from (if needed)

Returns:

The variance of the weights.

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 – The edge of the connection

  • synapse_info – 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, AbstractGenerateConnectorOnHost

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:
  • n – This is the total number of synapses in the connection.

  • allow_self_connections – Allow a neuron to connect to itself or not.

  • with_replacement – When selecting, allow a neuron to be re-selected or not.

  • safe – Whether to check that weights and delays have valid values. If False, this check is skipped.

  • verbose – Whether to output extra information about the connectivity to a CSV file

  • rng – Seeded random number generator, or None to make one when needed.

  • 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_rng_next(num_synapses: int, prob_connect: Sequence[float], rng: NumpyRNG) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the required RNGs.

Parameters:
  • num_synapses – The number of synapses to make random numbers for in this call

  • prob_connect – The probability of connection

  • rng – The random number generator

Returns:

The multinomial distribution

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – 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 – The edge of the connection

  • synapse_info – The synaptic information

class spynnaker.pyNN.models.neural_projections.connectors.OneToOneConnector(safe: bool = True, callback: None = None, verbose: bool = False)

Bases: AbstractGenerateConnectorOnMachine, AbstractGenerateConnectorOnHost

Where 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 – if True, check that weights and delays have valid values. If False, this check is skipped. (NB: SpiNNaker always checks.)

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

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 – The synapse information

Returns:

True if this instance can generate on the machine.

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 – The synapse information of the connection

  • source_vertex – The source of the spikes

  • target_vertex – The target of the spikes

Returns:

A list of tuples of (target machine vertex, list of sources)

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

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, AbstractGenerateConnectorOnHost

A 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. If False, 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

property gen_connector_id: int

The ID of the connection generator on the machine.

gen_connector_params(synapse_info: SynapseInformation) NDArray[uint32][source]
Parameters:

synapse_info – The synaptic information

Returns:

The parameters of the on machine generation.

property gen_connector_params_size_in_bytes: int

The size of the connector parameters, in bytes.

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

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 – The edge of the connection

  • synapse_info – The synaptic information

class spynnaker.pyNN.models.neural_projections.connectors.PoolDenseConnector(weights: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], 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: AbstractConnector

A 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

    The synaptic strengths. Can be:

    • single value: the same value will be used for all weights

    • list: the total number of elements must be (number after pooling * number post)

    • ndarray: As above for list

    • RandomDistribution: weights will be drawn at random

  • pool_shape – 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 – 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 – The receptor type to add the positive weights to. By default this is “excitatory”.

  • negative_receptor_type – The receptor type to add the negative weights to. By default this is “inhibitory”.

  • safe – (ignored)

  • verbose – (ignored)

  • callback

    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]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

get_local_only_data(app_edge: ProjectionApplicationEdge, local_delay: int, delay_stage: int, post_vertex_slice: Slice, weight_scales: NDArray[floating]) NDArray[uint32][source]
Parameters:
  • app_edge

  • local_delay

  • delay_stage

  • post_vertex_slice

  • weight_scales

Returns:

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

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[Any, ...], dtype[_ScalarT]][source]
Parameters:
  • pre_shape – tuple(int)

  • pool_shape

  • pool_stride

Returns:

The shape considering the stride

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

local_only_n_bytes(pre_shape: Tuple[int, ...], n_post_atoms: int) int[source]
Parameters:
  • pre_shape

  • n_post_atoms

Returns:

Size in bytes needed for the weights

property negative_receptor_type: str

The receptor type to add the negative weights to

property positive_receptor_type: str

The receptor type to add the positive weights to

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 – The edge of the connection

  • synapse_info – The synaptic information

property weights: ndarray[tuple[Any, ...], dtype[_ScalarT]]

The synaptic strengths

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, AbstractGenerateConnectorOnHost

A 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 – the region length where nodes will be connected locally

  • rewiring – the probability of rewiring each edge

  • 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. False is currently unsupported!

  • n_connections – if specified, the number of efferent synaptic connections per neuron

  • rng – Seeded random number generator, or None to make one when needed.

  • safe – If True, check that weights and delays have valid values. If False, this check is skipped.

  • callback

    if given, a callable that display a progress bar on the terminal.

    Note

    Not supported by sPyNNaker.

  • verbose – 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_slices

  • post_vertex_slice

  • synapse_type

  • synapse_info

Returns:

The synaptic matrix data to go to the machine, as a Numpy array

get_delay_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info – the synapse info

Returns:

The maximum delay specified by the user in ms,.

get_delay_minimum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The minimum delay specified by the user in ms, or None if unbounded.

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:
  • n_post_atoms

  • synapse_info

  • min_delay

  • max_delay

Returns:

maximum number of connections

get_n_connections_to_post_vertex_maximum(synapse_info: SynapseInformation) int[source]
Parameters:

synapse_info

Returns:

The maximum number of connections to any neuron

in the post vertex from neurons in the pre vertex.

get_parameters() Dict[str, Any][source]

A list of parameters that would recreate this connector.

May not be exactly the same as the ones used to construct this.

Will also not include any information or changes added by later calls.

Returns:

A map of the init parameters to the values passed in.

get_weight_maximum(synapse_info: SynapseInformation) float[source]
Parameters:

synapse_info

Returns:

The maximum of the weights for this connection.

set_projection_information(synapse_info: SynapseInformation) None[source]

Sets a connectors projection info.

Parameters:

synapse_info – the synapse info