spynnaker.pyNN.models.utility_models.spike_injector package

Submodules

spynnaker.pyNN.models.utility_models.spike_injector.spike_injector_vertex module

class spynnaker.pyNN.models.utility_models.spike_injector.spike_injector_vertex.SpikeInjectorVertex(n_neurons: int, label: str, port: int | None, virtual_key: int | None, reserve_reverse_ip_tag: bool, splitter: AbstractSplitterCommon | None, max_atoms_per_core: int | Tuple[int, ...] | None = 9223372036854775807)[source]

Bases: ReverseIpTagMultiCastSource, PopulationApplicationVertex, SupportsStructure

An Injector of Spikes for PyNN populations. This only allows the user to specify the virtual_key of the population to identify the population.

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)

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

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

SPIKE_RECORDING_REGION_ID = 0
property atoms_shape: Tuple[int, ...]

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, …)

default_parameters = {'label': 'spikeInjector', 'port': None, 'virtual_key': None}
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: str) BufferDataType[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: str) None[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: str, vertex_slice: Slice) ndarray[Any, dtype[integer]][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_recordable_variables() List[str][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: str) int[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() List[str][source]

Get a list of variables that are currently being recorded.

Return type:

list(str)

get_sampling_interval_ms(name: str) float[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: str) str[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

set_not_recording(name: str, indices: Collection[int] | None = 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_recording(name: str, sampling_interval: float | None = None, indices: Collection[int] | None = 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: BaseStructure)[source]

Set the structure of the object.

Parameters:

structure (BaseStructure) – The structure to set

Module contents

class spynnaker.pyNN.models.utility_models.spike_injector.SpikeInjector

Bases: AbstractPyNNModel

Model that creates a Spike Injector Vertex

create_vertex(n_neurons: int, label: str, *, port: int | None = None, virtual_key: int | None = None, reserve_reverse_ip_tag: bool = False, splitter: AbstractSplitterCommon | None = None) SpikeInjectorVertex[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

  • port (int)

  • virtual_key (int)

  • reserve_reverse_ip_tag (bool)

  • splitter (AbstractSplitterCommon or None)

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters: Dict[str, Any] = {'port': None, 'reserve_reverse_ip_tag': False, 'splitter': None, 'virtual_key': None}

The default values for the parameters at the population level. These are parameters that can be passed in to the Population constructor in addition to the standard PyNN options.