spynnaker.pyNN.external_devices_models package

Subpackages

Submodules

spynnaker.pyNN.external_devices_models.abstract_ethernet_controller module

class spynnaker.pyNN.external_devices_models.abstract_ethernet_controller.AbstractEthernetController[source]

Bases: object

A controller that can send multicast packets which can be received over Ethernet and translated to control an external device

get_external_devices()[source]

Get the external devices that are to be controlled by the controller

get_message_translator()[source]

Get the translator of messages

Return type:spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator
get_outgoing_partition_ids()[source]

Get the partition IDs of messages coming out of the controller

Return type:list(str)

spynnaker.pyNN.external_devices_models.abstract_ethernet_sensor module

class spynnaker.pyNN.external_devices_models.abstract_ethernet_sensor.AbstractEthernetSensor[source]

Bases: object

get_database_connection()[source]

Get a Database Connection instance that this device uses to inject packets

get_injector_label()[source]

Get the label to give to the Spike Injector

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

get_translator()[source]

Get a translator of multicast commands to Ethernet commands

spynnaker.pyNN.external_devices_models.abstract_ethernet_translator module

class spynnaker.pyNN.external_devices_models.abstract_ethernet_translator.AbstractEthernetTranslator[source]

Bases: object

A module that can translate packets received over Ethernet into control of an external device

translate_control_packet(multicast_packet)[source]

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

Parameters:multicast_packet (spinnman.messages.eieio.data_messages.AbstractEIEIODataElement) – A received multicast packet

spynnaker.pyNN.external_devices_models.abstract_multicast_controllable_device module

class spynnaker.pyNN.external_devices_models.abstract_multicast_controllable_device.AbstractMulticastControllableDevice[source]

Bases: object

A device that can be controlled by sending multicast packets to it, either directly, or via Ethernet using an AbstractEthernetTranslator

device_control_key

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

Return type:int
device_control_max_value

The maximum value to send to the device

Return type:float
device_control_min_value

The minimum value to send to the device

Return type:float
device_control_partition_id

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

Return type:str
device_control_scaling_factor

The scaling factor used to send the payload to this device.

Return type:int
device_control_send_type

The type of data to be sent.

Return type:SendType
device_control_timesteps_between_sending

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

Return type:int
device_control_uses_payload

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

Return type:bool
class spynnaker.pyNN.external_devices_models.abstract_multicast_controllable_device.SendType[source]

Bases: enum.Enum

The data type to be sent in the payload of the multicast packet

SEND_TYPE_ACCUM = 2
SEND_TYPE_FRACT = 4
SEND_TYPE_INT = 0
SEND_TYPE_UACCUM = 3
SEND_TYPE_UFRACT = 5
SEND_TYPE_UINT = 1

spynnaker.pyNN.external_devices_models.arbitrary_fpga_device module

class spynnaker.pyNN.external_devices_models.arbitrary_fpga_device.ArbitraryFPGADevice(n_neurons, fpga_link_id, fpga_id, board_address=None, label=None)[source]

Bases: pacman.model.graphs.application.application_fpga_vertex.ApplicationFPGAVertex, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

spynnaker.pyNN.external_devices_models.external_device_lif_control module

class spynnaker.pyNN.external_devices_models.external_device_lif_control.ExternalDeviceLifControl(**kwargs)[source]

Bases: spynnaker.pyNN.models.neuron.abstract_pynn_neuron_model_standard.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

create_vertex(n_neurons, label, constraints, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size)[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
  • constraints (list or None) – A list of constraints to give to the vertex, or None
Returns:

An application vertex for the population

Return type:

pacman.model.graphs.application.ApplicationVertex

spynnaker.pyNN.external_devices_models.external_device_lif_control_vertex module

class spynnaker.pyNN.external_devices_models.external_device_lif_control_vertex.ExternalDeviceLifControlVertex(devices, create_edges, max_atoms_per_core, neuron_impl, pynn_model, translator=None, spikes_per_second=None, label=None, ring_buffer_sigma=None, incoming_spike_buffer_size=None, constraints=None)[source]

Bases: spynnaker.pyNN.models.neuron.abstract_population_vertex.AbstractPopulationVertex, spynnaker.pyNN.external_devices_models.abstract_ethernet_controller.AbstractEthernetController, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.abstract_vertex_with_dependent_vertices.AbstractVertexWithEdgeToDependentVertices

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:
  • n_neurons – The number of neurons in the population
  • devices – The AbstractMulticastControllableDevice instances to be controlled by the population
  • create_edges – True if edges to the devices should be added by this dev (set to False if using the dev over Ethernet using a translator)
  • translator – Translator to be used when used for Ethernet communication. Must be provided if the dev is to be controlled over Ethernet.
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)
get_external_devices()[source]

Get the external devices that are to be controlled by the controller

get_message_translator()[source]

Get the translator of messages

Return type:spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_outgoing_partition_ids()[source]

Get the partition IDs of messages coming out of the controller

Return type:list(str)
routing_key_partition_atom_mapping(routing_info, partition)[source]

Returns a list of atom to key mapping.

Parameters:
Returns:

a iterable of tuples of atom IDs to keys.

Return type:

iterable(tuple(int,int))

spynnaker.pyNN.external_devices_models.threshold_type_multicast_device_control module

class spynnaker.pyNN.external_devices_models.threshold_type_multicast_device_control.ThresholdTypeMulticastDeviceControl(device)[source]

Bases: spynnaker.pyNN.models.neuron.threshold_types.abstract_threshold_type.AbstractThresholdType

A threshold type that can send multicast keys with the value of membrane voltage as the payload

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
get_values(parameters, state_variables, vertex_slice)[source]

Get the values to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of variables being retrieved
Returns:

A list with the same length as self.struct.field_types

Return type:

A list of (single value or list of values or RangedList)

has_variable(variable)[source]

Determine if this component has a variable by the given name

Parameters:variable (str) – The name of the variable
Return type:bool
update_values(values, parameters, state_variables)[source]

Update the parameters and state variables with the given struct values that have been read from the machine

Parameters:
  • values – The values read from the machine, one for each struct element
  • parameters – The holder of the parameters to update
  • state_variables – The holder of the state variables to update

Module contents

class spynnaker.pyNN.external_devices_models.AbstractEthernetController[source]

Bases: object

A controller that can send multicast packets which can be received over Ethernet and translated to control an external device

get_external_devices()[source]

Get the external devices that are to be controlled by the controller

get_message_translator()[source]

Get the translator of messages

Return type:spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator
get_outgoing_partition_ids()[source]

Get the partition IDs of messages coming out of the controller

Return type:list(str)
class spynnaker.pyNN.external_devices_models.AbstractEthernetSensor[source]

Bases: object

get_database_connection()[source]

Get a Database Connection instance that this device uses to inject packets

get_injector_label()[source]

Get the label to give to the Spike Injector

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

get_translator()[source]

Get a translator of multicast commands to Ethernet commands

class spynnaker.pyNN.external_devices_models.AbstractEthernetTranslator[source]

Bases: object

A module that can translate packets received over Ethernet into control of an external device

translate_control_packet(multicast_packet)[source]

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

Parameters:multicast_packet (spinnman.messages.eieio.data_messages.AbstractEIEIODataElement) – A received multicast packet
class spynnaker.pyNN.external_devices_models.ArbitraryFPGADevice(n_neurons, fpga_link_id, fpga_id, board_address=None, label=None)[source]

Bases: pacman.model.graphs.application.application_fpga_vertex.ApplicationFPGAVertex, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

class spynnaker.pyNN.external_devices_models.AbstractMulticastControllableDevice[source]

Bases: object

A device that can be controlled by sending multicast packets to it, either directly, or via Ethernet using an AbstractEthernetTranslator

device_control_key

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

Return type:int
device_control_max_value

The maximum value to send to the device

Return type:float
device_control_min_value

The minimum value to send to the device

Return type:float
device_control_partition_id

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

Return type:str
device_control_scaling_factor

The scaling factor used to send the payload to this device.

Return type:int
device_control_send_type

The type of data to be sent.

Return type:SendType
device_control_timesteps_between_sending

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

Return type:int
device_control_uses_payload

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

Return type:bool
class spynnaker.pyNN.external_devices_models.ExternalDeviceLifControl(**kwargs)[source]

Bases: spynnaker.pyNN.models.neuron.abstract_pynn_neuron_model_standard.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

create_vertex(n_neurons, label, constraints, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size)[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
  • constraints (list or None) – A list of constraints to give to the vertex, or None
Returns:

An application vertex for the population

Return type:

pacman.model.graphs.application.ApplicationVertex

class spynnaker.pyNN.external_devices_models.ExternalCochleaDevice(n_neurons, spinnaker_link, label=None, board_address=None)[source]

Bases: pacman.model.graphs.application.application_spinnaker_link_vertex.ApplicationSpiNNakerLinkVertex, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

class spynnaker.pyNN.external_devices_models.ExternalFPGARetinaDevice(mode, retina_key, spinnaker_link_id, polarity, label=None, board_address=None)[source]

Bases: pacman.model.graphs.application.application_spinnaker_link_vertex.ApplicationSpiNNakerLinkVertex, spinn_front_end_common.abstract_models.abstract_send_me_multicast_commands_vertex.AbstractSendMeMulticastCommandsVertex, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

Parameters:
  • mode – The retina “mode”
  • retina_key – The value of the top 16-bits of the key
  • spinnaker_link_id – The SpiNNaker link to which the retina is connected
  • polarity – The “polarity” of the retina data
  • label
  • board_address
DOWN_POLARITY = 'DOWN'
MERGED_POLARITY = 'MERGED'
MODE_128 = '128'
MODE_16 = '16'
MODE_32 = '32'
MODE_64 = '64'
UP_POLARITY = 'UP'
static get_n_neurons(mode, polarity)[source]
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
pause_stop_commands

The commands needed when pausing or stopping simulation

Return type:iterable(MultiCastCommand)
start_resume_commands

The commands needed when starting or resuming simulation

Return type:iterable(MultiCastCommand)
timed_commands

The commands to be sent at given times in the simulation

Return type:iterable(MultiCastCommand)
class spynnaker.pyNN.external_devices_models.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)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_vertex_with_dependent_vertices.AbstractVertexWithEdgeToDependentVertices, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

An Omnibot motor control device - has a real vertex and an external device vertex

PARAMS_REGION = 1
PARAMS_SIZE = 28
SYSTEM_REGION = 0
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
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) Return the vertices which this vertex depends upon
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) Return the dependent edge identifier
generate_data_specification(spec, placement, routing_info, machine_time_step, time_scale_factor)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
reserve_memory_regions(spec)[source]

Reserve SDRAM space for memory areas: 1) Area for information on what data to record 2) area for start commands 3) area for end commands

class spynnaker.pyNN.external_devices_models.MunichRetinaDevice(retina_key, spinnaker_link_id, position, label=None, polarity=None, board_address=None)[source]

Bases: pacman.model.graphs.application.application_spinnaker_link_vertex.ApplicationSpiNNakerLinkVertex, spinn_front_end_common.abstract_models.abstract_send_me_multicast_commands_vertex.AbstractSendMeMulticastCommandsVertex, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

DOWN_POLARITY = 'DOWN'
LEFT_RETINA = 'LEFT'
LEFT_RETINA_DISABLE = 69
LEFT_RETINA_ENABLE = 69
LEFT_RETINA_KEY_SET = 67
MANAGEMENT_BIT = 1024
MANAGEMENT_MASK = 4294965248
MERGED_POLARITY = 'MERGED'
RIGHT_RETINA = 'RIGHT'
RIGHT_RETINA_DISABLE = 70
RIGHT_RETINA_ENABLE = 70
RIGHT_RETINA_KEY_SET = 68
UP_POLARITY = 'UP'
default_parameters = {'board_address': None, 'label': 'MunichRetinaDevice', 'polarity': None}
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
pause_stop_commands

The commands needed when pausing or stopping simulation

Return type:iterable(MultiCastCommand)
start_resume_commands

The commands needed when starting or resuming simulation

Return type:iterable(MultiCastCommand)
timed_commands

The commands to be sent at given times in the simulation

Return type:iterable(MultiCastCommand)
class spynnaker.pyNN.external_devices_models.ThresholdTypeMulticastDeviceControl(device)[source]

Bases: spynnaker.pyNN.models.neuron.threshold_types.abstract_threshold_type.AbstractThresholdType

A threshold type that can send multicast keys with the value of membrane voltage as the payload

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
get_values(parameters, state_variables, vertex_slice)[source]

Get the values to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of variables being retrieved
Returns:

A list with the same length as self.struct.field_types

Return type:

A list of (single value or list of values or RangedList)

has_variable(variable)[source]

Determine if this component has a variable by the given name

Parameters:variable (str) – The name of the variable
Return type:bool
update_values(values, parameters, state_variables)[source]

Update the parameters and state variables with the given struct values that have been read from the machine

Parameters:
  • values – The values read from the machine, one for each struct element
  • parameters – The holder of the parameters to update
  • state_variables – The holder of the state variables to update