spynnaker.pyNN.models.common package¶
Submodules¶
spynnaker.pyNN.models.common.local_only_2d_common module¶
- spynnaker.pyNN.models.common.local_only_2d_common.BITS_PER_BYTE = 8¶
The number of bits in a byte value
- spynnaker.pyNN.models.common.local_only_2d_common.BITS_PER_SHORT = 16¶
The number of bits in a short value
- spynnaker.pyNN.models.common.local_only_2d_common.KEY_INFO_SIZE = 16¶
Key info size in bytes
- spynnaker.pyNN.models.common.local_only_2d_common.N_COLOUR_BITS_BITS = 3¶
The number of bits to represent n_colour_bits
- class spynnaker.pyNN.models.common.local_only_2d_common.Source(projection, local_delay, delay_stage)¶
Bases:
tupleA source
- delay_stage¶
Alias for field number 2
- local_delay¶
Alias for field number 1
- projection¶
Alias for field number 0
- spynnaker.pyNN.models.common.local_only_2d_common.get_delay_for_source(incoming)[source]¶
- Get the vertex which will send data from a given source projection,
along with the delay stage and locally-handled delay value
- Parameters:
incoming (Projection) – The incoming projection to get the delay from
- Returns:
The vertex, the local delay, the delay stage
- Return type:
- spynnaker.pyNN.models.common.local_only_2d_common.get_div_const(value)[source]¶
Get the values used to perform fast division by an integer constant
- spynnaker.pyNN.models.common.local_only_2d_common.get_first_and_last_slice(pre_vertex)[source]¶
Get the first and last slice of an application vertex.
- spynnaker.pyNN.models.common.local_only_2d_common.get_rinfo_for_spike_source(pre_vertex)[source]¶
Get the routing information for the source of a projection in the SPIKE_PARTITION_ID partition.
- spynnaker.pyNN.models.common.local_only_2d_common.get_sources_for_target(app_vertex)[source]¶
Get all the application vertex sources that will hit the given application vertex.
- Parameters:
app_vertex (AbstractPopulationVertex) – The vertex being targeted
- Returns:
A dict of source ApplicationVertex to list of source information
- Return type:
spynnaker.pyNN.models.common.param_generator_data module¶
- spynnaker.pyNN.models.common.param_generator_data.MAX_PARAMS_BYTES = 16¶
At most, there are 4 words as param generator parameters
- spynnaker.pyNN.models.common.param_generator_data.PARAM_TYPE_BY_NAME = {'exponential': 5, 'exponential_clipped': 6, 'normal': 2, 'normal_clipped': 3, 'normal_clipped_to_boundary': 4, 'uniform': 1, 'uniform_int': 1}¶
IDs of the random parameter generators supported by the synapse expander.
- spynnaker.pyNN.models.common.param_generator_data.PARAM_TYPE_CONSTANT_ID = 0¶
ID of the constant parameter generator.
- spynnaker.pyNN.models.common.param_generator_data.get_generator_type(data_type: DataType) int[source]¶
- spynnaker.pyNN.models.common.param_generator_data.is_param_generatable(value: Any) bool[source]¶
- Parameters:
value – The value to examine the type of.
- Returns:
Whether the value is of a type that can be generated on chip.
- Return type:
- spynnaker.pyNN.models.common.param_generator_data.param_generator_id(value: int | float | RandomDistribution) int[source]¶
- spynnaker.pyNN.models.common.param_generator_data.param_generator_params(values: int | float | RandomDistribution) ndarray[Any, dtype[uint32]][source]¶
Get the parameter generator parameters as a numpy array.
- Parameters:
values (float or RandomDistribution)
- Return type:
- spynnaker.pyNN.models.common.param_generator_data.param_generator_params_size_in_bytes(values: int | float | RandomDistribution) int[source]¶
Get the size of the parameter generator parameters in bytes.
- Parameters:
values (int or RandomDistribution)
- Return type:
- Raises:
TypeError – If values is of an unsupported data type
spynnaker.pyNN.models.common.recording_utils module¶
spynnaker.pyNN.models.common.types module¶
- spynnaker.pyNN.models.common.types.Names¶
Type of names of parameters and state variables.
Module contents¶
- class spynnaker.pyNN.models.common.EIEIOSpikeRecorder¶
Bases:
objectRecords spikes using EIEIO format.
- class spynnaker.pyNN.models.common.MultiSpikeRecorder¶
Bases:
objectSupport for recording more than one spike per timestep.
- class spynnaker.pyNN.models.common.NeuronRecorder(allowed_variables: List[str], data_types: Mapping[str, DataType], bitfield_variables: Sequence[str], n_neurons: int, per_timestep_variables: Sequence[str], per_timestep_datatypes: Mapping[str, DataType], events_per_core_variables: Sequence[str], events_per_core_datatypes: Mapping[str, DataType])¶
Bases:
objectMethods related to recording of neuron data.
- Parameters:
- MAX_REWIRES = 'max_rewires'¶
- PACKETS = 'packets-per-timestep'¶
- PACKETS_TYPE = 2¶
- REWIRING = 'rewiring'¶
- REWIRING_TYPE = 2¶
- SPIKES = 'spikes'¶
- add_region_offset(offset: int)[source]¶
Add an offset to the regions. Used when there are multiple recorders on a single core.
- Parameters:
offset (int) – The offset to add
- get_buffer_data_type(variable: str) BufferDataType[source]¶
- Parameters:
variable (str)
- Return type:
- get_buffered_sdram(variable: str, vertex_slice: Slice) int[source]¶
Returns the SDRAM used for this many time steps for a variable.
If required the total is rounded up so the space will always fit.
- get_buffered_sdram_per_record(variable: str, vertex_slice: Slice) int[source]¶
Return the SDRAM used per record.
- get_buffered_sdram_per_timestep(variable: str, vertex_slice: Slice) int[source]¶
Return the SDRAM used per timestep.
In the case where sampling is used it returns the average for recording and none recording based on the recording rate
- get_data_type(variable: str) DataType | None[source]¶
- Parameters:
variable (str)
- Return type:
DataType
- get_generator_data(vertex_slice: Slice | None = None) ndarray[Any, dtype[uint32]][source]¶
Get the recorded data as a generatable data set.
- Parameters:
vertex_slice (Slice or None) – The slice to generate the data for, or None to generate for all neurons (assuming all the same, otherwise error)
- Return type:
- get_generator_sdram_usage_in_bytes(n_atoms: int) int[source]¶
Get the SDRAM usage of the generator data for recording metadata.
- get_max_buffered_sdram_per_record(variable: str, n_atoms: int) int[source]¶
Return the SDRAM used per record.
- get_max_variable_sdram_usage(n_atoms: int) AbstractSDRAM[source]¶
- Parameters:
vertex_slice (Slice)
- Return type:
- get_metadata_sdram_usage_in_bytes(n_atoms: int) int[source]¶
Get the SDRAM usage of the metadata for recording.
- get_recorded_indices(application_vertex: ApplicationVertex, variable: str) Iterable[int][source]¶
Get the indices being recorded for a given variable.
- Parameters:
application_vertex (ApplicationVertex) – The vertex being recorded
variable (str) – The name of the variable to get the indices of
- Return type:
iterable(int)
- get_region_sizes(vertex_slice: Slice) List[int][source]¶
Get the sizes of the regions for the variables, whether they are recorded or not, with those that are not having a size of 0.
- get_sampling_overflow_sdram(vertex_slice: Slice) int[source]¶
Get the extra SDRAM that should be reserved if using per_timestep.
This is the extra that must be reserved if per_timestep is an average rather than fixed for every timestep.
When sampling the average * time_steps may not be quite enough. This returns the extra space in the worst case where time_steps is a multiple of sampling rate + 1, and recording is done in the first and last time_step
- get_variable_sdram_usage(vertex_slice: Slice) AbstractSDRAM[source]¶
- Parameters:
vertex_slice (Slice)
- Return type:
- property is_global_generatable: bool¶
Whether the data for all neurons the same, i.e., all or none of the neurons are recorded for all variables.
- Return type:
- set_max_rewires_per_ts(max_rewires_per_ts: int)[source]¶
- Parameters:
max_rewires_per_ts (int) – the maximum rewires per timestep
- set_recording(variable: str, new_state: bool, sampling_interval: float | None = None, indexes: Collection[int] | None = None)[source]¶
- class spynnaker.pyNN.models.common.ParameterHolder(data_items_to_return: str | Iterable[str], get_call: Callable[[str, None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt]], List[int] | List[float] | RandomDistribution], selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None)¶
Bases:
objectHolds a set of parameters and state variables to be returned in a PyNN-specific format.
- Parameters:
data_items_to_return (list(str) or tuple(str)) – A list of data fields to be returned
get_call (callable(str, selector)->list) – A function to call to read a value
selector (None or slice or int or list(bool) or list(int)) – a description of the subrange to accept, or None for all. See:
selector_to_ids()
- class spynnaker.pyNN.models.common.PopulationApplicationVertex(label: str | None = None, max_atoms_per_core: int | Tuple[int, ...] | None = None, splitter: AbstractSplitterCommon[Self] | None = None)¶
Bases:
ApplicationVertex,HasCustomAtomKeyMapA vertex that can be used in a Population.
Provides some default functions that can be overridden if the vertex supports these.
- Parameters:
label (str) – The optional name of the vertex.
max_atoms_per_core (None or int or tuple(int,...)) – The max number of atoms that can be placed on a core for each dimension, used in partitioning. If the vertex is n-dimensional, with n > 1, the value must be a tuple with a value for each dimension. If it is single-dimensional the value can be a 1-tuple or an int.
splitter (None or AbstractSplitterCommon) – The splitter object needed for this vertex. Leave as None to delegate the choice of splitter to the selector.
- property conductance_based: bool¶
Whether the vertex models post-synaptic inputs as currents or conductance.
By default this is False; override if the model accepts conductance based input.
- Return type:
- get_atom_key_map(pre_vertex: MachineVertex, partition_id: str, routing_info: RoutingInfo) Iterable[Tuple[int, int]][source]¶
Get the mapping between atoms and keys for the given partition id, and for the given machine pre-vertex.
- Parameters:
pre_vertex (MachineVertex) – The machine vertex to get the map for
partition_id (str) – The partition to get the map for
routing_info (RoutingInfo) – Routing information
- Returns:
A list of (atom_id, key)
- Return type:
- 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_current_state_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 current values of a state variable for the whole Population or a subset if the selector is used.
- Parameters:
- Return type:
- Raises:
KeyError – if the variable is not something that can be read
- get_data_type(name: str) DataType | 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_initial_state_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 initial values of a state variable for the whole Population or a subset if the selector is used.
- Parameters:
- Return type:
- Raises:
KeyError – if the variable is not something that can be read
- get_neurons_recording(name: str, vertex_slice: Slice) Collection[int] | None[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()
- inject(current_source: AbstractCurrentSource, selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None)[source]¶
Inject a current source into this population.
- Parameters:
current_source (AbstractCurrentSource) – the current source to be injected
selector (None or slice or int or list(bool) or list(int)) – a description of the subrange to accept, or
Nonefor all. See:selector_to_ids()
- Raises:
ConfigurationException – if the population doesn’t support injection
- property n_colour_bits: int¶
The number of colour bits sent by this vertex.
Assumed 0 unless overridden
- Return type:
- set_current_state_values(name: str, value: float | Sequence[float] | ndarray[Any, dtype[floating]] | RandomDistribution, selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None)[source]¶
Set the current values of a state variable for the whole Population or a subset if the selector is used.
- set_initial_state_values(name: str, value: float | Sequence[float] | ndarray[Any, dtype[floating]] | RandomDistribution, selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None)[source]¶
Set the initial values of a state variable for the whole Population or a subset if the selector is used.
- set_not_recording(name: str, indices: Collection[int] | None = None)[source]¶
Set a variable not recording.
- set_parameter_values(name: str, value: float | Sequence[float] | ndarray[Any, dtype[floating]] | RandomDistribution, selector: None | int | integer | SupportsInt | slice | Sequence[bool | bool] | Sequence[int | integer | SupportsInt] = None)[source]¶
Set the values of a parameter for the whole Population or a subset if the selector is used.