spynnaker.pyNN.connections package

Submodules

spynnaker.pyNN.connections.ethernet_command_connection module

class spynnaker.pyNN.connections.ethernet_command_connection.EthernetCommandConnection(translator, command_containers=None, local_host=None, local_port=19999)[source]

Bases: spinn_front_end_common.utilities.database.database_connection.DatabaseConnection

A connection that can send commands to a device at the start and end of a simulation

Parameters:
  • translator – A translator of multicast commands to device commands
  • command_containers – A list of instances of AbstractSendMeMulticastCommandsVertex that have commands to be sent at the start and end of simulation
  • local_host – The optional host to listen on for the start/resume message
  • local_port – The optional port to listen on for the stop/pause message
add_command_container(command_container)[source]

Add a command container.

Parameters:command_container – An instance of AbstractSendMeMulticastCommandsVertex that has commands to be sent at the start and end of simulation

spynnaker.pyNN.connections.ethernet_control_connection module

class spynnaker.pyNN.connections.ethernet_control_connection.EthernetControlConnection(translator, label, live_packet_gather_label, local_host=None, local_port=None)[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

A connection that can translate Ethernet control messages received from a Population

Parameters:
  • translator – The translator of multicast to control commands
  • local_host – The optional host to listen on
  • local_port – The optional port to listen on
add_translator(label, translator)[source]

spynnaker.pyNN.connections.spynnaker_live_spikes_connection module

class spynnaker.pyNN.connections.spynnaker_live_spikes_connection.SpynnakerLiveSpikesConnection(receive_labels=None, send_labels=None, local_host=None, local_port=19999, live_packet_gather_label='LiveSpikeReceiver')[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

A connection for receiving and sending live spikes from and to SpiNNaker

Parameters:
  • receive_labels (iterable of str) – Labels of population from which live spikes will be received.
  • send_labels (iterable of str) – Labels of population to which live spikes will be sent
  • local_host (str) – Optional specification of the local hostname or IP address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
send_spike(label, neuron_id, send_full_keys=False)[source]

Send a spike from a single neuron

Parameters:
  • label (str) – The label of the population from which the spike will originate
  • neuron_id (int) – The ID of the neuron sending a spike
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each neuron from the database, or whether to send 16-bit neuron IDs directly
send_spikes(label, neuron_ids, send_full_keys=False)[source]

Send a number of spikes

Parameters:
  • label (str) – The label of the population from which the spikes will originate
  • neuron_ids (list(int)) – array-like of neuron IDs sending spikes
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each neuron from the database, or whether to send 16-bit neuron IDs directly

spynnaker.pyNN.connections.spynnaker_poisson_control_connection module

class spynnaker.pyNN.connections.spynnaker_poisson_control_connection.SpynnakerPoissonControlConnection(poisson_labels=None, local_host=None, local_port=19999, control_label_extension='_control')[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

Parameters:
  • poisson_labels (iterable of str) – Labels of Poisson populations to be controlled
  • local_host (str) – Optional specification of the local hostname or IP address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
  • control_label_extension (str) – The extra name added to the label of each Poisson source
add_init_callback(label, init_callback)[source]

Add a callback to be called to initialise a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • init_callback (function(str, int, float, float) -> None) – A function to be called to initialise the vertex. This should take as parameters the label of the vertex, the number of neurons in the population, the run time of the simulation in milliseconds, and the simulation timestep in milliseconds
add_pause_stop_callback(label, pause_stop_callback)[source]

Add a callback for the pause and stop state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • pause_stop_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the pause or stop message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events.
Return type:

None

add_poisson_label(label)[source]
add_receive_callback(label, live_event_callback, translate_key=False)[source]

Add a callback for the reception of live events from a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • live_event_callback (function(str, int, list(int)) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, the simulation timestep when the event occurred, and an array-like of atom IDs.
  • translate_key – True if the key is to be converted to an atom ID, False if the key should stay a key
add_start_callback(label, start_callback)[source]

Add a callback for the start of the simulation

Parameters:
  • start_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
  • label (str) – the label of the function to be sent
add_start_resume_callback(label, start_resume_callback)[source]

Add a callback for the start and resume state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • start_resume_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start or resume message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events.
Return type:

None

set_rate(label, neuron_id, rate)[source]

Set the rate of a Poisson neuron within a Poisson source

Parameters:
  • label – The label of the Population to set the rates of
  • neuron_id – The neuron ID to set the rate of
  • rate – The rate to set in Hz
set_rates(label, neuron_id_rates)[source]

Set the rates of multiple Poisson neurons within a Poisson source

Parameters:
  • label – The label of the Population to set the rates of
  • neuron_id_rates – A list of tuples of (neuron ID, rate) to be set

Module contents

class spynnaker.pyNN.connections.EthernetCommandConnection(translator, command_containers=None, local_host=None, local_port=19999)[source]

Bases: spinn_front_end_common.utilities.database.database_connection.DatabaseConnection

A connection that can send commands to a device at the start and end of a simulation

Parameters:
  • translator – A translator of multicast commands to device commands
  • command_containers – A list of instances of AbstractSendMeMulticastCommandsVertex that have commands to be sent at the start and end of simulation
  • local_host – The optional host to listen on for the start/resume message
  • local_port – The optional port to listen on for the stop/pause message
add_command_container(command_container)[source]

Add a command container.

Parameters:command_container – An instance of AbstractSendMeMulticastCommandsVertex that has commands to be sent at the start and end of simulation
class spynnaker.pyNN.connections.EthernetControlConnection(translator, label, live_packet_gather_label, local_host=None, local_port=None)[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

A connection that can translate Ethernet control messages received from a Population

Parameters:
  • translator – The translator of multicast to control commands
  • local_host – The optional host to listen on
  • local_port – The optional port to listen on
add_translator(label, translator)[source]
class spynnaker.pyNN.connections.SpynnakerLiveSpikesConnection(receive_labels=None, send_labels=None, local_host=None, local_port=19999, live_packet_gather_label='LiveSpikeReceiver')[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

A connection for receiving and sending live spikes from and to SpiNNaker

Parameters:
  • receive_labels (iterable of str) – Labels of population from which live spikes will be received.
  • send_labels (iterable of str) – Labels of population to which live spikes will be sent
  • local_host (str) – Optional specification of the local hostname or IP address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
send_spike(label, neuron_id, send_full_keys=False)[source]

Send a spike from a single neuron

Parameters:
  • label (str) – The label of the population from which the spike will originate
  • neuron_id (int) – The ID of the neuron sending a spike
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each neuron from the database, or whether to send 16-bit neuron IDs directly
send_spikes(label, neuron_ids, send_full_keys=False)[source]

Send a number of spikes

Parameters:
  • label (str) – The label of the population from which the spikes will originate
  • neuron_ids (list(int)) – array-like of neuron IDs sending spikes
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each neuron from the database, or whether to send 16-bit neuron IDs directly
class spynnaker.pyNN.connections.SpynnakerPoissonControlConnection(poisson_labels=None, local_host=None, local_port=19999, control_label_extension='_control')[source]

Bases: spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection

Parameters:
  • poisson_labels (iterable of str) – Labels of Poisson populations to be controlled
  • local_host (str) – Optional specification of the local hostname or IP address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
  • control_label_extension (str) – The extra name added to the label of each Poisson source
add_init_callback(label, init_callback)[source]

Add a callback to be called to initialise a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • init_callback (function(str, int, float, float) -> None) – A function to be called to initialise the vertex. This should take as parameters the label of the vertex, the number of neurons in the population, the run time of the simulation in milliseconds, and the simulation timestep in milliseconds
add_pause_stop_callback(label, pause_stop_callback)[source]

Add a callback for the pause and stop state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • pause_stop_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the pause or stop message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events.
Return type:

None

add_poisson_label(label)[source]
add_receive_callback(label, live_event_callback, translate_key=False)[source]

Add a callback for the reception of live events from a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • live_event_callback (function(str, int, list(int)) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, the simulation timestep when the event occurred, and an array-like of atom IDs.
  • translate_key – True if the key is to be converted to an atom ID, False if the key should stay a key
add_start_callback(label, start_callback)[source]

Add a callback for the start of the simulation

Parameters:
  • start_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
  • label (str) – the label of the function to be sent
add_start_resume_callback(label, start_resume_callback)[source]

Add a callback for the start and resume state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • start_resume_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start or resume message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events.
Return type:

None

set_rate(label, neuron_id, rate)[source]

Set the rate of a Poisson neuron within a Poisson source

Parameters:
  • label – The label of the Population to set the rates of
  • neuron_id – The neuron ID to set the rate of
  • rate – The rate to set in Hz
set_rates(label, neuron_id_rates)[source]

Set the rates of multiple Poisson neurons within a Poisson source

Parameters:
  • label – The label of the Population to set the rates of
  • neuron_id_rates – A list of tuples of (neuron ID, rate) to be set