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
Module contents¶
- class spynnaker.pyNN.models.spike_source.SpikeSourceArray(spike_times: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating]] | RandomDistribution | int | Sequence[int] | Sequence[Sequence[int]] | ndarray[tuple[int, ...], dtype[integer]] | None = None)¶
Bases:
AbstractPyNNModel
Model that creates a Spike Source Array Vertex
- create_vertex(n_neurons: int, label: str, *, splitter: AbstractSplitterCommon | None = None, n_colour_bits: int | None = None) SpikeSourceArrayVertex [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:
- class spynnaker.pyNN.models.spike_source.SpikeSourceArrayVertex(n_neurons: int, spike_times: Spikes, label: str, max_atoms_per_core: int | Tuple[int, ...], model: SpikeSourceArray, splitter: AbstractSplitterCommon | None, n_colour_bits: int | None)¶
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)
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.
- create_machine_vertex(vertex_slice: Slice, sdram: AbstractSDRAM, label: str | None = None) SpikeSourceArrayMachineVertex [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:
- describe() Dict[str, str | ParameterHolder | Dict[str, Any]] [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.
- 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.
- get_neurons_recording(name: str, vertex_slice: Slice) ndarray[tuple[int, ...], 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.
- get_parameter_values(names: str | List[str] | Tuple[str, ...], selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None) ParameterHolder [source]¶
Get the values of a parameter or parameters for the whole Population or a subset if the selector is used.
- Parameters:
- Return type:
- Raises:
KeyError – if the parameter is not something that can be read
- 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.
- get_recording_variables() List[str] [source]¶
Get a list of variables that are currently being recorded.
- 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()
- property n_colour_bits: int¶
The number of colour bits sent by this vertex.
Assumed 0 unless overridden
- Return type:
- set_not_recording(name: str, indices: Collection[int] | None = None) None [source]¶
Set a variable not recording.
- set_parameter_values(name: str, value: float | Sequence[float] | ndarray[tuple[int, ...], dtype[floating]] | RandomDistribution | int | Sequence[int] | Sequence[Sequence[int]] | ndarray[tuple[int, ...], dtype[integer]], selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None) None [source]¶
Set the values of a parameter for the whole Population or a subset if the selector is used.
- set_recording(name: str, sampling_interval: float | None = None, indices: Collection[int] | None = None) None [source]¶
Set a variable recording.
- Parameters:
- Raises:
KeyError – if the variable cannot be recorded
- set_structure(structure: BaseStructure) None [source]¶
Set the structure of the object.
- Parameters:
structure (BaseStructure) – The structure to set
- class spynnaker.pyNN.models.spike_source.SpikeSourceFromFile(spike_time_file: str, min_atom: float = 0.0, max_atom: float = inf, min_time: float = 0.0, max_time: float = inf, split_value: str = '\t')¶
Bases:
SpikeSourceArray
A spike source that works from a file (typically a tab-separated table in a text file).
- class spynnaker.pyNN.models.spike_source.SpikeSourcePoisson(rate: float | Sequence[float] = 0.0, start: int | Sequence[int] = 0, duration: int | Sequence[int] | None = None)¶
Bases:
AbstractPyNNModel
A model of a Poisson-distributed source of spikes.
- absolute_max_atoms_per_core = 500¶
- create_vertex(n_neurons: int, label: str, *, seed: int | None = None, max_rate: float | None = None, splitter: AbstractSplitterCommon | None = None, n_colour_bits: int | None = None) SpikeSourcePoissonVertex [source]¶
Create a vertex for a population of the model.
- Parameters:
- Returns:
An application vertex for the population
- Return type:
- default_population_parameters: Dict[str, Any] = {'max_rate': None, 'n_colour_bits': None, 'seed': None, 'splitter': 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.
- class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonMachineVertex(sdram: AbstractSDRAM, is_recording: bool, label: str | None, app_vertex: SpikeSourcePoissonVertex, vertex_slice: Slice)¶
Bases:
MachineVertex
,AbstractReceiveBuffersToHost
,ProvidesProvenanceDataFromMachineImpl
,AbstractHasProfileData
,AbstractHasAssociatedBinary
,AbstractRewritesDataSpecification
,AbstractGeneratesDataSpecification
,SendsSynapticInputsOverSDRAM
Vertex that implements a Poisson-distributed spike source.
- 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¶
- 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: DataSpecificationGenerator, placement: Placement) None [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_start_type() ExecutableType [source]¶
Get the start type of the binary to be run.
- Return type:
ExecutableType
- get_n_keys_for_partition(partition_id: str) int [source]¶
Get the number of keys required by the given partition of edges.
- get_profile_data(placement: Placement) ProfileData [source]¶
Get the profile data recorded during simulation.
- Parameters:
placement (Placement)
- Return type:
- get_recorded_region_ids() List[int] [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: Placement) int [source]¶
Get the recording region base address.
- parse_extra_provenance_items(label: str, x: int, y: int, p: int, provenance_data: Sequence[int]) None [source]¶
Convert the remaining provenance words (those not in the standard set) into provenance items.
Called by
get_provenance_data_from_machine()
- Parameters:
label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.
x (int) – x coordinate of the chip where this core
y (int) – y coordinate of the core where this core
p (int) – virtual id of the core
provenance_data (list(int)) – The list of words of raw provenance data.
- read_connections(synapse_info: SynapseInformation) ConnectionsArray [source]¶
Read the connections from the machine.
- Parameters:
synapse_info (SynapseInformation) – The synapse information being read
- Returns:
The connections read back
- read_parameters_from_machine(placement: Placement) None [source]¶
Reads the poisson rates of the machine if they could have changed.
- Parameters:
placement (Placement)
- regenerate_data_specification(spec: DataSpecificationReloader, placement: Placement) None [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?
- property sdram_required: AbstractSDRAM¶
The SDRAM space required by the vertex.
- Return type:
- sdram_requirement(sdram_machine_edge: SDRAMMachineEdge) int [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)
- class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonVariable(rates: Sequence[float] | ndarray[tuple[int, ...], dtype[floating]] | None, starts: Sequence[int] | ndarray[tuple[int, ...], dtype[integer]], durations: Sequence[int] | ndarray[tuple[int, ...], dtype[integer]] | None = None)¶
Bases:
AbstractPyNNModel
Model to create a Spike Source Poisson Vertex.
- absolute_max_atoms_per_core = 500¶
- create_vertex(n_neurons: int, label: str, *, seed: int | None = None, splitter: AbstractSplitterCommon | None = None) SpikeSourcePoissonVertex [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:
- class spynnaker.pyNN.models.spike_source.SpikeSourcePoissonVertex(n_neurons: int, label: str, seed: int | None, max_atoms_per_core: int | Tuple[int, ...] | None, model: SpikeSourcePoisson | SpikeSourcePoissonVariable, rate: float | Sequence[float] | None = None, start: int | Sequence[int] | None = None, duration: int | Sequence[int] | None = None, rates: Sequence[float] | NDArray[numpy.floating] | None = None, starts: Sequence[int] | NDArray[numpy.integer] | None = None, durations: Sequence[int] | NDArray[numpy.integer] | None = None, max_rate: float | None = None, splitter: AbstractSplitterCommon | None = None, n_colour_bits: int | None = None)¶
Bases:
PopulationApplicationVertex
,LegacyPartitionerAPI
,SupportsStructure
A SpiNNaker vertex that is a Poisson-distributed Spike source.
- Parameters:
- SPIKE_RECORDING_REGION_ID = 0¶
- add_outgoing_projection(projection: Projection) None [source]¶
Add an outgoing projection from this vertex.
- Parameters:
projection (Projection) – The projection to add
- 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.
- clear_spike_recording() None [source]¶
Clears the spike data from the buffer manager for this vertex.
- create_machine_vertex(vertex_slice: Slice, sdram: AbstractSDRAM, label: str | None = None) SpikeSourcePoissonMachineVertex [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:
- property data: RangeDictionary[ndarray[tuple[int, ...], dtype[floating]] | ndarray[tuple[int, ...], dtype[integer]]]¶
A dictionary holding all the data as ranges
- Return type:
RangeDictionary
- describe() Dict[str, str | ParameterHolder | Dict[str, Any]] [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.
- 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.
- 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.
- get_neurons_recording(name: str, vertex_slice: Slice) ndarray[tuple[int, ...], dtype[_ScalarType_co]] [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.
- get_parameter_values(names: Names, selector: Selector = None) ParameterHolder [source]¶
Get the values of a parameter or parameters for the whole Population or a subset if the selector is used.
- Parameters:
- Return type:
- Raises:
KeyError – if the parameter is not something that can be read
- 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.
- get_recording_sdram_usage(vertex_slice: Slice) AbstractSDRAM [source]¶
- Parameters:
vertex_slice (Slice)
- Return type:
- get_recording_variables() List[str] [source]¶
Get a list of variables that are currently being recorded.
- get_sampling_interval_ms(name: str) int [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()
- get_sdram_used_by_atoms(vertex_slice: Slice) AbstractSDRAM [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:
- property incoming_control_edge: ApplicationEdge | None¶
The live poisson control edge/ generator is set
- Return type:
ApplicationEdg or None
- kiss_seed(vertex_slice: Slice) Tuple[int, ...] [source]¶
The seed for this vertex slice.
Generates and checks that the seed values generated by the given random number generator or seed to a random number generator are suitable for use as a mars 64 kiss seed.
- max_spikes_per_ts() float [source]¶
Compute the maximum spike rate.
- Returns:
The maximum number of spikes per simulation timestep.
- Return type:
- property n_colour_bits: int¶
The number of colour bits sent by this vertex.
Assumed 0 unless overridden
- Return type:
- property outgoing_projections: Sequence[Projection]¶
The projections outgoing from this vertex.
- Return type:
- read_connections(synapse_info: SynapseInformation) List[ConnectionsArray] [source]¶
Read Poisson connections from the machine
- Parameters:
synapse_info (SynapseInformation) – The synapse information of the data being read
- Returns:
The set of connections from all machine vertices
- set_live_poisson_control_edge(edge: ApplicationEdge) None [source]¶
Sets the poisson generator.
- Parameters:
edge (ApplicationEdge)
- Raises:
ValueError – if already set
- set_not_recording(name: str, indices: Collection[int] | None = None) None [source]¶
Set a variable not recording.
- set_parameter_values(name: str, value: Values, selector: Selector = None) None [source]¶
Set the values of a parameter for the whole Population or a subset if the selector is used.
- set_recording(name: str, sampling_interval: float | None = None, indices: Collection[int] | None = None) None [source]¶
Set a variable recording.
- Parameters:
- Raises:
KeyError – if the variable cannot be recorded
- set_structure(structure: BaseStructure) None [source]¶
Set the structure of the object.
- Parameters:
structure (BaseStructure) – The structure to set
- property time_to_spike: RangedList¶
The “time_to_spike range list.
- Return type:
RangedList