spynnaker.pyNN.external_devices package¶
Module contents¶
This contains functions and classes for handling external devices such as the PushBot (https://spinnakermanchester.github.io/docs/push_bot/).
Note
When using external devices, it is normally important to configure your SpiNNaker system to run in real-time mode, which usually reduces numerical accuracy to gain performance.
- class spynnaker.pyNN.external_devices.ArbitraryFPGADevice(n_neurons: int, fpga_link_id: int, fpga_id: int, board_address: str | None = None, chip_coords: Tuple[int, int] | None = None, label: str | None = None)
Bases:
ApplicationFPGAVertex,PopulationApplicationVertexA device connected to SpiNNaker via one of the on-board FPGAs.
- class spynnaker.pyNN.external_devices.EIEIOType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumPossible types of EIEIO packets.
- KEY_16_BIT = 0
- KEY_32_BIT = 2
- KEY_PAYLOAD_16_BIT = 1
- KEY_PAYLOAD_32_BIT = 3
- property encoded_value: int
The encoded value representing the type.
- property max_value: int
The maximum value of the key or payload (if there is a payload).
- Return type:
- class spynnaker.pyNN.external_devices.ExternalCochleaDevice(n_neurons: int, spinnaker_link: int, label: str | None = None, board_address: str | None = None)
Bases:
ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexAn ear vertex.
- class spynnaker.pyNN.external_devices.ExternalDeviceLifControl(**kwargs)
Bases:
AbstractPyNNNeuronModelStandardAbstract control module for the PushBot, based on the LIF neuron, but without spikes, and using the voltage as the output to the various devices.
- Parameters:
model_name (str) – Name of the model.
binary (str) – Name of the implementation executable.
neuron_model (NeuronModel) – The model of the neuron body
input_type (AbstractInputType) – The model of synaptic input types
synapse_type (AbstractSynapseType) – The model of the synapses’ dynamics
threshold_type (AbstractThresholdType) – The model of the firing threshold
additional_input_type (AbstractAdditionalInput or None) – The model (if any) of additional environmental inputs
- create_vertex(n_neurons: int, label: str, *, spikes_per_second: float | None = None, ring_buffer_sigma: float | None = None, max_expected_summed_weight: List[float] | None = None, incoming_spike_buffer_size: int | None = None, drop_late_spikes: bool | None = None, splitter: SplitterAbstractPopulationVertex | None = None, seed: int | None = None, n_colour_bits: int | None = None, n_steps_per_timestep: int = 1) AbstractPopulationVertex[source]
Create a vertex for a population of the model.
- Parameters:
n_neurons (int) – The number of neurons in the population
label (str) – The label to give to the vertex
spikes_per_second (float)
ring_buffer_sigma (float)
incoming_spike_buffer_size (int)
drop_late_spikes (bool)
splitter (SplitterAbstractPopulationVertex or None)
seed (int)
n_colour_bits (int)
n_steps_per_timestep (int)
- Returns:
An application vertex for the population
- Return type:
- class spynnaker.pyNN.external_devices.ExternalFPGARetinaDevice(mode: str, retina_key: int, spinnaker_link_id: int, polarity: str, label: str | None = None, board_address: str | None = None)
Bases:
ApplicationSpiNNakerLinkVertex,PopulationApplicationVertex,AbstractSendMeMulticastCommandsVertexA retina connected by FPGA
- Parameters:
- DOWN_POLARITY = 'DOWN'
- MERGED_POLARITY = 'MERGED'
- MODE_128 = '128'
- MODE_16 = '16'
- MODE_32 = '32'
- MODE_64 = '64'
- UP_POLARITY = 'UP'
- get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()for the conditions.- Parameters:
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.ICUBRetinaDevice(base_key: int = 0, width: int = 304, height: int = 240, sub_width: int = 16, sub_height: int = 16, spinnaker_link_id: int = 0, board_address: str | None = None)
Bases:
Application2DSpiNNakerLinkVertexAn ICUB retina device connected to SpiNNaker using a SpiNNakerLink.
- Parameters:
base_key (int) – The key that is common over the whole vertex
width (int) – The width of the retina in pixels
height (int) – The height of the retina in pixels
sub_width (int) – The width of rectangles to split the retina into for efficiency of sending
sub_height (int) – The height of rectangles to split the retina into for efficiency of sending
spinnaker_link_id (int) – The ID of the SpiNNaker link that the device is connected to
board_address (str or None) – The board to which the device is connected, or None for the first board
- get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()for the conditions.- Parameters:
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).
If this doesn’t return None,
get_fixed_key_and_mask()must also not return None, and the keys returned here must align with those such that for eachkey:maskreturned here,key & app_mask == app_key. It is OK for this to return None andget_fixed_key_and_mask()to return non-None if and only if there is only one machine vertex.- Parameters:
machine_vertex (MachineVertex) – A source machine vertex of this application vertex
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- class spynnaker.pyNN.external_devices.MunichIoSpiNNakerLinkProtocol(mode: MUNICH_MODES, instance_key: int | None = None, uart_id: int = 0)
Bases:
objectProvides Multicast commands for the Munich SpiNNaker-Link protocol.
- Parameters:
mode (MUNICH_MODES) – The mode of operation of the protocol
instance_key (int or None) – The optional instance key to use
uart_id (int) – The ID of the UART when needed
- add_payload_logic_to_current_output(payload: int, time: int | None = None) MultiCastCommand[source]
Get command to add payload logic to current output.
- bias_values(bias_id: int, bias_value: int, time: int | None = None) MultiCastCommand[source]
Get command to bias level.
- configure_master_key(new_key: int, time: int | None = None)[source]
Get command to configure master key.
- disable_retina(time: int | None = None) MultiCastCommand[source]
Get command to disable the retina.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- property enable_disable_motor_key: int
Get key to disable motor.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- generic_motor0_raw_output_leak_to_0(pwm_signal: int, time: int | None = None) MultiCastCommand[source]
Get command to set generic motor 0 raw output leak to 0.
- generic_motor0_raw_output_permanent(pwm_signal: int, time: int | None = None) MultiCastCommand[source]
Get command to set generic motor 0 raw output permanently.
- generic_motor1_raw_output_leak_to_0(pwm_signal: int, time: int | None = None) MultiCastCommand[source]
Get command to set generic motor 1 raw output leak to 0.
- generic_motor1_raw_output_permanent(pwm_signal: int, time: int | None = None) MultiCastCommand[source]
Get command to set generic motor 1 raw output permanently.
- generic_motor_disable(time: int | None = None) MultiCastCommand[source]
Get command to disable motor.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- generic_motor_enable(time: int | None = None) MultiCastCommand[source]
Get command to enable motor.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- generic_motor_total_period(time_in_ms: int, time: int | None = None) MultiCastCommand[source]
Get command to set motor total period.
- master_slave_set_master_clock_active(time: int | None = None) MultiCastCommand[source]
Get command to set master clock active.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- master_slave_set_master_clock_not_started(time: int | None = None) MultiCastCommand[source]
Get command to set master clock active.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- master_slave_set_slave(time: int | None = None) MultiCastCommand[source]
Get command to set slave.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- master_slave_use_internal_counter(time: int | None = None) MultiCastCommand[source]
Get command to set internal counter used.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- property mode: MUNICH_MODES
- Return type:
- poll_individual_sensor_continuously(sensor_id: int, time_in_ms: int, time: int | None = None) MultiCastCommand[source]
Get command to sensor continuously.
- poll_sensors_once(sensor_id: int, time: int | None = None) MultiCastCommand[source]
Get command to sensor once.
- push_bot_laser_config_active_time(active_time: int, time: int | None = None) MultiCastCommand[source]
Get command to set the laser active time.
- property push_bot_laser_config_active_time_key: int
Gets the key to set the laser active time.
- Return type:
- push_bot_laser_config_total_period(total_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set the laser total period.
- Parameters:
period (int total)
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command
- Return type:
MultiCastCommand
- Raises:
ConfigurationException – If the mode is not PUSH_BOT
- property push_bot_laser_config_total_period_key: int
Gets the key to set the laser total period.
- Return type:
- push_bot_laser_set_frequency(frequency: int, time: int | None = None) MultiCastCommand[source]
Get command to set the frequency
- push_bot_led_back_active_time(active_time: int, time: int | None = None) MultiCastCommand[source]
Get command to set the back led active time.
- property push_bot_led_back_active_time_key: int
Gets the key to set the back led active time.
- Return type:
- push_bot_led_front_active_time(active_time: int, time: int | None = None) MultiCastCommand[source]
Get command to set the front led active time.
- property push_bot_led_front_active_time_key: int
Gets the key to set the front led active time.
- Return type:
- push_bot_led_set_frequency(frequency: int, time: int | None = None) MultiCastCommand[source]
Get command to set the led frequency
- property push_bot_led_set_frequency_key: int
Gets the key to set the led frequency.
- Return type:
- push_bot_led_total_period(total_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set the total led period.
- property push_bot_led_total_period_key: int
Gets the key to set the total led period.
- Return type:
- push_bot_motor_0_leaking_towards_zero(velocity: int, time: int | None = None) MultiCastCommand[source]
Get command to change motor 0 towards zero.
- property push_bot_motor_0_leaking_towards_zero_key: int
Gets the key for the change motor 0 towards zero.
- Return type:
- push_bot_motor_0_permanent(velocity: int, time: int | None = None) MultiCastCommand[source]
Get command to change motor 0 permanently.
- property push_bot_motor_0_permanent_key: int
Gets the key for the change motor 0 permanently.
- Return type:
- push_bot_motor_1_leaking_towards_zero(velocity: int, time: int | None = None) MultiCastCommand[source]
Get command to change motor 1 towards zero.
- property push_bot_motor_1_leaking_towards_zero_key: int
Gets the key for the change motor 1 towards zero.
- Return type:
- push_bot_motor_1_permanent(velocity: int, time: int | None = None) MultiCastCommand[source]
Get command to change motor 1 permanently.
- property push_bot_motor_1_permanent_key: int
Gets the key for the change motor 1 permanently.
- Return type:
- push_bot_speaker_config_active_time(active_time: int, time: int | None = None) MultiCastCommand[source]
Get command to set the speaker active time.
- property push_bot_speaker_config_active_time_key: int
Gets the key to set the speaker active time.
- Return type:
- push_bot_speaker_config_total_period(total_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set the speaker total period.
- property push_bot_speaker_config_total_period_key: int
Gets the key to set the speaker total period.
- Return type:
- push_bot_speaker_set_melody(melody: int, time: int | None = None) MultiCastCommand[source]
Get command to set the melody.
- push_bot_speaker_set_tone(frequency: int, time: int | None = None) MultiCastCommand[source]
Get command to set the tone.
- pwm_pin_output_timer_a_channel_0_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set a channel 0 output timer.
- pwm_pin_output_timer_a_channel_1_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set a channel 1 output timer.
- pwm_pin_output_timer_a_duration(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set a output timer duration.
- pwm_pin_output_timer_b_channel_0_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set b channel 0 output timer.
- pwm_pin_output_timer_b_channel_1_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set b channel 1 output timer.
- pwm_pin_output_timer_b_duration(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set b output timer duration.
- pwm_pin_output_timer_c_channel_0_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set c channel 0 output timer.
- pwm_pin_output_timer_c_channel_1_ratio(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set c channel 1 output timer.
- pwm_pin_output_timer_c_duration(timer_period: int, time: int | None = None) MultiCastCommand[source]
Get command to set c output timer duration.
- query_state_of_io_lines(time: int | None = None) MultiCastCommand[source]
Get command to query state of io lines.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- remove_payload_logic_to_current_output(payload: int, time: int | None = None) MultiCastCommand[source]
Get command to remove payload logic to current output.
- reset_retina(time: int | None = None) MultiCastCommand[source]
Get command to reset retina.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- static sent_mode_command() bool[source]
True if the mode command has ever been requested by any instance.
- set_mode(time: int | None = None) MultiCastCommand[source]
Gets the set mode. And records it was provided.
- Parameters:
time (int or None) – The time within the simulation at which to send the command, or
Noneif this is not a timed command- Return type:
MultiCastCommand
- set_output_pattern_for_payload(payload: int, time: int | None = None) MultiCastCommand[source]
Get command to set output pattern for payload.
- set_payload_pins_to_high_impedance(payload: int, time: int | None = None) MultiCastCommand[source]
Get command to set the payload pins to high impedance.
- set_retina_key(new_key: int, time: int | None = None) MultiCastCommand[source]
Get command to set retina key.
- set_retina_transmission(retina_key: RetinaKey = RetinaKey.NATIVE_128_X_128, retina_payload: RetinaPayload | None = None, time: int | None = None) MultiCastCommand[source]
Set the retina transmission key.
- Parameters:
retina_key (RetinaKey) – the new key for the retina
retina_payload (RetinaPayload or None) – the new payload for the set retina key command packet
- Returns:
the command to send
- Return type:
- property set_retina_transmission_key: int
Get the key to set the retina_transmission.
- Return type:
- class spynnaker.pyNN.external_devices.MunichMotorDevice(spinnaker_link_id, board_address=None, speed=30, sample_time=4096, update_time=512, delay_time=5, delta_threshold=23, continue_if_not_different=True, label=None)
Bases:
AbstractOneAppOneMachineVertex,AbstractVertexWithEdgeToDependentVertices,PopulationApplicationVertexAn Omnibot motor control device. This has a real vertex and an external device vertex.
- Parameters:
- default_initial_values = {}
- default_parameters = {'board_address': None, 'continue_if_not_different': True, 'delay_time': 5, 'delta_threshold': 23, 'label': None, 'sample_time': 4096, 'speed': 30, 'update_time': 512}
- dependent_vertices() Iterable[ApplicationVertex][source]
Return the vertices which this vertex depends upon.
- Return type:
iterable(ApplicationVertex)
- edge_partition_identifiers_for_dependent_vertex(vertex: ApplicationVertex) Iterable[str][source]
Return the dependent edge identifiers for a particular dependent vertex.
- Parameters:
vertex (ApplicationVertex)
- Return type:
iterable(str)
- class spynnaker.pyNN.external_devices.MunichRetinaDevice(retina_key, spinnaker_link_id, position, label='MunichRetinaDevice', polarity=None, board_address=None)
Bases:
ApplicationSpiNNakerLinkVertex,PopulationApplicationVertex,AbstractSendMeMulticastCommandsVertexAn Omnibot silicon retina device.
- Parameters:
- DOWN_POLARITY = 'DOWN'
- LEFT_RETINA = 'LEFT'
- MERGED_POLARITY = 'MERGED'
- RIGHT_RETINA = 'RIGHT'
- UP_POLARITY = 'UP'
- default_parameters = {'board_address': None, 'label': 'MunichRetinaDevice', 'polarity': None}
- get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()for the conditions.- Parameters:
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetLEDDevice(led, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time_front=None, start_active_time_back=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice,AbstractSendMeMulticastCommandsVertexThe LED of a PushBot.
- Parameters:
led (PushBotLED) – The LED to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol instance to get commands from
start_active_time_front (int) – The “active time” to set for the front LED at the start
start_active_time_back (int) – The “active time” to set for the back LED at the start
start_total_period (int) – The “total period” to set at the start
start_frequency (int) – The “frequency” to set at the start
timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol)[source]
Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.
- Parameters:
command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetLaserDevice(laser, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice,AbstractSendMeMulticastCommandsVertexThe Laser of a PushBot.
- Parameters:
laser (PushBotLaser) – The PushBotLaser value to control
protocol (MunichIoEthernetProtocol) – The protocol instance to get commands from
start_active_time (int) – The “active time” value to send at the start
start_total_period (int) – The “total period” value to send at the start
start_frequency (int) – The “frequency” to send at the start
timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol)[source]
Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.
- Parameters:
command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetMotorDevice(motor, protocol: MunichIoSpiNNakerLinkProtocol, timesteps_between_send=None)
Bases:
PushBotEthernetDevice,AbstractSendMeMulticastCommandsVertexThe motor of a PushBot.
- Parameters:
motor (PushBotMotor) – indicates which motor to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol used to control the device
timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol)[source]
Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.
- Parameters:
command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetRetinaDevice(protocol, resolution, pushbot_ip_address, pushbot_port=56000, injector_port=None, local_host=None, local_port=None, retina_injector_label='PushBotRetinaInjector')
Bases:
AbstractPushBotRetinaDevice,AbstractEthernetSensorA PushBot retina over Ethernet
- Parameters:
protocol (MunichIoEthernetProtocol)
resolution (PushBotRetinaResolution)
pushbot_ip_address (str)
pushbot_port (int)
injector_port (int)
local_host (str)
local_port (int)
retina_injector_label (str)
- get_database_connection() PushBotRetinaConnection[source]
Get a Database Connection instance that this device uses to inject packets.
- Return type:
- Return type:
- get_injector_parameters() Dict[str, Any][source]
Get the parameters of the Spike Injector to use with this device.
- get_n_neurons() int[source]
Get the number of neurons that will be sent out by the device.
- Return type:
- get_translator() PushBotTranslator[source]
Get a translator of multicast commands to Ethernet commands.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetSpeakerDevice(speaker, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time=0, start_total_period=0, start_frequency=0, start_melody=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice,AbstractSendMeMulticastCommandsVertexThe Speaker of a PushBot.
- Parameters:
speaker (PushBotSpeaker) – The speaker to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol instance to get commands from
start_active_time (int) – The “active time” to set at the start
start_total_period (int) – The “total period” to set at the start
start_frequency (int) – The “frequency” to set at the start
start_melody (int) – The “melody” to set at the start
timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol)[source]
Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.
- Parameters:
command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotLED(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
AbstractPushBotOutputDeviceThe properties of the LED device that may be set.
- LED_BACK_ACTIVE_TIME = 2
- LED_FREQUENCY = 3
- LED_FRONT_ACTIVE_TIME = 1
- LED_TOTAL_PERIOD = 0
- class spynnaker.pyNN.external_devices.PushBotLaser(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
AbstractPushBotOutputDeviceThe properties of the laser device that may be set.
- LASER_ACTIVE_TIME = 1
- LASER_FREQUENCY = 2
- LASER_TOTAL_PERIOD = 0
- class spynnaker.pyNN.external_devices.PushBotLifEthernet(**kwargs)
Bases:
ExternalDeviceLifControlLeaky integrate and fire neuron with an exponentially decaying current input.
- Parameters:
protocol (MunichIoEthernetProtocol) – How to talk to the bot.
devices (iterable(AbstractMulticastControllableDevice)) – The devices on the bot that we are interested in.
pushbot_ip_address (str) – Where is the pushbot?
pushbot_port (int) – (defaulted)
tau_m (float) – LIF neuron parameter (defaulted)
cm (float) – LIF neuron parameter (defaulted)
v_rest (float) – LIF neuron parameter (defaulted)
v_reset (float) – LIF neuron parameter (defaulted)
tau_syn_E (float) – LIF neuron parameter (defaulted)
tau_syn_I (float) – LIF neuron parameter (defaulted)
tau_refrac (float) – LIF neuron parameter (defaulted)
i_offset (float) – LIF neuron parameter (defaulted)
v (float) – LIF neuron parameter (defaulted)
isyn_exc (float) – LIF neuron parameter (defaulted)
isyn_inh (float) – LIF neuron parameter (defaulted)
model_name (str) – Name of the model.
binary (str) – Name of the implementation executable.
neuron_model (NeuronModel) – The model of the neuron body
input_type (AbstractInputType) – The model of synaptic input types
synapse_type (AbstractSynapseType) – The model of the synapses’ dynamics
threshold_type (AbstractThresholdType) – The model of the firing threshold
additional_input_type (AbstractAdditionalInput or None) – The model (if any) of additional environmental inputs
- class spynnaker.pyNN.external_devices.PushBotLifSpinnakerLink(**kwargs)
Bases:
ExternalDeviceLifControlControl module for a PushBot connected to a SpiNNaker Link.
- Parameters:
protocol (MunichIoSpiNNakerLinkProtocol) – How to talk to the bot.
devices (iterable(AbstractMulticastControllableDevice)) – The devices on the bot that we are interested in.
tau_m (float) – LIF neuron parameter (defaulted)
cm (float) – LIF neuron parameter (defaulted)
v_rest (float) – LIF neuron parameter (defaulted)
v_reset (float) – LIF neuron parameter (defaulted)
tau_syn_E (float) – LIF neuron parameter (defaulted)
tau_syn_I (float) – LIF neuron parameter (defaulted)
tau_refrac (float) – LIF neuron parameter (defaulted)
i_offset (float) – LIF neuron parameter (defaulted)
v (float) – LIF neuron parameter (defaulted)
isyn_exc (float) – LIF neuron parameter (defaulted)
isyn_inh (float) – LIF neuron parameter (defaulted)
model_name (str) – Name of the model.
binary (str) – Name of the implementation executable.
neuron_model (NeuronModel) – The model of the neuron body
input_type (AbstractInputType) – The model of synaptic input types
synapse_type (AbstractSynapseType) – The model of the synapses’ dynamics
threshold_type (AbstractThresholdType) – The model of the firing threshold
additional_input_type (AbstractAdditionalInput or None) – The model (if any) of additional environmental inputs
- class spynnaker.pyNN.external_devices.PushBotMotor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
AbstractPushBotOutputDeviceThe properties of the motor devices that may be set. The pushbot has two motors, 0 (left) and 1 (right).
- MOTOR_0_LEAKY = 1
- MOTOR_0_PERMANENT = 0
- MOTOR_1_LEAKY = 3
- MOTOR_1_PERMANENT = 2
- class spynnaker.pyNN.external_devices.PushBotRetinaResolution(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumResolutions supported by the pushbot retina device.
- DOWNSAMPLE_16_X_16 = RetinaKey.DOWNSAMPLE_16_X_16
- DOWNSAMPLE_32_X_32 = RetinaKey.DOWNSAMPLE_32_X_32
- DOWNSAMPLE_64_X_64 = RetinaKey.DOWNSAMPLE_64_X_64
- NATIVE_128_X_128 = RetinaKey.NATIVE_128_X_128
- class spynnaker.pyNN.external_devices.PushBotRetinaViewer(retina_resolution, label, sim)
Bases:
objectViewer of retina from the PushBot.
- property port
The port the connection is listening on.
- Return type:
- run(run_time)[source]
Run the viewer and simulation for a fixed time.
- run_until_closed()[source]
Run the viewer and simulation until the viewer is closed.
- class spynnaker.pyNN.external_devices.PushBotSpeaker(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
AbstractPushBotOutputDeviceThe properties of the speaker device that may be set.
- SPEAKER_ACTIVE_TIME = 1
- SPEAKER_MELODY = 3
- SPEAKER_TONE = 2
- SPEAKER_TOTAL_PERIOD = 0
- class spynnaker.pyNN.external_devices.PushBotSpiNNakerLinkLEDDevice(led, protocol, spinnaker_link_id, n_neurons=1, label=None, board_address=None, start_active_time_front=None, start_active_time_back=None, start_total_period=None, start_frequency=None)
Bases:
PushBotEthernetLEDDevice,ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexThe LED of a PushBot
- Parameters:
led (PushBotLED) – The LED device to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol instance to get commands from
spinnaker_link_id (int) – The SpiNNakerLink connected to
n_neurons (int) – The number of neurons in the device
label (str) – The label of the device
board_address (str or None) – The IP address of the board that the device is connected to
start_active_time_front (int or None) – The “active time” to set for the front LED at the start
start_active_time_back (int or None) – The “active time” to set for the back LED at the start
start_total_period (int or None) – The “total period” to set at the start
start_frequency (int or None) – The “frequency” to set at the start
- default_parameters = {'board_address': None, 'label': None, 'n_neurons': 1, 'start_active_time_back': None, 'start_active_time_front': None, 'start_frequency': None, 'start_total_period': None}
- class spynnaker.pyNN.external_devices.PushBotSpiNNakerLinkLaserDevice(laser, protocol, spinnaker_link_id, n_neurons=1, label=None, board_address=None, start_active_time=0, start_total_period=0, start_frequency=0)
Bases:
PushBotEthernetLaserDevice,ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexThe Laser of a PushBot.
- Parameters:
laser (PushBotLaser) – Which laser device to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol instance to get commands from
spinnaker_link_id (int) – The SpiNNakerLink that the PushBot is connected to
n_neurons (int) – The number of neurons in the device
label (str) – A label for the device
board_address (str or None) – The IP address of the board that the device is connected to
start_active_time (int) – The “active time” value to send at the start
start_total_period (int) – The “total period” value to send at the start
start_frequency (int) – The “frequency” to send at the start
- default_parameters = {'board_address': None, 'label': None, 'n_neurons': 1, 'start_active_time': 0, 'start_frequency': 0, 'start_total_period': 0}
- class spynnaker.pyNN.external_devices.PushBotSpiNNakerLinkMotorDevice(motor, protocol, spinnaker_link_id, n_neurons=1, label=None, board_address=None)
Bases:
PushBotEthernetMotorDevice,ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexThe motor of a PushBot.
- Parameters:
motor (PushBotMotor) – the motor to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol used to control the device
spinnaker_link_id (int) – The SpiNNakerLink connected to
n_neurons (int) – The number of neurons in the device
label (str) – The label of the device
board_address (str or None) – The IP address of the board that the device is connected to
- default_parameters = {'board_address': None, 'label': None, 'n_neurons': 1}
- class spynnaker.pyNN.external_devices.PushBotSpiNNakerLinkRetinaDevice(spinnaker_link_id, protocol, resolution, board_address=None, label=None, n_machine_vertices=1)
Bases:
AbstractPushBotRetinaDevice,ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexImplementation of a PushBot Retina vertex over a Spinnaker link
- Parameters:
spinnaker_link_id (int)
protocol (MunichIoSpiNNakerLinkProtocol)
resolution (PushBotRetinaResolution)
board_address (str)
label (str)
n_machine_vertices (int)
- default_parameters = {'board_address': None, 'label': None, 'n_machine_vertices': 1}
- new_key_command_payload()[source]
Support method to obtain the key after the key allocator has run
- Parameters:
routing_info
- Returns:
the key
- Return type:
- property start_resume_commands: List[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- class spynnaker.pyNN.external_devices.PushBotSpiNNakerLinkSpeakerDevice(speaker, protocol, spinnaker_link_id, n_neurons=1, label=None, board_address=None, start_active_time=50, start_total_period=100, start_frequency=None, start_melody=None)
Bases:
PushBotEthernetSpeakerDevice,ApplicationSpiNNakerLinkVertex,PopulationApplicationVertexThe speaker of a PushBot.
- Parameters:
speaker (PushBotSpeaker) – Which speaker device to control
protocol (MunichIoSpiNNakerLinkProtocol) – The protocol instance to get commands from
spinnaker_link_id (int) – The SpiNNakerLink connected to
n_neurons (int) – The number of neurons in the device
label (str) – The label of the device
board_address (str or None) – The IP address of the board that the device is connected to
start_active_time (int) – The “active time” to set at the start
start_total_period (int) – The “total period” to set at the start
start_frequency (int) – The “frequency” to set at the start
start_melody (int) – The “melody” to set at the start
- default_parameters = {'board_address': None, 'label': None, 'n_neurons': 1, 'start_active_time': 50, 'start_frequency': None, 'start_melody': None, 'start_total_period': 100}
- class spynnaker.pyNN.external_devices.SPIFInputDevice(pipe, n_neurons, n_neurons_per_partition, base_key=None, board_address=None, chip_coords=None)
Bases:
ApplicationFPGAVertex,PopulationApplicationVertex,AbstractSendMeMulticastCommandsVertexA 1D input device connected to SpiNNaker using a SPIF board.
- Parameters:
pipe (int) – Which pipe on SPIF the retina is connected to
n_neurons (int) – The number of neurons in the device
height (int) – The height of the retina in pixels
sub_width (int) – The width of rectangles to split the retina into for efficiency of sending
sub_height (int) – The height of rectangles to split the retina into for efficiency of sending
base_key (int or None) – The key that is common over the whole vertex, or None to use the pipe number as the key
input_x_shift (int) – The shift to get the x coordinate from the input keys sent to SPIF
input_y_shift (int) – The shift to get the y coordinate from the input keys sent to SPIF
board_address (str or None) – The IP address of the board to which the FPGA is connected, or None to use the default board or chip_coords. Note chip_coords will be used first if both are specified, with board_address then being used if the coordinates don’t connect to an FPGA.
chip_coords (tuple(int, int) or None) – The coordinates of the chip to which the FPGA is connected, or None to use the default board or board_address. Note chip_coords will be used first if board_address is also specified, with board_address then being used if the coordinates don’t connect to an FPGA.
- INPUT_MASK = 7
- get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]
Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.
- Parameters:
pre_vertex (MachineVertex) – The machine vertex to get the map for
partition_id (str) – The partition to get the map for
routing_info (RoutingInfo) – Routing information
- Returns:
A list of (atom_id, key)
- Return type:
- get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()for the conditions.- Parameters:
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- get_incoming_slice_for_link(link: FPGAConnection, index: int) Slice[source]
Get the slice to be given to the connection from the given link.
- Parameters:
link (FPGAConnection) – The FPGA connection to get the slice for
index (int) – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1
- Return type:
- get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).
If this doesn’t return None,
get_fixed_key_and_mask()must also not return None, and the keys returned here must align with those such that for eachkey:maskreturned here,key & app_mask == app_key. It is OK for this to return None andget_fixed_key_and_mask()to return non-None if and only if there is only one machine vertex.- Parameters:
machine_vertex (MachineVertex) – A source machine vertex of this application vertex
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.SPIFLiveSpikesConnection(receive_labels: Iterable[str] | None, spif_host: str, spif_port: int = 3332, events_per_packet: int = 32, time_per_packet: int = 500, local_host: str | None = None, local_port: int | None = None)
Bases:
DatabaseConnectionA connection for receiving live spikes from SPIF.
- Parameters:
receive_labels (iterable(str)) – Labels of vertices from which live events will be received.
spif_host (str) – The location of the SPIF board receiving packets
spif_port (int) – The port of the SPIF board (default 3332)
events_per_packet (int) – The maximum number of events in each packet. SPIF will be configured to send a packet as soon as it reaches this size if not before (default is 32)
time_per_packet (int) – The maximum time between sending non-empty packets. SPIF will be configured to send a packet that isn’t empty after this many microseconds (default is 500)
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)
- add_init_callback(label: str, init_callback: Callable[[str, int, float, float], None])[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 (callable(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: str, pause_stop_callback: Callable[[str, SPIFLiveSpikesConnection], None])[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 (callable(str, LiveEventConnection) -> 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.
- add_receive_callback(label: str, live_event_callback: Callable[[str, List[int]], None], translate_key: bool = True)[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 (callable(str, list(int)) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, and an array-like of atom IDs.
translate_key (bool) – True if the key is to be converted to an atom ID, False if the key should stay a key
- add_start_resume_callback(label: str, start_resume_callback: Callable[[str, SPIFLiveSpikesConnection], None])[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 (callable(str, LiveEventConnection) -> 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.
- class spynnaker.pyNN.external_devices.SPIFOutputDevice(board_address=None, chip_coords=None, label=None, create_database=True, database_notify_host=None, database_notify_port_num=None, database_ack_port_num=None, output_key_shift=24)
Bases:
ApplicationFPGAVertex,PopulationApplicationVertex,AbstractSendMeMulticastCommandsVertex,LiveOutputDeviceOutput (only) to a SPIF device. Each SPIF device can accept up to 6 incoming projections. Keys sent from Populations to SPIF will be mapped by removing the SpiNNaker key and adding an index so that the source Population can be identified. Source Populations must be split into power-of-two sized cores to ensure that keys are contiguous. The keys output by SPIF will be of the form:
(projection_index << output_key_shift) | neuron_id
By default, the projection index will be in the top 8 bits of the packet, but this can be controlled with the output_key_shift parameter.
- Parameters:
board_address (int or None) – The board IP address of the SPIF device
chip_coords (tuple(int, int) or None) – The chip coordinates of the SPIF device
label (int or None) – The label to give the SPIF device
create_database (bool) – Whether the database will be used to decode keys or not
database_notify_host (str or None) – The host that will read the database
database_notify_port_num (int or None) – The port of the host that will read the database
database_ack_port_num (int or None) – The port to listen on for responses from the host reading the database
proj_index_shift (int) – The shift to apply to the population indices when added to the key
- add_incoming_edge(edge: ApplicationEdge, partition: ApplicationEdgePartition)[source]
Add an edge incoming to this vertex. This is ignored by default, but could be used to track incoming edges, and/or report faults.
- Parameters:
edge (ApplicationEdge) – The edge to add.
partition (ApplicationEdgePartition) – The partition to add the edge to.
- get_device_output_keys() Dict[MachineVertex, List[Tuple[int, int]]][source]
Get the atom key mapping to be output for each machine vertex received by the device to be output. Note that the device may change the keys as they pass through it, and this needs to be recognised here.
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_output_key_and_mask(population, key, mask)[source]
- Set the output key to be written into packets when received by
SPIF, and the mask to apply before adding the key. The key should be the exact value that will be “or’ed” with the packet after masking. The mask should be the mask to apply to the incoming SpiNNaker key to extract the neuron id bits. The key and mask will not be checked; please make sure you are using values that make sense!
- Parameters:
population (Population) – The PyNN source Population
key (int) – The key to “or” with the incoming key after masking
mask (int) – The mask to “and” with the incoming SpiNNaker key
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.SPIFRetinaDevice(pipe, width, height, sub_width, sub_height, base_key=None, input_x_shift=16, input_y_shift=0, board_address=None, chip_coords=None)
Bases:
Application2DFPGAVertex,PopulationApplicationVertex,AbstractSendMeMulticastCommandsVertexA retina device connected to SpiNNaker using a SPIF board.
- Parameters:
pipe (int) – Which pipe on SPIF the retina is connected to
width (int) – The width of the retina in pixels
height (int) – The height of the retina in pixels
sub_width (int) – The width of rectangles to split the retina into for efficiency of sending
sub_height (int) – The height of rectangles to split the retina into for efficiency of sending
base_key (int or None) – The key that is common over the whole vertex, or None to use the pipe number as the key
input_x_shift (int) – The shift to get the x coordinate from the input keys sent to SPIF
input_y_shift (int) – The shift to get the y coordinate from the input keys sent to SPIF
board_address (str or None) –
The IP address of the board to which the FPGA is connected, or None to use the default board or chip_coords.
Note
chip_coords will be used first if both are specified, with board_address then being used if the coordinates don’t connect to an FPGA.
chip_coords (tuple(int, int) or None) –
The coordinates of the chip to which the FPGA is connected, or None to use the default board or board_address.
Note
chip_coords will be used first if board_address is also specified, with board_address then being used if the coordinates don’t connect to an FPGA.
- X_MASK = 3
- X_PER_ROW = 4
- Y_MASK = 1
- get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]
Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.
- Parameters:
pre_vertex (MachineVertex) – The machine vertex to get the map for
partition_id (str) – The partition to get the map for
routing_info (RoutingInfo) – Routing information
- Returns:
A list of (atom_id, key)
- Return type:
- get_fixed_key_and_mask(partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()for the conditions.- Parameters:
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- get_incoming_slice_for_link(link: FPGAConnection, index: int) Slice[source]
Get the slice to be given to the connection from the given link.
- Parameters:
link (FPGAConnection) – The FPGA connection to get the slice for
index (int) – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1
- Return type:
- get_machine_fixed_key_and_mask(machine_vertex: MachineVertex, partition_id: str) BaseKeyAndMask[source]
Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).
If this doesn’t return None,
get_fixed_key_and_mask()must also not return None, and the keys returned here must align with those such that for eachkey:maskreturned here,key & app_mask == app_key. It is OK for this to return None andget_fixed_key_and_mask()to return non-None if and only if there is only one machine vertex.- Parameters:
machine_vertex (MachineVertex) – A source machine vertex of this application vertex
partition_id (str) – The identifier of the partition to get the key for
- Return type:
BaseKeyAndMask or None
- property pause_stop_commands: Iterable[MultiCastCommand]
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands: Iterable[MultiCastCommand]
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands: List[MultiCastCommand]
The commands to be sent at given times in the simulation.
- Return type:
- spynnaker.pyNN.external_devices.SpikeInjector(notify: bool = True, database_notify_host: str | None = None, database_notify_port_num: int | None = None, database_ack_port_num: int | None = None) AbstractPyNNModel[source]
Supports creating a spike injector that can be added to the application graph.
- Parameters:
notify (bool) – Whether to register for notifications
database_notify_host (str or None) – the hostname for the device which is listening to the database notification.
database_ack_port_num (int or None) – the port number to which a external device will acknowledge that they have finished reading the database and are ready for it to start execution
database_notify_port_num (int or None) – The port number to which a external device will receive the database is ready command
- Returns:
The spike injector model object that can be placed in a pyNN
Population.- Return type:
- class spynnaker.pyNN.external_devices.SpynnakerLiveSpikesConnection(receive_labels: Iterable[str] | None = None, send_labels: Iterable[str] | None = None, local_host: str | None = None, local_port: int | None = 19999, live_packet_gather_label: str = 'LiveSpikeReceiver')
Bases:
LiveEventConnectionA connection for receiving and sending live spikes from and to SpiNNaker.
- Parameters:
receive_labels (iterable(str)) – Labels of population from which live spikes will be received.
send_labels (iterable(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: str, neuron_id: int, send_full_keys: bool = False)[source]
Send a spike from a single neuron.
- Parameters:
- send_spikes(label: str, neuron_ids: List[int], send_full_keys: bool = 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.external_devices.SpynnakerPoissonControlConnection(poisson_labels: Iterable[str] | None = None, local_host: str | None = None, local_port: int | None = 19999, control_label_extension: str = '_control')
Bases:
LiveEventConnectionA connection used to control a Poisson-distributed random event source’s firing rate at runtime.
- Parameters:
poisson_labels (iterable(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: str, init_callback: Callable[[str, int, float, float], None])[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 (callable(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: str, pause_stop_callback: Callable[[str, LiveEventConnection], None])[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 (callable(str, LiveEventConnection) -> 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.
- add_poisson_label(label: str)[source]
- Parameters:
label (str) – The label of the Poisson source population.
- add_receive_callback(label: str, live_event_callback: Callable[[str, int, List[int]], None], translate_key: bool = True)[source]
Add a callback for the reception of time events from a vertex.
These are typically used to receive keys or atoms ids that spiked.
Note
Previously this method was also used to add no time callback I.e. the once that take as parameters the label of the vertex, an int atom ID or key, and an int payload which may be None. For those use add_receive_no_time_callback now
- 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 (callable(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 or keys.
translate_key (bool) – True if the key is to be converted to an atom ID, False if the key should stay a key
- add_receive_no_time_callback(label: str, live_event_callback: Callable[[str, int, int | None], None], translate_key: bool = True)[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 (callable(str, int, int or None) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, an int atom ID or key, and an int payload which may be None
- add_start_callback(label: str, start_callback: Callable[[str, LiveEventConnection], None])[source]
Add a callback for the start of the simulation.
- Parameters:
start_callback (callable(str, LiveEventConnection) -> 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: str, start_resume_callback: Callable[[str, LiveEventConnection], None])[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 (callable(str, LiveEventConnection) -> 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.
- set_rate(label: str, neuron_id: int, rate: float)[source]
Set the rate of a Poisson neuron within a Poisson source.
- spynnaker.pyNN.external_devices.activate_live_output_for(population: Population, *, database_notify_host: str | None = None, database_notify_port_num: int | None = None, database_ack_port_num: int | None = None, port: int | None = None, host: str | None = None, tag: int | None = None, strip_sdp: bool = True, use_prefix: bool = False, key_prefix: int | None = None, prefix_type: EIEIOPrefix | None = None, message_type: EIEIOType = EIEIOType.KEY_32_BIT, right_shift: int = 0, payload_as_time_stamps: bool = True, notify: bool = True, use_payload_prefix: bool = True, payload_prefix: int | None = None, payload_right_shift: int = 0, number_of_packets_sent_per_time_step: int = 0, translate_keys: bool = False)
Output the spikes from a given population from SpiNNaker as they occur in the simulation.
- Parameters:
population (Population) – The population to activate the live output for
database_notify_host (str) – The hostname for the device which is listening to the database notification.
database_ack_port_num (int) – The port number to which a external device will acknowledge that they have finished reading the database and are ready for it to start execution
database_notify_port_num (int) – The port number to which a external device will receive the database is ready command
key_prefix (int or None) – the prefix to be applied to the key
prefix_type (EIEIOPrefix) – if the prefix type is 32 bit or 16 bit
message_type (EIEIOType) – If the message is a EIEIO command message, or an EIEIO data message with 16 bit or 32 bit keys.
payload_as_time_stamps (bool)
right_shift (int)
use_payload_prefix (bool)
notify (bool)
payload_prefix (int or None)
payload_right_shift (int)
number_of_packets_sent_per_time_step (int)
port (int) – The UDP port to which the live spikes will be sent. If not specified, the port will be taken from the “live_spike_port” parameter in the “Recording” section of the sPyNNaker configuration file.
host (str) – The host name or IP address to which the live spikes will be sent. If not specified, the host will be taken from the “live_spike_host” parameter in the “Recording” section of the sPyNNaker configuration file.
tag (int) – The IP tag to be used for the spikes. If not specified, one will be automatically assigned
strip_sdp (bool) – Determines if the SDP headers will be stripped from the transmitted packet.
use_prefix (bool) – Determines if the spike packet will contain a common prefix for the spikes
label (str) – The label of the gatherer vertex
partition_ids (list(str)) – The names of the partitions to create edges for
translate_keys (bool) – Whether the incoming keys from the cores should be translated to global keys rather than core-based keys
- spynnaker.pyNN.external_devices.activate_live_output_to(population: Population, device: Population | ApplicationVertex, partition_id: str = 'SPIKE')
Activate the output of spikes from a population to an external device.
Note
All spikes will be sent to the device.
- Parameters:
population (Population) – The pyNN population object from which spikes will be sent.
device (Population or ApplicationVertex) – The pyNN population or external device to which the spikes will be sent.
partition_id (str) – The partition ID to activate live output to.
- spynnaker.pyNN.external_devices.add_poisson_live_rate_control(poisson_population: Population, *, control_label_extension: str = '_control', receive_port: int | None = None, database_notify_host: str | None = None, database_notify_port_num: int | None = None, database_ack_port_num: int | None = None, notify: bool = True, reserve_reverse_ip_tag: bool = False)
Add a live rate controller to a Poisson population.
- Parameters:
poisson_population (Population) – The population to control
control_label_extension (str) – An extension to add to the label of the Poisson source. Must match up with the equivalent in the SpynnakerPoissonControlConnection
receive_port (int) – The port that the SpiNNaker board should listen on
database_notify_host (str) – the hostname for the device which is listening to the database notification.
database_ack_port_num (int) – the port number to which a external device will acknowledge that they have finished reading the database and are ready for it to start execution
database_notify_port_num (int) – The port number to which an external device will receive the database is ready command
notify (bool) – adds to the notification protocol if set.
reserve_reverse_ip_tag (bool) – True if a reverse IP tag is to be used, False if SDP is to be used (default)
- spynnaker.pyNN.external_devices.register_database_notification_request(hostname: str, notify_port: int, ack_port: int)[source]
Adds a socket system which is registered with the notification protocol.
- spynnaker.pyNN.external_devices.run_forever(sync_time: float = 0.0)[source]
Supports running forever in PyNN 0.8/0.9 format.
- Parameters:
sync_time – The time in milliseconds after which to pause before the host must continue the simulation.
- Returns:
Only when the application has started running on the SpiNNaker platform; no value is returned.