spynnaker.pyNN.external_devices_models.push_bot.ethernet package

Module contents

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetDevice(protocol: MunichIoSpiNNakerLinkProtocol, device: AbstractPushBotOutputDevice, uses_payload: bool, time_between_send: int | None, first_send_timestep: int | None = 100)

Bases: AbstractMulticastControllableDevice

An arbitrary PushBot device.

Parameters:
  • protocol – The protocol instance to get commands from

  • device – The Enum instance of the device to control

  • uses_payload – True if the device uses a payload for control

  • time_between_send – The timesteps between sending

  • first_send_timestep – The first timestep to send

property device_control_first_send_timestep: int | None

The first timestep that the device should send in (0 by default).

property device_control_key: int

The key that must be sent to the device to control it.

property device_control_max_value: Decimal

The maximum value to send to the device.

property device_control_min_value: float

The minimum value to send to the device.

property device_control_partition_id: str

A partition ID to give to an outgoing edge partition that will control this device.

property device_control_send_type: SendType

The type of data to be sent.

property device_control_timesteps_between_sending: int | None

The number of timesteps between sending commands to the device. This defines the “sampling interval” for the device.

property device_control_uses_payload: bool

Whether the control of the device accepts an arbitrary valued payload, the value of which will change the devices behaviour.

property protocol: MunichIoSpiNNakerLinkProtocol

The protocol instance, for use in the subclass.

abstractmethod set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol) None[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol – The protocol to use for this device

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetLEDDevice(led: PushBotLED, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time_front: int | None = None, start_active_time_back: int | None = None, start_total_period: int | None = None, start_frequency: int | None = None, timesteps_between_send: int | None = None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The LED of a PushBot.

Parameters:
  • led – The LED to control

  • protocol – The protocol instance to get commands from

  • start_active_time_front – The “active time” to set for the front LED at the start

  • start_active_time_back – The “active time” to set for the back LED at the start

  • start_total_period – The “total period” to set at the start

  • start_frequency – The “frequency” to set at the start

  • timesteps_between_send – 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.

set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol) None[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol – The protocol to use for this device

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetLaserDevice(laser: PushBotLaser, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time: int | None = None, start_total_period: int | None = None, start_frequency: int | None = None, timesteps_between_send: int | None = None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The Laser of a PushBot.

Parameters:
  • laser – The PushBotLaser value to control

  • protocol – The protocol instance to get commands from

  • start_active_time – The “active time” value to send at the start

  • start_total_period – The “total period” value to send at the start

  • start_frequency – The “frequency” to send at the start

  • timesteps_between_send – 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.

set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol) None[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol – The protocol to use for this device

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetMotorDevice(motor: PushBotMotor, protocol: MunichIoSpiNNakerLinkProtocol, timesteps_between_send: int | None = None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The motor of a PushBot.

Parameters:
  • motor – indicates which motor to control

  • protocol – The protocol used to control the device

  • timesteps_between_send – 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.

set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol) None[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol – The protocol to use for this device

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetRetinaDevice(protocol: MunichIoSpiNNakerLinkProtocol, resolution: PushBotRetinaResolution, pushbot_ip_address: str, pushbot_port: int = 56000, injector_port: int | None = None, local_host: str | None = None, local_port: int | None = None, retina_injector_label: str = 'PushBotRetinaInjector')

Bases: AbstractPushBotRetinaDevice, AbstractEthernetSensor

A PushBot retina over Ethernet

Parameters:
  • protocol

  • resolution

  • pushbot_ip_address

  • pushbot_port

  • injector_port

  • local_host

  • local_port

  • retina_injector_label

get_database_connection() PushBotRetinaConnection[source]
Returns:

A Database Connection instance that this device uses to inject packets.

get_injector_label() str[source]
Returns:

the label to give to the Spike Injector.

get_injector_parameters() Dict[str, Any][source]
Returns:

The parameters of the Spike Injector to use with this device.

get_n_neurons() int[source]
Returns:

The number of neurons that will be sent out by the device.

get_translator() PushBotTranslator[source]
Returns:

A translator of multicast commands to Ethernet commands.

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetSpeakerDevice(speaker: PushBotSpeaker, protocol: MunichIoSpiNNakerLinkProtocol, start_active_time: int = 0, start_total_period: int = 0, start_frequency: int | None = 0, start_melody: int | None = None, timesteps_between_send: int | None = None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The Speaker of a PushBot.

Parameters:
  • speaker – The speaker to control

  • protocol – The protocol instance to get commands from

  • start_active_time – The “active time” to set at the start

  • start_total_period – The “total period” to set at the start

  • start_frequency – The “frequency” to set at the start

  • start_melody – The “melody” to set at the start

  • timesteps_between_send – 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.

set_command_protocol(command_protocol: MunichIoSpiNNakerLinkProtocol) None[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol – The protocol to use for this device

property start_resume_commands: Iterable[MultiCastCommand]

The commands needed when starting or resuming simulation.

property timed_commands: List[MultiCastCommand]

The commands to be sent at given times in the simulation.

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotRetinaConnection(retina_injector_label: str, pushbot_wifi_connection: PushBotWIFIConnection, resolution: PushBotRetinaResolution = PushBotRetinaResolution.NATIVE_128_X_128, local_host: str | None = None, local_port: int | None = None)

Bases: SpynnakerLiveSpikesConnection

A connection that sends spikes from the PushBot retina to a spike injector in SpiNNaker.

Note

This assumes a packet format of 16-bits per retina event.

Parameters:
  • retina_injector_label

  • pushbot_wifi_connection

  • resolution

  • local_host

  • local_port

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotTranslator(protocol: MunichIoSpiNNakerLinkProtocol, pushbot_wifi_connection: PushBotWIFIConnection)

Bases: AbstractEthernetTranslator

Translates packets between PushBot Multicast packets and PushBot Wi-Fi Commands.

Parameters:
  • protocol – The instance of the PushBot protocol to get keys from

  • pushbot_wifi_connection – A Wi-Fi connection to the PushBot

translate_control_packet(multicast_packet: MultiCastCommand) None[source]

Translate a multicast packet received over Ethernet and send appropriate messages to the external device.

Parameters:

multicast_packet – A received multicast packet

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotWIFIConnection(remote_host: str, remote_port: int = 56000)

Bases: Connection, Listenable

A connection to a PushBot via Wi-Fi.

Parameters:
  • remote_host – The IP address of the PushBot

  • remote_port – The port number of the PushBot (default 56000)

Raises:

SpinnmanIOException – If there is an error setting up the communication channel

RECV_SIZE = 1024
close() None[source]

See spinnman.connections.Connection.close().

get_receive_method() Callable[[], bytes][source]
Returns:

The method that receives this connection.

is_connected() bool[source]

See :py:meth:`~spinnman.connections.Connection.is_connected

Returns:

True if ping works

is_ready_to_receive(timeout: float = 0) bool[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:

timeout – The time to wait before returning if the connection is not ready

Returns:

True if there is an SCP packet to be read

property local_ip_address: str

The local IP address to which the connection is bound, as a dotted string, e.g. 0.0.0.0.

property local_port: int

The local port to which the connection is bound.

receive(timeout: float | None = None) bytes[source]

Receive data from the connection

Parameters:

timeout – The timeout, or None to wait forever

Returns:

The data received

Raises:
  • SpinnmanTimeoutException – If a timeout occurs before any data is received

  • SpinnmanIOException – If an error occurs receiving the data

property remote_ip_address: str | None

The remote IP address to which the connection is connected, as a dotted string, or None if not connected remotely.

property remote_port: int

The remote port to which the connection is connected, or None if not connected remotely.

send(data: bytes) None[source]

Send data down this connection

Parameters:

data – The data to be sent

Raises:

SpinnmanIOException – If there is an error sending the data

spynnaker.pyNN.external_devices_models.push_bot.ethernet.get_pushbot_wifi_connection(remote_host: str, remote_port: int = 56000) PushBotWIFIConnection

Get an existing connection to a PushBot, or make a new one.

Parameters:
  • remote_host – The IP address of the PushBot

  • remote_port – The port number of the PushBot (default 56000)

Returns:

Connection to the Pushbot