spynnaker.pyNN.models.neuron.synapse_dynamics package

Submodules

spynnaker.pyNN.models.neuron.synapse_dynamics.types module

spynnaker.pyNN.models.neuron.synapse_dynamics.types.ConnectionsArray

Type of connections. The dtype is actually NUMPY_CONNECTORS_DTYPE but we cannot currently express that in the overall array type due to Numpy typing limitations.

alias of ndarray[tuple[Any, …], dtype[void]]

spynnaker.pyNN.models.neuron.synapse_dynamics.types.NUMPY_CONNECTORS_DTYPE: Final = dtype([('source', '<u4'), ('target', '<u4'), ('weight', '<f8'), ('delay', '<f8')])

Type model of the basic configuration data of a connector

Module contents

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractGenerateOnMachine

Bases: object

A synapse dynamics that can be generated on the machine.

abstract property gen_matrix_id: int

The ID of the on-machine matrix generator.

abstractmethod gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

abstract property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

generate_on_machine() bool[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Returns:

True if the instance should be generated on the machine.

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractHasParameterNames

Bases: object

A component that has parameter names. Parameter names are usually properties of the component, and are frequently also settable by named parameter when making the component.

abstractmethod get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractPlasticSynapseDynamics(delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None, weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

Bases: AbstractSDRAMSynapseDynamics

Synapses which change over time.

Parameters:
  • delay – The delay or a way of generating the delays

  • weight – The weights or way to generate the weights

abstractmethod get_n_fixed_plastic_words_per_row(fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of fixed plastic words to be read from each row.

abstractmethod get_n_plastic_plastic_words_per_row(pp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of plastic words to be read from each row.

abstractmethod get_n_synapses_in_rows(pp_size: ndarray[tuple[Any, ...], dtype[uint32]], fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size.

Parameters:
  • pp_size

  • fp_size

Returns:

The number of synapses in each of the rows

abstractmethod get_n_words_for_plastic_connections(n_connections: int) int[source]
Parameters:

n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

abstractmethod get_plastic_synaptic_data(connections: ndarray[tuple[Any, ...], dtype[void]], connection_row_indices: ndarray[tuple[Any, ...], dtype[integer]], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[ndarray[tuple[Any, ...], dtype[uint32]], ndarray[tuple[Any, ...], dtype[uint32]], ndarray[tuple[Any, ...], dtype[uint32]], ndarray[tuple[Any, ...], dtype[uint32]]] | Tuple[List[ndarray[tuple[Any, ...], dtype[uint32]]], List[ndarray[tuple[Any, ...], dtype[uint32]]], ndarray[tuple[Any, ...], dtype[uint32]], ndarray[tuple[Any, ...], dtype[uint32]]][source]

Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The total number of rows

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(fp_data (2D), pp_data (2D), fp_size (1D), pp_size (1D))

abstractmethod read_plastic_synaptic_data(n_synapse_types: int, pp_size: ndarray[tuple[Any, ...], dtype[uint32]], pp_data: List[ndarray[tuple[Any, ...], dtype[uint32]]], fp_size: ndarray[tuple[Any, ...], dtype[uint32]], fp_data: List[ndarray[tuple[Any, ...], dtype[uint32]]], max_atoms_per_core: int) ndarray[tuple[Any, ...], dtype[void]][source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
  • n_synapse_types

  • pp_size – 1D

  • pp_data – 2D

  • fp_size – 1D

  • fp_data – 2D

  • max_atoms_per_core

Returns:

array with columns source, target, weight, delay

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSDRAMSynapseDynamics(delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None, weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

Bases: AbstractSynapseDynamics, AbstractHasParameterNames

How do the dynamics of a synapse interact with the rest of the model.

Parameters:
  • delay – The delay or a way of generating the delays

  • weight – The weights or way to generate the weights

convert_per_connection_data_to_rows(connection_row_indices: ndarray[tuple[Any, ...], dtype[integer]], n_rows: int, data: ndarray[tuple[Any, ...], dtype[_ScalarT]], max_n_synapses: int) List[ndarray[tuple[Any, ...], dtype[_ScalarT]]][source]

Converts per-connection data generated from connections into row-based data to be returned from get_synaptic_data.

Parameters:
  • connection_row_indices – The index of the row that each item should go into

  • n_rows – The number of rows

  • data – The non-row-based data

  • max_n_synapses – The maximum number of synapses to generate in each row

Returns:

Row based data

abstractmethod get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_items(rows: List[ndarray[tuple[Any, ...], dtype[_ScalarT]]], item_size: int) ndarray[tuple[Any, ...], dtype[uint32]][source]

Get the number of items in each row as 4-byte values, given the item size.

Parameters:
  • rows

  • item_size

Returns:

The number of items in each row

abstractmethod get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

The SDRAM usage of the synapse dynamics parameters in bytes.

get_words(rows: List[ndarray[tuple[Any, ...], dtype[_ScalarT]]]) List[ndarray[tuple[Any, ...], dtype[uint32]]][source]

Convert the row data to words.

Parameters:

rows

Returns:

data as words

abstractmethod is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

abstract property pad_to_length: int | None

The amount each row should pad to, or None if not specified.

abstractmethod write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractStaticSynapseDynamics(delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None, weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

Bases: AbstractSDRAMSynapseDynamics

Dynamics which don’t change over time.

Parameters:
  • delay – The delay or a way of generating the delays

  • weight – The weights or way to generate the weights

abstractmethod get_n_static_words_per_row(ff_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Parameters:

ff_size

Returns:

The number of bytes to be read per row for the static data given the size that was written to each row.

abstractmethod get_n_synapses_in_rows(ff_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Parameters:

ff_size

Returns:

The number of synapses in the rows with sizes ff_size.

abstractmethod get_n_words_for_static_connections(n_connections: int) int[source]
Parameters:

n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

abstractmethod get_static_synaptic_data(connections: ndarray[tuple[Any, ...], dtype[void]], connection_row_indices: ndarray[tuple[Any, ...], dtype[integer]], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[List[ndarray[tuple[Any, ...], dtype[uint32]]], ndarray[tuple[Any, ...], dtype[integer]]][source]

Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The number of rows to write

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(ff_data, ff_size)

abstractmethod read_static_synaptic_data(n_synapse_types: int, ff_size: ndarray[tuple[Any, ...], dtype[integer]], ff_data: List[ndarray[tuple[Any, ...], dtype[uint32]]], max_atoms_per_core: int) ndarray[tuple[Any, ...], dtype[void]][source]

Read the connections from the words of data in ff_data.

Parameters:
  • n_synapse_types

  • ff_size

  • ff_data

  • max_atoms_per_core

Returns:

the connections read with dtype NUMPY_CONNECTORS_DTYPE

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSupportsSignedWeights

Bases: object

A synapse dynamics object that supports signed weights.

abstractmethod get_maximum_positive_weight(incoming_projection: Projection) float[source]

Get the maximum likely positive weight.

Note

This must be a value >= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The maximum likely positive weight.

abstractmethod get_mean_negative_weight(incoming_projection: Projection) float[source]

Get the mean of the negative weights.

Note

This must be a value <= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The mean of the negative weights.

abstractmethod get_mean_positive_weight(incoming_projection: Projection) float[source]

Get the mean of the positive weights.

Note

This must be a value >= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The mean of the positive weights.

abstractmethod get_minimum_negative_weight(incoming_projection: Projection) float[source]

Get the minimum likely negative weight.

Note

This must be a value <= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The minimum likely negative weight

abstractmethod get_negative_synapse_index(incoming_projection: Projection) int[source]
Parameters:

incoming_projection – The projection targeted

Returns:

The synapse type that negative weights will arrive as.

abstractmethod get_positive_synapse_index(incoming_projection: Projection) int[source]
Parameters:

incoming_projection – The projection targeted

Returns:

The synapse type that positive weights will arrive as.

abstractmethod get_variance_negative_weight(incoming_projection: Projection) float[source]

Get the variance of the negative weights.

Note

This must be a value <= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The variance of the negative weights.

abstractmethod get_variance_positive_weight(incoming_projection: Projection) float[source]

Get the variance of the positive weights.

Note

This must be a value >= 0.

Parameters:

incoming_projection – The projection targeted

Returns:

The variance of the positive weights.

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSynapseDynamics(delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None, weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

Bases: object

How do the dynamics of a synapse interact with the rest of the model.

Parameters:
  • delay – The delay or a way of generating the delays

  • weight – The weights or way to generate the weights

NUMPY_CONNECTORS_DTYPE = dtype([('source', '<u4'), ('target', '<u4'), ('weight', '<f8'), ('delay', '<f8')])
property absolute_max_atoms_per_core: int

The absolute maximum number of atoms per core supported by this synapse dynamics object.

abstract property changes_during_run: bool

Whether the synapses change during a run.

property delay: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]]

The delay of connections.

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(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Returns:

The maximum delay for the synapses.

get_delay_minimum(connector: AbstractConnector, synapse_info: SynapseInformation) float | None[source]

Get the minimum delay for the synapses.

This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
  • connector – connector

  • synapse_info – synapse info

Returns:

The minimum delay

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

  • delays

  • synapse_info

Returns:

The variance in delay for the synapses.

get_synapse_id_by_target(target: str) int | None[source]
Parameters:

target – The name of the synapse

Returns:

The index of the synapse type based on the name, or None if the name is not found.

get_synapse_parameter_names() Set[str][source]
Returns:

the names of the parameters that can be extracted from synapses read from the machine.

get_value(key: str) Any[source]

Get a property.

Parameters:

key – the name of the property

Returns:

Value for this key

abstractmethod get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

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

  • weights

  • synapse_info

Returns:

The variance in weight for the synapses.

abstract property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

abstract property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

abstractmethod merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

set_value(key: str, value: Any) None[source]

Set a property.

Parameters:
  • key – the name of the parameter to change

  • value – the new value of the parameter to assign

abstract property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

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 weight: float | str | RandomDistribution | ndarray[tuple[Any, ...], dtype[float64]] | None

The weight of connections.

class spynnaker.pyNN.models.neuron.synapse_dynamics.AbstractSynapseDynamicsStructural

Bases: object

Base class for synapse dynamics that structural plasticity understands.

abstractmethod check_initial_delay(max_delay_ms: int) None[source]

Check that delays can be done without delay extensions.

Parameters:

max_delay_ms – The maximum delay supported, in milliseconds

Raises:

Exception – if the delay is out of range

abstract property elimination: AbstractElimination

The elimination rule.

abstract property f_rew: float

The frequency of rewiring.

abstract property formation: AbstractFormation

The formation rule.

abstractmethod get_max_rewires_per_ts() int[source]
Returns:

The max number of rewires per timestep.

abstractmethod get_structural_parameters_sdram_usage_in_bytes(incoming_projections: Iterable[Projection], n_neurons: int) int[source]

Get the size of the structural parameters.

Note

At the Application level this will be an estimate.

Parameters:
  • incoming_projections – The projections that target the vertex in question

  • n_neurons

Returns:

the size of the parameters, in bytes

Raises:

PacmanInvalidParameterException – If the parameters make no sense.

abstract property initial_delay: float

The delay of a formed connection.

abstract property initial_weight: float

The weight of a formed connection.

abstract property partner_selection: AbstractPartnerSelection

The partner selection rule.

abstract property s_max: int

The maximum number of synapses.

abstract property seed: int | None

The seed to control the randomness.

abstractmethod set_connections(connections: ConnectionsArray, post_vertex_slice: Slice, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]

Set connections for structural plasticity.

Parameters:
  • connections

  • post_vertex_slice

  • app_edge

  • synapse_info

abstract property with_replacement: bool

Whether to allow replacement when creating synapses.

abstractmethod write_structural_parameters(spec: DataSpecificationBase, region: int, weight_scales: NDArray[floating], app_vertex: PopulationVertex, vertex_slice: Slice, synaptic_matrices: SynapticMatrices) None[source]

Write structural plasticity parameters.

Parameters:
  • spec – The data specification to write to

  • region – region ID

  • weight_scales – Weight scaling for each synapse type

  • app_vertex – The target application vertex

  • vertex_slice – The slice of the target vertex to generate for

  • synaptic_matrices – The synaptic matrices for this vertex

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsNeuromodulation(weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None = 0.0, tau_c: float = 1000.0, tau_d: float = 200.0, w_min: float = 0.0, w_max: float = 1.0)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

Synapses that target a neuromodulation receptor.

Parameters:
  • weight – The weights or way to generate the weights

  • tau_c

  • tau_d

  • w_min

  • w_max

property changes_during_run: bool

Whether the synapses change during a run.

property gen_matrix_id: int

The ID of the on-machine matrix generator.

gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_fixed_plastic_words_per_row(fp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of fixed plastic words to be read from each row.

get_n_plastic_plastic_words_per_row(pp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of plastic words to be read from each row.

get_n_synapses_in_rows(pp_size: ndarray[tuple[Any, ...], dtype[integer]], fp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size.

Parameters:
  • pp_size

  • fp_size

Returns:

The number of synapses in each of the rows

get_n_words_for_plastic_connections(n_connections: int) int[source]
Parameters:

n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

The SDRAM usage of the synapse dynamics parameters in bytes.

get_plastic_synaptic_data(connections: ConnectionsArray, connection_row_indices: NDArray[integer], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[NDArray[uint32], NDArray[uint32], NDArray[uint32], NDArray[uint32]][source]

Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The total number of rows

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(fp_data (2D), pp_data (2D), fp_size (1D), pp_size (1D))

get_synapse_id_by_target(target: str) int | None[source]
Parameters:

target – The name of the synapse

Returns:

The index of the synapse type based on the name, or None if the name is not found.

get_value(key: str) float[source]

Get a property.

Parameters:

key – the name of the property

Returns:

Value for this key

get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_neuromodulation_same_as(other: SynapseDynamicsNeuromodulation) bool[source]

Checks that tau c, tau d, w max and w min are all the same.

Parameters:

other

Returns:

True if all checked values are the same

is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property pad_to_length: None

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(n_synapse_types: int, pp_size: NDArray[uint32], pp_data: List[NDArray[uint32]], fp_size: NDArray[uint32], fp_data: List[NDArray[uint32]], max_atoms_per_core: int) ConnectionsArray[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
  • n_synapse_types

  • pp_size – 1D

  • pp_data – 2D

  • fp_size – 1D

  • fp_data – 2D

  • max_atoms_per_core

Returns:

array with columns source, target, weight, delay

set_value(key: str, value: float) None[source]

Set a property.

Parameters:
  • key – the name of the parameter to change

  • value – the new value of the parameter to assign

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

property tau_c: float

The tau c value passed into the init.

property tau_d: float

The tau d value passed into the init.

property w_max: float

The w max value passed into the init.

property w_min: float

The w min value passed into the init.

write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsSTDP(timing_dependence: AbstractTimingDependence, weight_dependence: AbstractWeightDependence, voltage_dependence: None = None, dendritic_delay_fraction: float = 1.0, weight: _In_Types = 0.0, delay: _In_Types = None, pad_to_length: int | None = None, backprop_delay: bool = True)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

The dynamics of a synapse that changes over time using a Spike Timing Dependent Plasticity (STDP) rule.

Parameters:
  • timing_dependence

  • weight_dependence

  • voltage_dependence – not supported

  • dendritic_delay_fraction – must be 1.0!

  • weight

  • delay – Use None to get the simulator default minimum delay.

  • pad_to_length

  • backprop_delay

property backprop_delay: bool

Settable.

property changes_during_run: bool

Whether the synapses change during a run.

property dendritic_delay_fraction: float

Settable.

property gen_matrix_id: int

The ID of the on-machine matrix generator.

gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_fixed_plastic_words_per_row(fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of fixed plastic words to be read from each row.

get_n_plastic_plastic_words_per_row(pp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of plastic words to be read from each row.

get_n_synapses_in_rows(pp_size: ndarray[tuple[Any, ...], dtype[uint32]], fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size.

Parameters:
  • pp_size

  • fp_size

Returns:

The number of synapses in each of the rows

get_n_words_for_plastic_connections(n_connections: int) int[source]
Parameters:
  • n_connections

  • n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

SDRAM size in bytes of parameter data

get_plastic_synaptic_data(connections: ConnectionsArray, connection_row_indices: NDArray[integer], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[List[NDArray[uint32]], List[NDArray[uint32]], NDArray[uint32], NDArray[uint32]][source]

Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The total number of rows

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(fp_data (2D), pp_data (2D), fp_size (1D), pp_size (1D))

get_value(key: str) Any[source]

Get a property.

Parameters:

key – the name of the property

Returns:

Value for this key

get_vertex_executable_suffix() str[source]
Returns:

An executable suffix based on timing, weights and neuromodulation

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

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

  • weights

  • synapse_info

Returns:

The variance in weight for the synapses.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property neuromodulation: SynapseDynamicsNeuromodulation | None

Synapses that target a neuromodulation receptor.

property pad_to_length: int | None

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(n_synapse_types: int, pp_size: NDArray[uint32], pp_data: List[NDArray[uint32]], fp_size: NDArray[uint32], fp_data: List[NDArray[uint32]], max_atoms_per_core: int) ConnectionsArray[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
  • n_synapse_types

  • pp_size – 1D

  • pp_data – 2D

  • fp_size – 1D

  • fp_data – 2D

  • max_atoms_per_core

Returns:

array with columns source, target, weight, delay

set_value(key: str, value: Any) None[source]

Set a property.

Parameters:
  • key – the name of the parameter to change

  • value – the new value of the parameter to assign

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

property timing_dependence: AbstractTimingDependence

timing dependence to use for the STDP rule

property weight_dependence: AbstractWeightDependence

The Weight Dependence component of the synapse dynamics.

write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStatic(weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None = 0.0, delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None = None, pad_to_length: int | None = None)

Bases: AbstractStaticSynapseDynamics, AbstractGenerateOnMachine

The dynamics of a synapse that does not change over time.

Parameters:
  • weight

  • delay – Use None to get the simulator default minimum delay.

  • pad_to_length

property changes_during_run: bool

Whether the synapses change during a run.

property gen_matrix_id: int

The ID of the on-machine matrix generator.

gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_static_words_per_row(ff_size: ndarray[tuple[Any, ...], dtype[_ScalarT]]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]
Parameters:

ff_size

Returns:

The number of bytes to be read per row for the static data given the size that was written to each row.

get_n_synapses_in_rows(ff_size: ndarray[tuple[Any, ...], dtype[_ScalarT]]) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]
Parameters:

ff_size

Returns:

The number of synapses in the rows with sizes ff_size.

get_n_words_for_static_connections(n_connections: int) int[source]
Parameters:

n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

The SDRAM usage of the synapse dynamics parameters in bytes.

get_static_synaptic_data(connections: ConnectionsArray, connection_row_indices: NDArray[integer], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[List[NDArray], NDArray][source]

Get the fixed-fixed data for each row, and lengths for the fixed-fixed parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row for the fixed-fixed region. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for the fixed-fixed region.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The number of rows to write

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(ff_data, ff_size)

get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property pad_to_length: int | None

The amount each row should pad to, or None if not specified.

read_static_synaptic_data(n_synapse_types: int, ff_size: NDArray[integer], ff_data: List[NDArray[uint32]], max_atoms_per_core: int) ConnectionsArray[source]

Read the connections from the words of data in ff_data.

Parameters:
  • n_synapse_types

  • ff_size

  • ff_data

  • max_atoms_per_core

Returns:

the connections read with dtype NUMPY_CONNECTORS_DTYPE

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralCommon

Bases: AbstractSynapseDynamicsStructural

Common code for structural synapse dynamics.

PAIR_ERROR = 'Only one Projection between each pair of Populations can use structural plasticity'
check_initial_delay(max_delay_ms: float) None[source]

Check that delays can be done without delay extensions.

Parameters:

max_delay_ms – The maximum delay supported, in milliseconds

Raises:

Exception – if the delay is out of range

Check that delays can be done without delay extensions.

Parameters:

max_delay_ms – The maximum delay supported, in milliseconds

Raises:

ValueError – if the delay is out of range

abstract property connections: ConnectionsInfo

Initial connectivity as defined via connector.

get_max_rewires_per_ts() int[source]
Returns:

The max number of rewires per timestep.

get_parameter_names() Iterable[str][source]
Returns:

The names of the parameters of the model.

get_structural_parameters_sdram_usage_in_bytes(incoming_projections: Iterable[Projection], n_neurons: int) int[source]

Get the size of the structural parameters.

Note

At the Application level this will be an estimate.

Parameters:
  • incoming_projections – The projections that target the vertex in question

  • n_neurons

Returns:

the size of the parameters, in bytes

Raises:

PacmanInvalidParameterException – If the parameters make no sense.

get_vertex_executable_suffix() str[source]
Returns:

executable suffix based on details

is_same_as(synapse_dynamics: AbstractSynapseDynamicsStructural) bool[source]
Parameters:

synapse_dynamics

Returns:

True if the two have the same data and types

property p_rew: float

The period of rewiring.

property reduction_synapses_per_second: int

Approximate fewer number of synapses that can be processed per second as a result of rewiring cycles used.

write_structural_parameters(spec: DataSpecificationBase, region: int, weight_scales: NDArray[numpy.floating], app_vertex: PopulationVertex, vertex_slice: Slice, synaptic_matrices: SynapticMatrices) None[source]

Write structural plasticity parameters.

Parameters:
  • spec – The data specification to write to

  • region – region ID

  • weight_scales – Weight scaling for each synapse type

  • app_vertex – The target application vertex

  • vertex_slice – The slice of the target vertex to generate for

  • synaptic_matrices – The synaptic matrices for this vertex

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralSTDP(partner_selection: AbstractPartnerSelection, formation: AbstractFormation, elimination: AbstractElimination, timing_dependence: AbstractTimingDependence, weight_dependence: AbstractWeightDependence, voltage_dependence: None = None, dendritic_delay_fraction: float = 1.0, f_rew: float = 10000.0, initial_weight: float = 0.0, initial_delay: InitialDelay = 1.0, s_max: int = 32, with_replacement: bool = True, seed: int | None = None, weight: _In_Types = 0.0, delay: _In_Types = None, backprop_delay: bool = True)

Bases: SynapseDynamicsSTDP, SynapseDynamicsStructuralCommon

Class that enables synaptic rewiring in the presence of STDP.

It acts as a wrapper around SynapseDynamicsSTDP, meaning rewiring can operate in parallel with STDP synapses.

Written by Petrut Bogdan.

Parameters:
  • partner_selection – The partner selection rule

  • formation – The formation rule

  • elimination – The elimination rule

  • timing_dependence – The STDP timing dependence rule

  • weight_dependence – The STDP weight dependence rule

  • voltage_dependence – The STDP voltage dependence (unsupported)

  • dendritic_delay_fraction – The STDP dendritic delay fraction

  • f_rew – How many rewiring attempts will be done per second.

  • initial_weight – Weight assigned to a newly formed connection

  • initial_delay – Delay assigned to a newly formed connection; a single value means a fixed delay value, or a tuple of two values means the delay will be chosen at random from a uniform distribution between the given values

  • s_max – Maximum fan-in per target layer neuron

  • with_replacement – If set to True (default), a new synapse can be formed in a location where a connection already exists; if False, then it must form where no connection already exists

  • seed – seed for the random number generators

  • weight – The weight of connections formed by the connector

  • delay – The delay of connections formed by the connector Use None to get the simulator default minimum delay.

  • backprop_delay – Whether back-propagated delays are used

property connections: ConnectionsInfo

Initial connectivity as defined via connector.

property elimination: AbstractElimination

The elimination rule.

property f_rew: float

The frequency of rewiring.

property formation: AbstractFormation

The formation rule.

generate_on_machine() bool[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Returns:

True if the instance should be generated on the machine.

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(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Returns:

The maximum delay for the synapses.

get_delay_minimum(connector: AbstractConnector, synapse_info: SynapseInformation) float | None[source]

Get the minimum delay for the synapses.

This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
  • connector – connector

  • synapse_info – synapse info

Returns:

The minimum delay

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

  • delays

  • synapse_info

Returns:

The variance in delay for the synapses.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_vertex_executable_suffix() str[source]
Returns:

An executable suffix based on timing, weights and neuromodulation

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

property initial_delay: float

The delay of a formed connection.

property initial_weight: float

The weight of a formed connection.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics | AbstractSynapseDynamicsStructural) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:
  • synapse_dynamics

  • synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

Returns:

True if the two have the same data and types

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) SynapseDynamicsStructuralSTDP[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property partner_selection: AbstractPartnerSelection

The partner selection rule.

property s_max: int

The maximum number of synapses.

property seed: int | None

The seed to control the randomness.

set_connections(connections: ConnectionsArray, post_vertex_slice: Slice, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]

Set connections for structural plasticity.

Parameters:
  • connections

  • post_vertex_slice

  • app_edge

  • synapse_info

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

property with_replacement: bool

Whether to allow replacement when creating synapses.

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsStructuralStatic(partner_selection: AbstractPartnerSelection, formation: AbstractFormation, elimination: AbstractElimination, f_rew: float = 10000.0, initial_weight: float = 0.0, initial_delay: InitialDelay = 1.0, s_max: int = 32, with_replacement: bool = True, seed: int | None = None, weight: float = 0.0, delay: float | None = None)

Bases: SynapseDynamicsStatic, SynapseDynamicsStructuralCommon

Class that enables synaptic rewiring in the absence of STDP.

It acts as a wrapper around SynapseDynamicsStatic, meaning that rewiring can operate in parallel with static synapses.

Written by Petrut Bogdan.

Parameters:
  • partner_selection – The partner selection rule

  • formation – The formation rule

  • elimination – The elimination rule

  • f_rew – How many rewiring attempts will be done per second.

  • initial_weight – Weight assigned to a newly formed connection

  • initial_delay – Delay assigned to a newly formed connection; a single value means a fixed delay value, or a tuple of two values means the delay will be chosen at random from a uniform distribution between the given values

  • s_max – Maximum fan-in per target layer neuron

  • with_replacement – If set to True (default), a new synapse can be formed in a location where a connection already exists; if False, then it must form where no connection already exists

  • seed – seed the random number generators

  • weight – The weight of connections formed by the connector

  • delay – The delay of connections formed by the connector Use None to get the simulator default minimum delay.

property changes_during_run: bool

Whether the synapses change during a run.

property connections: ConnectionsInfo

Initial connectivity as defined via connector.

property elimination: AbstractElimination

The elimination rule.

property f_rew: float

The frequency of rewiring.

property formation: AbstractFormation

The formation rule.

generate_on_machine() bool[source]

Determines if this instance should be generated on the machine.

Default implementation returns True

Returns:

True if the instance should be generated on the machine.

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(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Returns:

The maximum delay for the synapses.

get_delay_minimum(connector: AbstractConnector, synapse_info: SynapseInformation) float | None[source]

Get the minimum delay for the synapses.

This will support the filtering of the undelayed edge from the graph, but requires fixes in the synaptic manager to happen first before this can be utilised fully.

Parameters:
  • connector – connector

  • synapse_info – synapse info

Returns:

The minimum delay

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

  • delays

  • synapse_info

Returns:

The variance in delay for the synapses.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

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

  • weights

  • synapse_info

Returns:

The variance in weight for the synapses.

property initial_delay: InitialDelay

The delay of a formed connection.

property initial_weight: float

The weight of a formed connection.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics | AbstractSynapseDynamicsStructural) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:
  • synapse_dynamics

  • synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

Returns:

True if the two have the same data and types

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property partner_selection: AbstractPartnerSelection

The partner selection rule.

property s_max: int

The maximum number of synapses.

property seed: int | None

The seed to control the randomness.

set_connections(connections: ConnectionsArray, post_vertex_slice: Slice, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation) None[source]

Set connections for structural plasticity.

Parameters:
  • connections

  • post_vertex_slice

  • app_edge

  • synapse_info

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

property with_replacement: bool

Whether to allow replacement when creating synapses.

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsWeightChangable(weight_min: float, weight_max: float, weight: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None = 0.0, delay: float | str | RandomDistribution | Iterable[float] | ndarray[tuple[Any, ...], dtype[float64]] | None = None)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

The dynamics of a synapse that can be changed simply by the sending of an external signal.

Parameters:
  • weight

  • delay – Use None to get the simulator default minimum delay.

property changes_during_run: bool

Whether the synapses change during a run.

property gen_matrix_id: int

The ID of the on-machine matrix generator.

gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_fixed_plastic_words_per_row(fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of fixed plastic words to be read from each row.

get_n_plastic_plastic_words_per_row(pp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of plastic words to be read from each row.

get_n_synapses_in_rows(pp_size: ndarray[tuple[Any, ...], dtype[uint32]], fp_size: ndarray[tuple[Any, ...], dtype[uint32]]) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size.

Parameters:
  • pp_size

  • fp_size

Returns:

The number of synapses in each of the rows

get_n_words_for_plastic_connections(n_connections: int) int[source]
Parameters:
  • n_connections

  • n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

The SDRAM usage of the synapse dynamics parameters in bytes.

get_plastic_synaptic_data(connections: ConnectionsArray, connection_row_indices: NDArray[integer], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[List[NDArray[uint32]], List[NDArray[uint32]], NDArray[uint32], NDArray[uint32]][source]

Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The total number of rows

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(fp_data (2D), pp_data (2D), fp_size (1D), pp_size (1D))

get_synapse_info_index(synapse_info: SynapseInformation) int[source]

Get the row offset for the given synapse information.

Each synapse information has a unique row offset which then allows for multiple connections to be identified and kept separate.

Returns:

The row offset for the given synapse information.

get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

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

  • weights

  • synapse_info

Returns:

The variance in weight for the synapses.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property pad_to_length: int | None

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(n_synapse_types: int, pp_size: NDArray[uint32], pp_data: List[NDArray[uint32]], fp_size: NDArray[uint32], fp_data: List[NDArray[uint32]], max_atoms_per_core: int) ConnectionsArray[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
  • n_synapse_types

  • pp_size – 1D

  • pp_data – 2D

  • fp_size – 1D

  • fp_data – 2D

  • max_atoms_per_core

Returns:

array with columns source, target, weight, delay

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

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 weight_max: float

Get the maximum weight allowed to change to

property weight_min: float

Get the minimum weight allowed to change to

write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

class spynnaker.pyNN.models.neuron.synapse_dynamics.SynapseDynamicsWeightChanger(weight_change: float, projection: Projection)

Bases: AbstractPlasticSynapseDynamics, AbstractGenerateOnMachine

Synapses that target a weight change

Parameters:
  • weight_change – The positive or negative change in weight to apply on each spike

  • projection – The projection that this synapse dynamics is being added to

property changes_during_run: bool

Whether the synapses change during a run.

property gen_matrix_id: int

The ID of the on-machine matrix generator.

gen_matrix_params(synaptic_matrix_offset: int, delayed_matrix_offset: int, app_edge: ProjectionApplicationEdge, synapse_info: SynapseInformation, max_row_info: MaxRowInfo, max_pre_atoms_per_core: int, max_post_atoms_per_core: int) NDArray[uint32][source]
Returns:

Any parameters required by the matrix generator.

property gen_matrix_params_size_in_bytes: int

The size of the parameters of the matrix generator in bytes.

get_max_synapses(n_words: int) int[source]

Get the maximum number of synapses that can be held in the given number of words.

Parameters:

n_words – The number of words the synapses must fit in

Returns:

The maximum number of synapses

get_n_fixed_plastic_words_per_row(fp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of fixed plastic words to be read from each row.

get_n_plastic_plastic_words_per_row(pp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]
Returns:

The number of plastic words to be read from each row.

get_n_synapses_in_rows(pp_size: ndarray[tuple[Any, ...], dtype[integer]], fp_size: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]

Get the number of synapses in each of the rows with plastic sizes pp_size and fp_size.

Parameters:
  • pp_size

  • fp_size

Returns:

The number of synapses in each of the rows

get_n_words_for_plastic_connections(n_connections: int) int[source]
Parameters:

n_connections

Returns:

The number of 32-bit words for n_connections in a single row.

get_parameter_names() Iterable[str][source]
Returns:

The parameter names available from the component.

get_parameters_sdram_usage_in_bytes(n_neurons: int, n_synapse_types: int) int[source]
Parameters:
  • n_neurons

  • n_synapse_types

Returns:

The SDRAM usage of the synapse dynamics parameters in bytes.

get_plastic_synaptic_data(connections: ConnectionsArray, connection_row_indices: NDArray[integer], n_rows: int, n_synapse_types: int, max_n_synapses: int, max_atoms_per_core: int) Tuple[NDArray[uint32], NDArray[uint32], NDArray[uint32], NDArray[uint32]][source]

Get the fixed-plastic data, and plastic-plastic data for each row, and lengths for the fixed_plastic and plastic-plastic parts of each row.

Data is returned as an array made up of an array of 32-bit words for each row, for each of the fixed-plastic and plastic-plastic data regions. The row into which connection should go is given by connection_row_indices, and the total number of rows is given by n_rows.

Lengths are returned as an array made up of an integer for each row, for each of the fixed-plastic and plastic-plastic regions.

Parameters:
  • connections – The connections to get data for

  • connection_row_indices – The row into which each connection should go

  • n_rows – The total number of rows

  • n_synapse_types – The number of synapse types

  • max_n_synapses – The maximum number of synapses to generate

  • max_atoms_per_core – The maximum number of atoms on a core

Returns:

(fp_data (2D), pp_data (2D), fp_size (1D), pp_size (1D))

get_synapse_id_by_target(target: str) int | None[source]
Parameters:

target – The name of the synapse

Returns:

The index of the synapse type based on the name, or None if the name is not found.

get_value(key: str) float[source]

Get a property.

Parameters:

key – the name of the property

Returns:

Value for this key

get_vertex_executable_suffix() str[source]
Returns:

The executable suffix for a vertex for this dynamics.

get_weight_maximum(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The maximum weight for the synapses.

get_weight_mean(connector: AbstractConnector, synapse_info: SynapseInformation) float[source]
Parameters:
  • connector

  • synapse_info

Returns:

The mean weight for the synapses.

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

  • weights

  • synapse_info

Returns:

The variance in weight for the synapses.

property is_combined_core_capable: bool

Whether the synapse dynamics can run on a core combined with the neuron, or if a separate core is needed.

is_same_as(synapse_dynamics: AbstractSynapseDynamics) bool[source]

Determines if this synapse dynamics is the same as another.

Parameters:

synapse_dynamics

Returns:

True if this synapse dynamics is the same as another.

property is_split_core_capable: bool

Whether the synapse dynamics can run on a core split from the neuron, or if only a combined core is possible.

merge(synapse_dynamics: AbstractSynapseDynamics) AbstractSynapseDynamics[source]

Merge with the given synapse_dynamics and return the result, or error if merge is not possible.

Parameters:

synapse_dynamics

Returns:

A merge of this and the given synapse_dynamics

property pad_to_length: None

The amount each row should pad to, or None if not specified.

read_plastic_synaptic_data(n_synapse_types: int, pp_size: NDArray[uint32], pp_data: List[NDArray[uint32]], fp_size: NDArray[uint32], fp_data: List[NDArray[uint32]], max_atoms_per_core: int) ConnectionsArray[source]

Read the connections indicated in the connection indices from the data in pp_data and fp_data.

Parameters:
  • n_synapse_types

  • pp_size – 1D

  • pp_data – 2D

  • fp_size – 1D

  • fp_data – 2D

  • max_atoms_per_core

Returns:

array with columns source, target, weight, delay

set_value(key: str, value: float) None[source]

Set a property.

Parameters:
  • key – the name of the parameter to change

  • value – the new value of the parameter to assign

property synapses_per_second: int

Approximate number of synapses that can be processed per second; ideally as close to the truth as possible, but underestimate would be OK. Overestimation would potentially mean having to handle more spikes than is possible, so overruns would occur.

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

write_parameters(spec: DataSpecificationBase, region: int, global_weight_scale: float, synapse_weight_scales: ndarray[tuple[Any, ...], dtype[floating]]) None[source]

Write the synapse parameters to the spec.

Parameters:
  • spec – The specification to write to

  • region – region ID to write to

  • global_weight_scale – The weight scale applied globally

  • synapse_weight_scales – The total weight scale applied to each synapse including the global weight scale

spynnaker.pyNN.models.neuron.synapse_dynamics.calculate_spike_pair_additive_stdp_weight(pre_spikes: ndarray[tuple[Any, ...], dtype[integer]], post_spikes: ndarray[tuple[Any, ...], dtype[integer]], initial_weight: float, plastic_delay: int, a_plus: float, a_minus: float, tau_plus: float, tau_minus: float) float

Calculates the expected STDP weight for SpikePair Additive STDP.

Parameters:
  • pre_spikes

  • post_spikes

  • initial_weight

  • plastic_delay – parameter of the STDP model

  • a_plus – parameter of the STDP model

  • a_minus – parameter of the STDP model

  • tau_plus – parameter of the STDP model

  • tau_minus – parameter of the STDP model

Returns:

overall weight

spynnaker.pyNN.models.neuron.synapse_dynamics.calculate_spike_pair_multiplicative_stdp_weight(pre_spikes: ndarray[tuple[Any, ...], dtype[integer]], post_spikes: ndarray[tuple[Any, ...], dtype[integer]], initial_weight: float, plastic_delay: int, min_weight: float, max_weight: float, a_plus: float, a_minus: float, tau_plus: float, tau_minus: float) float

Calculates the expected STDP weight for SpikePair Multiplicative STDP.

Parameters:
  • pre_spikes – Spikes going into the model

  • post_spikes – Spikes recorded on the model

  • initial_weight – Starting weight for the model

  • plastic_delay – parameter of the STDP model

  • min_weight – parameter of the STDP model

  • max_weight – parameter of the STDP model

  • a_plus – parameter of the STDP model

  • a_minus – parameter of the STDP model

  • tau_plus – parameter of the STDP model

  • tau_minus – parameter of the STDP model

Returns:

overall weight