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, fpga_link_id, fpga_id, board_address=None, chip_coords=None, label=None)
Bases:
ApplicationFPGAVertex
,PopulationApplicationVertex
- class spynnaker.pyNN.external_devices.EIEIOType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
Possible 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, spinnaker_link, label=None, board_address=None)
Bases:
ApplicationSpiNNakerLinkVertex
,PopulationApplicationVertex
- class spynnaker.pyNN.external_devices.ExternalDeviceLifControl(**kwargs)
Bases:
AbstractPyNNNeuronModelStandard
Abstract 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 (AbstractPyNNNeuronModel) – The model of the neuron soma
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, label, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size, n_steps_per_timestep, drop_late_spikes, splitter, seed, n_colour_bits)[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 (AbstractSplitterCommon or None) –
seed (float) –
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, retina_key, spinnaker_link_id, polarity, label=None, board_address=None)
Bases:
ApplicationSpiNNakerLinkVertex
,PopulationApplicationVertex
,AbstractSendMeMulticastCommandsVertex
- 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)[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
- static get_n_neurons(mode, polarity)[source]
- property pause_stop_commands
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.ICUBRetinaDevice(base_key=0, width=304, height=240, sub_width=16, sub_height=16, spinnaker_link_id=0, board_address=None)
Bases:
Application2DSpiNNakerLinkVertex
,HasShapeKeyFields
An 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)[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(index)[source]
Get the slice to be given to the connection.
- get_machine_fixed_key_and_mask(machine_vertex, partition_id)[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:mask
returned 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
- get_shape_key_fields(vertex_slice)[source]
Get the fields to be used for each dimension in the shape of the given source vertex slice, as a list of start, size, mask, shift values in the order of the fields.
- class spynnaker.pyNN.external_devices.MunichIoSpiNNakerLinkProtocol(mode, instance_key=None, uart_id=0)
Bases:
object
Provides 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, time=None)[source]
- property add_payload_logic_to_current_output_key
- bias_values(bias_id, bias_value, time=None)[source]
- property bias_values_key
- configure_master_key(new_key, time=None)[source]
- property configure_master_key_key
- disable_retina(time=None)[source]
- property disable_retina_key
- property enable_disable_motor_key
- generic_motor0_raw_output_leak_to_0(pwm_signal, time=None)[source]
- property generic_motor0_raw_output_leak_to_0_key
- generic_motor0_raw_output_permanent(pwm_signal, time=None)[source]
- property generic_motor0_raw_output_permanent_key
- generic_motor1_raw_output_leak_to_0(pwm_signal, time=None)[source]
- property generic_motor1_raw_output_leak_to_0_key
- generic_motor1_raw_output_permanent(pwm_signal, time=None)[source]
- property generic_motor1_raw_output_permanent_key
- generic_motor_disable(time=None)[source]
- generic_motor_enable(time=None)[source]
- generic_motor_total_period(time_in_ms, time=None)[source]
- property generic_motor_total_period_key
- property instance_key
The key of this instance of the protocol.
- Return type:
- property master_slave_key
- master_slave_set_master_clock_active(time=None)[source]
- master_slave_set_master_clock_not_started(time=None)[source]
- master_slave_set_slave(time=None)[source]
- master_slave_use_internal_counter(time=None)[source]
- property mode
- Return type:
- poll_individual_sensor_continuously(sensor_id, time_in_ms, time=None)[source]
- property poll_individual_sensor_continuously_key
- poll_sensors_once(sensor_id, time=None)[source]
- property poll_sensors_once_key
- protocol_instance = 0
- push_bot_laser_config_active_time(active_time, time=None)[source]
- property push_bot_laser_config_active_time_key
- push_bot_laser_config_total_period(total_period, time=None)[source]
- property push_bot_laser_config_total_period_key
- push_bot_laser_set_frequency(frequency, time=None)[source]
- property push_bot_laser_set_frequency_key
- push_bot_led_back_active_time(active_time, time=None)[source]
- property push_bot_led_back_active_time_key
- push_bot_led_front_active_time(active_time, time=None)[source]
- property push_bot_led_front_active_time_key
- push_bot_led_set_frequency(frequency, time=None)[source]
- property push_bot_led_set_frequency_key
- push_bot_led_total_period(total_period, time=None)[source]
- property push_bot_led_total_period_key
- push_bot_motor_0_leaking_towards_zero(velocity, time=None)[source]
- property push_bot_motor_0_leaking_towards_zero_key
- push_bot_motor_0_permanent(velocity, time=None)[source]
- property push_bot_motor_0_permanent_key
- push_bot_motor_1_leaking_towards_zero(velocity, time=None)[source]
- property push_bot_motor_1_leaking_towards_zero_key
- push_bot_motor_1_permanent(velocity, time=None)[source]
- property push_bot_motor_1_permanent_key
- push_bot_speaker_config_active_time(active_time, time=None)[source]
- property push_bot_speaker_config_active_time_key
- push_bot_speaker_config_total_period(total_period, time=None)[source]
- property push_bot_speaker_config_total_period_key
- push_bot_speaker_set_melody(melody, time=None)[source]
- property push_bot_speaker_set_melody_key
- push_bot_speaker_set_tone(frequency, time=None)[source]
- property push_bot_speaker_set_tone_key
- pwm_pin_output_timer_a_channel_0_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_a_channel_0_ratio_key
- pwm_pin_output_timer_a_channel_1_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_a_channel_1_ratio_key
- pwm_pin_output_timer_a_duration(timer_period, time=None)[source]
- property pwm_pin_output_timer_a_duration_key
- pwm_pin_output_timer_b_channel_0_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_b_channel_0_ratio_key
- pwm_pin_output_timer_b_channel_1_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_b_channel_1_ratio_key
- pwm_pin_output_timer_b_duration(timer_period, time=None)[source]
- property pwm_pin_output_timer_b_duration_key
- pwm_pin_output_timer_c_channel_0_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_c_channel_0_ratio_key
- pwm_pin_output_timer_c_channel_1_ratio(timer_period, time=None)[source]
- property pwm_pin_output_timer_c_channel_1_ratio_key
- pwm_pin_output_timer_c_duration(timer_period, time=None)[source]
- property pwm_pin_output_timer_c_duration_key
- query_state_of_io_lines(time=None)[source]
- property query_state_of_io_lines_key
- remove_payload_logic_to_current_output(payload, time=None)[source]
- property remove_payload_logic_to_current_output_key
- reset_retina(time=None)[source]
- property reset_retina_key
- sensor_transmission_key(sensor_id)[source]
- static sent_mode_command()[source]
True if the mode command has ever been requested by any instance.
- set_mode(time=None)[source]
- property set_mode_key
- set_output_pattern_for_payload(payload, time=None)[source]
- property set_output_pattern_for_payload_key
- set_payload_pins_to_high_impedance(payload, time=None)[source]
- property set_payload_pins_to_high_impedance_key
- set_retina_key(new_key, time=None)[source]
- property set_retina_key_key
- set_retina_transmission(retina_key=RetinaKey.NATIVE_128_X_128, retina_payload=None, time=None)[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
- turn_off_sensor_reporting(sensor_id, time=None)[source]
- property turn_off_sensor_reporting_key
- property uart_id
- 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
,PopulationApplicationVertex
An 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()[source]
Return the vertices which this vertex depends upon.
- Return type:
iterable(ApplicationVertex)
- edge_partition_identifiers_for_dependent_vertex(vertex)[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
,AbstractSendMeMulticastCommandsVertex
An 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)[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
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetLEDDevice(led, protocol, start_active_time_front=None, start_active_time_back=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice
,AbstractSendMeMulticastCommandsVertex
The LED of a PushBot.
- Parameters:
led (PushBotLED) – The LED to control
protocol (MunichIoEthernetProtocol) – 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
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol)[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
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetLaserDevice(laser, protocol, start_active_time=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice
,AbstractSendMeMulticastCommandsVertex
The 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
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol)[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
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
The commands to be sent at given times in the simulation.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetMotorDevice(motor, protocol, timesteps_between_send=None)
Bases:
PushBotEthernetDevice
,AbstractSendMeMulticastCommandsVertex
The motor of a PushBot.
- Parameters:
motor (PushBotMotor) – indicates which motor to control
protocol (MunichIoEthernetProtocol) – 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
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol)[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
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
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
,AbstractEthernetSensor
- 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()[source]
Get a Database Connection instance that this device uses to inject packets.
- Return type:
- Return type:
- get_injector_parameters()[source]
Get the parameters of the Spike Injector to use with this device.
- get_n_neurons()[source]
Get the number of neurons that will be sent out by the device.
- Return type:
- get_translator()[source]
Get a translator of multicast commands to Ethernet commands.
- Return type:
- class spynnaker.pyNN.external_devices.PushBotEthernetSpeakerDevice(speaker, protocol, start_active_time=0, start_total_period=0, start_frequency=0, start_melody=None, timesteps_between_send=None)
Bases:
PushBotEthernetDevice
,AbstractSendMeMulticastCommandsVertex
The Speaker of a PushBot.
- Parameters:
speaker (PushBotSpeaker) – The speaker to control
protocol (MunichIoEthernetProtocol) – 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
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- set_command_protocol(command_protocol)[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
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
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:
AbstractPushBotOutputDevice
The 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:
AbstractPushBotOutputDevice
The 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:
ExternalDeviceLifControl
Leaky 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 (AbstractPyNNNeuronModel) – The model of the neuron soma
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:
ExternalDeviceLifControl
Control 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 (AbstractPyNNNeuronModel) – The model of the neuron soma
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:
AbstractPushBotOutputDevice
The 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:
Enum
Resolutions 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:
object
Viewer 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:
AbstractPushBotOutputDevice
The 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
,PopulationApplicationVertex
The 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
,PopulationApplicationVertex
The 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
,PopulationApplicationVertex
The 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
,PopulationApplicationVertex
- 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
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
,PopulationApplicationVertex
The 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.SPIFLiveSpikesConnection(receive_labels, spif_host, spif_port=3332, events_per_packet=32, time_per_packet=500, local_host=None, local_port=None)
Bases:
DatabaseConnection
A 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, 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 (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, 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 (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, live_event_callback, translate_key=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, 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 (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
Output (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, partition)[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.
- property pause_stop_commands
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
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
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
,AbstractSendMeMulticastCommandsVertex
,HasShapeKeyFields
A 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, partition_id, routing_info)[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)[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, index)[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, partition_id)[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:mask
returned 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
- get_shape_key_fields(vertex_slice)[source]
Get the fields to be used for each dimension in the shape of the given source vertex slice, as a list of start, size, mask, shift values in the order of the fields.
- property pause_stop_commands
The commands needed when pausing or stopping simulation.
- Return type:
iterable(MultiCastCommand)
- property start_resume_commands
The commands needed when starting or resuming simulation.
- Return type:
iterable(MultiCastCommand)
- property timed_commands
The commands to be sent at given times in the simulation.
- Return type:
- spynnaker.pyNN.external_devices.SpikeInjector(notify=True, database_notify_host=None, database_notify_port_num=None, database_ack_port_num=None)[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=None, send_labels=None, local_host=None, local_port=19999, live_packet_gather_label='LiveSpikeReceiver')
Bases:
LiveEventConnection
A 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, neuron_id, send_full_keys=False)[source]
Send a spike from a single neuron.
- Parameters:
- 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.external_devices.SpynnakerPoissonControlConnection(poisson_labels=None, local_host=None, local_port=19999, control_label_extension='_control')
Bases:
LiveEventConnection
A 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, 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 (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, 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 (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)[source]
- Parameters:
label (str) – The label of the Poisson source population.
- add_receive_callback(label, live_event_callback, translate_key=False)[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_start_callback(label, start_callback)[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, 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 (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, neuron_id, rate)[source]
Set the rate of a Poisson neuron within a Poisson source.
- spynnaker.pyNN.external_devices.activate_live_output_for(population, database_notify_host=None, database_notify_port_num=None, database_ack_port_num=None, port=None, host=None, tag=None, strip_sdp=True, use_prefix=False, key_prefix=None, prefix_type=None, message_type=EIEIOType.KEY_32_BIT, right_shift=0, payload_as_time_stamps=True, notify=True, use_payload_prefix=True, payload_prefix=None, payload_right_shift=0, number_of_packets_sent_per_time_step=0, translate_keys=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, device, partition_id='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, control_label_extension='_control', receive_port=None, database_notify_host=None, database_notify_port_num=None, database_ack_port_num=None, notify=True, reserve_reverse_ip_tag=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, notify_port, ack_port)[source]
Adds a socket system which is registered with the notification protocol.
- spynnaker.pyNN.external_devices.run_forever(sync_time=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.