spynnaker.pyNN.models.spike_source package

Submodules

spynnaker.pyNN.models.spike_source.spike_source_array_machine_vertex module

class spynnaker.pyNN.models.spike_source.spike_source_array_machine_vertex.SpikeSourceArrayMachineVertex(label: str | None, vertex_slice: Slice | None = None, app_vertex: ReverseIpTagMultiCastSource | None = None, n_keys: int | None = None, eieio_params: EIEIOParameters | None = None, send_buffer_times: _SendBufferTimes = None)[source]

Bases: ReverseIPTagMulticastSourceMachineVertex

Extended to add colour.

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
  • PacmanValueError – If the slice of the machine_vertex is too big

  • AttributeError – If a not-None app_vertex is not an ApplicationVertex

get_n_keys_for_partition(partition_id)[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

Module contents

class spynnaker.pyNN.models.spike_source.SpikeSourceArray(spike_times=None)

Bases: AbstractPyNNModel

create_vertex(n_neurons, label, splitter, 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

  • splitter (AbstractSplitterCommon or None) –

  • n_colour_bits (int) –

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters = {'n_colour_bits': None, 'splitter': None}
class spynnaker.pyNN.models.spike_source.SpikeSourceArrayVertex(n_neurons, spike_times, label, max_atoms_per_core, model, splitter, n_colour_bits)

Bases: ReverseIpTagMultiCastSource, PopulationApplicationVertex, SupportsStructure

Model for play back of spikes.

Parameters:
  • n_keys (int) – The number of keys to be sent via this multicast source

  • label (str) – The label of this vertex

  • max_atoms_per_core (int) –

  • board_address (str or None) – The IP address of the board on which to place this vertex if receiving data, either buffered or live (by default, any board is chosen)

  • receive_port (int or None) – The port on the board that will listen for incoming event packets (default is to disable this feature; set a value to enable it)

  • receive_sdp_port (int) – The SDP port to listen on for incoming event packets (defaults to 1)

  • receive_tag (IPTag) – The IP tag to use for receiving live events (uses any by default)

  • receive_rate (float) – The estimated rate of packets that will be sent by this source

  • virtual_key (int) – The base multicast key to send received events with (assigned automatically by default)

  • prefix (int) – The prefix to “or” with generated multicast keys (default is no prefix)

  • prefix_type (EIEIOPrefix) – Whether the prefix should apply to the upper or lower half of the multicast keys (default is upper half)

  • check_keys (bool) – True if the keys of received events should be verified before sending (default False)

  • send_buffer_times (ndarray(ndarray(numpy.int32)) or list(ndarray(int32)) or None) – An array of arrays of times at which keys should be sent (one array for each key, default disabled)

  • send_buffer_partition_id (str or None) – The ID of the partition containing the edges down which the events are to be sent

  • reserve_reverse_ip_tag (bool) – Extra flag for input without a reserved port

  • injection_partition (str) – If not None, will enable injection and specify the partition to send injected keys with

  • splitter (AbstractSplitterCommon or None) – the splitter object needed for this vertex

SPIKE_RECORDING_REGION_ID = 0
property atoms_shape

The “shape” of the atoms in the vertex i.e. how the atoms are split between the dimensions of the vertex. By default everything is 1-dimensional, so the value will be a 1-tuple but can be overridden by a vertex that supports multiple dimensions.

Return type:

tuple(int, …)

create_machine_vertex(vertex_slice, sdram, label=None)[source]

Create a machine vertex from this application vertex.

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover.

  • sdram (AbstractSDRAM) – The SDRAM used by the machine vertex.

  • label (str or None) – human readable label for the machine vertex

Returns:

The created machine vertex

Return type:

MachineVertex

describe()[source]

Returns a human-readable description of the cell or synapse type.

The output may be customised by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

get_buffer_data_type(name)[source]

Get the type of data recorded by the buffer manager.

The buffer data type controls how data returned by the cores is handled in NeoBufferDatabase.

Parameters:

name (str) – The name of the variable recorded

Return type:

BufferDatabase

Raises:

KeyError – if the variable isn’t being recorded

get_data_type(name)[source]

Get the type data returned by a recording of the variable.

This is the type of data the C code is returning. For instance data such as spikes this will be None.

Parameters:

name (str) – The name of the variable to get the type of

Return type:

DataType or None

Raises:

KeyError – If the variable isn’t recordable

get_neurons_recording(name, vertex_slice)[source]

Gets the neurons being recorded on the core with this slice.

Typically vertex_slice.get_raster_ids(atoms_shape) but may be a sublist if doing selective recording.

Parameters:
  • name (str) – The name of the variable to get the region of

  • vertex_slice (Slice) –

Returns:

A list of the global raster IDs of the atoms in recording named variable within this slice

Return type:

list(int)

get_parameter_values(names, selector=None)[source]

Get the values of a parameter or parameters for the whole Population or a subset if the selector is used.

Parameters:
Return type:

ParameterHolder

Raises:

KeyError – if the parameter is not something that can be read

get_parameters()[source]

Get the names of all the parameters that can be obtained

Return type:

list(str)

get_recordable_variables()[source]

Get a list of the names and types of things that can be recorded.

This methods list the variable recorded via the Population.

Return type:

list(str)

get_recording_region(name)[source]

Gets the recording region for the named variable.

Parameters:

name (str) – The name of the variable to get the region of

Return type:

int

Raises:

KeyError – If the variable isn’t being recorded

get_recording_variables()[source]

Get a list of variables that are currently being recorded.

Return type:

list(str)

get_sampling_interval_ms(name)[source]

Get the sampling interval of the recording for the given variable.

The values is in ms and unless selective recording is used will be SpynnakerDataView.get_simulation_time_step_us()

Return type:

float

Raises:

KeyError – If the variable isn’t being recorded

get_units(name)[source]

Get the units of the given parameter or state variable.

Parameters:

name (str) – the name of the parameter to get the units of

Return type:

str

Raises:

KeyError – if the name isn’t recognised or the units cannot be identified

property n_colour_bits

The number of colour bits sent by this vertex.

Assumed 0 unless overridden

Return type:

int

set_not_recording(name, indices=None)[source]

Set a variable not recording.

Parameters:
  • name (str) – The name of the variable to not record

  • indices (list(int) or None) – The list of neuron indices to not record or None for all

Raises:

KeyError – if the variable cannot be stopped from recording

set_parameter_values(name, value, selector=None)[source]

Set the values of a parameter for the whole Population or a subset if the selector is used.

Parameters:
Raises:

KeyError – if the parameter is not something that can be changed

set_recording(name, sampling_interval=None, indices=None)[source]

Set a variable recording.

Parameters:
  • name (str) – The name of the variable to set the status of

  • sampling_interval (float or None) – How often the variable should be recorded or None for every time step, in milliseconds

  • indices (list(int) or None) – The list of neuron indices to record or None for all

Raises:

KeyError – if the variable cannot be recorded

set_structure(structure)[source]

Set the structure of the object.

Parameters:

structure (BaseStructure) – The structure to set

class spynnaker.pyNN.models.spike_source.SpikeSourceFromFile(spike_time_file, min_atom=None, max_atom=None, min_time=None, max_time=None, split_value='\t')

Bases: SpikeSourceArray

A spike source that works from a file (typically a tab-separated table in a text file).

property spike_times
class spynnaker.pyNN.models.spike_source.SpikeSourcePoisson(rate=1.0, start=0, duration=None)

Bases: AbstractPyNNModel

absolute_max_atoms_per_core = 500
create_vertex(n_neurons, label, seed, max_rate, splitter, 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

  • seed (float) –

  • max_rate (float) –

  • splitter (AbstractSplitterCommon or None) –

  • n_colour_bits (int) –

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters = {'max_rate': None, 'n_colour_bits': None, 'seed': None, 'splitter': None}
class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonMachineVertex(sdram, is_recording, label=None, app_vertex=None, vertex_slice=None)

Bases: MachineVertex, AbstractReceiveBuffersToHost, ProvidesProvenanceDataFromMachineImpl, AbstractHasProfileData, AbstractHasAssociatedBinary, AbstractRewritesDataSpecification, AbstractGeneratesDataSpecification, SendsSynapticInputsOverSDRAM

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
  • PacmanValueError – If the slice of the machine_vertex is too big

  • AttributeError – If a not-None app_vertex is not an ApplicationVertex

FAST_RATE_PER_TICK_CUTOFF = 10
class POISSON_SPIKE_SOURCE_REGIONS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Memory region IDs for the the Poisson source code.

EXPANDER_REGION = 7

Data for the on-chip connection generator binaries.

POISSON_PARAMS_REGION = 1

The parameters for the Poisson generator.

PROFILER_REGION = 5

Profiler data.

PROVENANCE_REGION = 4

Provenance data.

RATES_REGION = 2

Spike rates (and the times at which they apply).

SDRAM_EDGE_PARAMS = 6

Parameters for an SDRAM edge.

SPIKE_HISTORY_REGION = 3

Record of when spikes were actually sent.

SYSTEM_REGION = 0

System control information (simulation timestep, etc.)

PROFILE_TAG_LABELS = {0: 'TIMER', 1: 'PROB_FUNC'}
SEED_OFFSET_BYTES = 44
SEED_SIZE_BYTES = 16
SLOW_RATE_PER_TICK_CUTOFF = 0.01
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

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_n_keys_for_partition(partition_id)[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

get_profile_data(placement)[source]

Get the profile data recorded during simulation.

Parameters:

placement (Placement) –

Return type:

ProfileData

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

get_recording_region_base_address(placement)[source]

Get the recording region base address.

Parameters:

placement (Placement) – the placement object of the core to find the address of

Returns:

the base address of the recording region

Return type:

int

max_spikes_per_second()[source]

Get maximum expected number of spikes per second.

Parameters:

variable (str) – the variable to find units from

Returns:

the units as a string.

Return type:

str

max_spikes_per_ts()[source]

Get maximum expected number of spikes per timestep.

Return type:

int

read_parameters_from_machine(placement)[source]
regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded.

Parameters:
  • spec (DataSpecificationGenerator) – Where to write the regenerated spec

  • placement (Placement) – Where are we regenerating for?

reload_required()[source]

Return true if any data region needs to be reloaded.

Return type:

bool

property sdram_required

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

sdram_requirement(sdram_machine_edge)[source]

Asks a machine vertex for the SDRAM requirement it needs.

Parameters:

sdram_machine_edge (SDRAMMachineEdge) – The SDRAM edge in question

Returns:

The size in bytes this vertex needs for the SDRAM edge.

Return type:

int (most likely a multiple of 4)

set_rate_changed()[source]
set_reload_required(new_value)[source]

Indicate that the regions have been reloaded.

Parameters:

new_value – the new value

set_sdram_partition(sdram_partition)[source]
class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonVariable(rates, starts, durations=None)

Bases: AbstractPyNNModel

absolute_max_atoms_per_core = 500
create_vertex(n_neurons, label, seed, splitter)[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

  • seed (float) –

  • splitter (AbstractSplitterCommon or None) –

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters = {'seed': None, 'splitter': None}
class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonVertex(n_neurons, label, seed, max_atoms_per_core, model, rate=None, start=None, duration=None, rates=None, starts=None, durations=None, max_rate=None, splitter=None, n_colour_bits=None)

Bases: PopulationApplicationVertex, LegacyPartitionerAPI, SupportsStructure

A Poisson Spike source object.

Parameters:
SPIKE_RECORDING_REGION_ID = 0
add_outgoing_projection(projection)[source]

Add an outgoing projection from this vertex.

Parameters:

projection (Projection) – The projection to add

property atoms_shape

The “shape” of the atoms in the vertex i.e. how the atoms are split between the dimensions of the vertex. By default everything is 1-dimensional, so the value will be a 1-tuple but can be overridden by a vertex that supports multiple dimensions.

Return type:

tuple(int, …)

clear_spike_recording()[source]
create_machine_vertex(vertex_slice, sdram, label=None)[source]

Create a machine vertex from this application vertex.

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover.

  • sdram (AbstractSDRAM) – The SDRAM used by the machine vertex.

  • label (str or None) – human readable label for the machine vertex

Returns:

The created machine vertex

Return type:

MachineVertex

property data
describe()[source]

Return a human-readable description of the cell or synapse type.

The output may be customised by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

Return type:

dict(str, …)

get_buffer_data_type(name)[source]

Get the type of data recorded by the buffer manager.

The buffer data type controls how data returned by the cores is handled in NeoBufferDatabase.

Parameters:

name (str) – The name of the variable recorded

Return type:

BufferDatabase

Raises:

KeyError – if the variable isn’t being recorded

get_data_type(name)[source]

Get the type data returned by a recording of the variable.

This is the type of data the C code is returning. For instance data such as spikes this will be None.

Parameters:

name (str) – The name of the variable to get the type of

Return type:

DataType or None

Raises:

KeyError – If the variable isn’t recordable

get_neurons_recording(name, vertex_slice)[source]

Gets the neurons being recorded on the core with this slice.

Typically vertex_slice.get_raster_ids(atoms_shape) but may be a sublist if doing selective recording.

Parameters:
  • name (str) – The name of the variable to get the region of

  • vertex_slice (Slice) –

Returns:

A list of the global raster IDs of the atoms in recording named variable within this slice

Return type:

list(int)

get_parameter_values(names, selector=None)[source]

Get the values of a parameter or parameters for the whole Population or a subset if the selector is used.

Parameters:
Return type:

ParameterHolder

Raises:

KeyError – if the parameter is not something that can be read

get_parameters()[source]

Get the names of all the parameters that can be obtained

Return type:

list(str)

get_recordable_variables()[source]

Get a list of the names and types of things that can be recorded.

This methods list the variable recorded via the Population.

Return type:

list(str)

get_recording_region(name)[source]

Gets the recording region for the named variable.

Parameters:

name (str) – The name of the variable to get the region of

Return type:

int

Raises:

KeyError – If the variable isn’t being recorded

get_recording_sdram_usage(vertex_slice)[source]
Parameters:

vertex_slice (Slice) –

get_recording_variables()[source]

Get a list of variables that are currently being recorded.

Return type:

list(str)

get_sampling_interval_ms(name)[source]

Get the sampling interval of the recording for the given variable.

The values is in ms and unless selective recording is used will be SpynnakerDataView.get_simulation_time_step_us()

Return type:

float

Raises:

KeyError – If the variable isn’t being recorded

get_sdram_used_by_atoms(vertex_slice)[source]

Get the separate SDRAM requirements for a range of atoms.

Parameters:
  • vertex_slice (Slice) – the low value of atoms to calculate resources from

  • vertex_slice

Return type:

AbstractSDRAM

get_units(name)[source]

Get the units of the given parameter or state variable.

Parameters:

name (str) – the name of the parameter to get the units of

Return type:

str

Raises:

KeyError – if the name isn’t recognised or the units cannot be identified

property incoming_control_edge
kiss_seed(vertex_slice)[source]
property max_n_rates
property max_rate
max_spikes_per_ts()[source]
property n_atoms

The number of atoms in the vertex.

Return type:

int

property n_colour_bits

The number of colour bits sent by this vertex.

Assumed 0 unless overridden

Return type:

int

property n_profile_samples
property outgoing_projections

The projections outgoing from this vertex.

Return type:

list(Projection)

property rates

Get the rates.

Return type:

spinn_utilities.ranged.RangedList

property seed
set_live_poisson_control_edge(edge)[source]
set_not_recording(name, indices=None)[source]

Set a variable not recording.

Parameters:
  • name (str) – The name of the variable to not record

  • indices (list(int) or None) – The list of neuron indices to not record or None for all

Raises:

KeyError – if the variable cannot be stopped from recording

set_parameter_values(name, value, selector=None)[source]

Set the values of a parameter for the whole Population or a subset if the selector is used.

Parameters:
Raises:

KeyError – if the parameter is not something that can be changed

set_recording(name, sampling_interval=None, indices=None)[source]

Set a variable recording.

Parameters:
  • name (str) – The name of the variable to set the status of

  • sampling_interval (float or None) – How often the variable should be recorded or None for every time step, in milliseconds

  • indices (list(int) or None) – The list of neuron indices to record or None for all

Raises:

KeyError – if the variable cannot be recorded

set_structure(structure)[source]

Set the structure of the object.

Parameters:

structure (BaseStructure) – The structure to set

property time_to_spike
update_kiss_seed(vertex_slice, seed)[source]

Updates a KISS seed from the machine.

Parameters:
  • vertex_slice (Slice) – the vertex slice to update seed of

  • seed (list(int)) – the seed