# spynnaker.pyNN.models.neural_projections package¶

## Module contents¶

class spynnaker.pyNN.models.neural_projections.DelayAfferentApplicationEdge(pre_vertex, delay_vertex, label=None)[source]

Bases: pacman.model.graphs.application.application_edge.ApplicationEdge, pacman.model.partitioner_interfaces.abstract_slices_connect.AbstractSlicesConnect

Parameters: pre_vertex (AbstractPopulationVertex) – delay_vertex (DelayExtensionVertex) – label (str) –
could_connect(pre_slice, post_slice)[source]

Determine if there is a chance that one of the indexes in the pre-slice could connect to at least one of the indexes in the post-slice.

Note

This method should never return a false negative, but may return a false positives

Parameters: pre_slice (Slice) – post_slice (Slice) – True if a connection could be possible bool
class spynnaker.pyNN.models.neural_projections.DelayedApplicationEdge(pre_vertex, post_vertex, synapse_information, undelayed_edge, label=None)[source]

Bases: pacman.model.graphs.application.application_edge.ApplicationEdge, pacman.model.partitioner_interfaces.abstract_slices_connect.AbstractSlicesConnect

Parameters: pre_vertex (DelayExtensionVertex) – The delay extension at the start of the edge post_vertex (AbstractPopulationVertex) – The target of the synapses synapse_information (SynapseInformation or iterable(SynapseInformation)) – The synapse information on this edge undelayed_edge (ProjectionApplicationEdge) – The edge that is used for projections without extended delays label (str) – The edge label
add_synapse_information(synapse_information)[source]
Parameters: synapse_information (SynapseInformation) –
could_connect(pre_slice, post_slice)[source]

Determine if there is a chance that one of the indexes in the pre-slice could connect to at least one of the indexes in the post-slice.

Note

This method should never return a false negative, but may return a false positives

Parameters: pre_slice (Slice) – post_slice (Slice) – True if a connection could be possible bool
get_machine_edge(pre_vertex, post_vertex)[source]

Get a specific machine edge from this edge

Parameters: pre_vertex (DelayExtensionMachineVertex) – The vertex at the start of the machine edge post_vertex (PopulationMachineVertex) – The vertex at the end of the machine edge
remember_associated_machine_edge(machine_edge)[source]

Adds the Machine Edge to the iterable returned by machine_edges

Parameters: machine_edge (MachineEdge) – A pointer to a machine_edge. This edge may not be fully initialised
synapse_information
Return type: list(SynapseInformation)
undelayed_edge

Get the edge that for projections without extended delays

Return type: ProjectionApplicationEdge
class spynnaker.pyNN.models.neural_projections.ProjectionApplicationEdge(pre_vertex, post_vertex, synapse_information, label=None)[source]

Bases: pacman.model.graphs.application.application_edge.ApplicationEdge, pacman.model.partitioner_interfaces.abstract_slices_connect.AbstractSlicesConnect, spinn_front_end_common.interface.provenance.abstract_provides_local_provenance_data.AbstractProvidesLocalProvenanceData

An edge which terminates on an AbstractPopulationVertex.

Parameters: pre_vertex (AbstractPopulationVertex) – post_vertex (AbstractPopulationVertex) – synapse_information (SynapseInformation or iterable(SynapseInformation)) – The synapse information on this edge label (str) –
add_synapse_information(synapse_information)[source]
Parameters: synapse_information (SynapseInformation) –
could_connect(pre_slice, post_slice)[source]

Determine if there is a chance that one of the indexes in the pre-slice could connect to at least one of the indexes in the post-slice.

Note

This method should never return a false negative, but may return a false positives

Parameters: pre_slice (Slice) – post_slice (Slice) – True if a connection could be possible bool
delay_edge

Settable.

Return type: DelayedApplicationEdge or None
forget_machine_edges()[source]

Clear the collection of machine edges created by this application edge.

get_local_provenance_data()[source]

Get an iterable of provenance data items.

Returns: the provenance items iterable(ProvenanceDataItem)
get_machine_edge(pre_vertex, post_vertex)[source]

Get a specific machine edge of this edge

Parameters: pre_vertex (PopulationMachineVertex) – The vertex at the start of the machine edge post_vertex (PopulationMachineVertex) – The vertex at the end of the machine edge
n_delay_stages
Return type: int
post_slices

Get the slices for the post_vertexes of the MachineEdges

While the remember machine_edges remain unchanged this will return a list with a consistent id. If the edges change a new list is created

The List will be sorted by lo_atom. No checking is done for overlaps or gaps

Returns: Ordered list of post-slices list(Slice)
pre_slices

Get the slices for the pre_vertexes of the MachineEdges

While the remember machine_edges remain unchanged this will return a list with a consistent id. If the edges change a new list is created

The List will be sorted by lo_atom. No checking is done for overlaps or gaps

Returns: Ordered list of pre-slices list(Slice)
remember_associated_machine_edge(machine_edge)[source]

Adds the Machine Edge to the iterable returned by machine_edges

Parameters: machine_edge (MachineEdge) – A pointer to a machine_edge. This edge may not be fully initialised
synapse_information
Return type: list(SynapseInformation)
class spynnaker.pyNN.models.neural_projections.SynapseInformation(connector, pre_population, post_population, prepop_is_view, postpop_is_view, rng, synapse_dynamics, synapse_type, is_virtual_machine, weights=None, delays=None)[source]

Bases: object

Contains the synapse information including the connector, synapse type and synapse dynamics

Parameters: connector (AbstractConnector) – The connector connected to the synapse pre_population (Population or PopulationView) – The population sending spikes to the synapse post_population (Population or PopulationView) – The population hosting the synapse prepop_is_view (bool) – Whether the pre_population is a view postpop_is_view (bool) – Whether the post_population is a view rng (NumpyRNG or None) – Seeded random number generator synapse_dynamics (AbstractSynapseDynamics) – The dynamic behaviour of the synapse synapse_type (AbstractSynapseType) – The type of the synapse is_virtual_machine (bool) – Whether the machine is virtual weights (float or list(float) or ndarray(float) or None) – The synaptic weights delays (float or list(float) or ndarray(float) or None) – The total synaptic delays
add_pre_run_connection_holder(pre_run_connection_holder)[source]

Add a connection holder that will be filled in before run

Parameters: pre_run_connection_holder (ConnectionHolder) – The connection holder to be added
connector

The connector connected to the synapse

Return type: AbstractConnector
delays

The total synaptic delays (if any)

Return type: float or list(float) or ndarray(float) or None
finish_connection_holders()[source]

Finish all the connection holders, and clear the list so that they are not generated again later

may_generate_on_machine()[source]

Do we describe a collection of synapses whose synaptic matrix may be generated on SpiNNaker instead of needing to be calculated in this process and uploaded? This depends on the connector, the definitions of the weights and delays, and the dynamics of the synapses.

Returns: True if the synaptic matrix may be generated on machine (or may have already been so done) bool
n_post_neurons

The number of neurons in the postpopulation

Return type: int
n_pre_neurons

The number of neurons in the prepopulation

Return type: int
post_population

The population hosting the synapse

Return type: Population or PopulationView
postpop_is_view

Whether the post_population() is a view

Return type: bool
pre_population

The population sending spikes to the synapse

Return type: Population or PopulationView
pre_run_connection_holders

The list of connection holders to be filled in before run

Return type: list(ConnectionHolder)
prepop_is_view

Whether the pre_population() is a view

Return type: bool
rng

Random number generator

Return type: NumpyRNG
synapse_dynamics

The dynamic behaviour of the synapse

Return type: AbstractSynapseDynamics
synapse_type

The type of the synapse

Return type: AbstractSynapseType
weights

The synaptic weights (if any)

Return type: float or list(float) or ndarray(float) or None