spynnaker.pyNN.models.common package¶
Submodules¶
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.is_param_generatable(value)[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_params(values)[source]¶
Get the parameter generator parameters as a numpy array.
- Parameters:
values (int or RandomDistribution) –
- Return type:
- spynnaker.pyNN.models.common.param_generator_data.param_generator_params_size_in_bytes(values)[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¶
Module contents¶
- class spynnaker.pyNN.models.common.EIEIOSpikeRecorder¶
Bases:
object
Records spikes using EIEIO format.
- class spynnaker.pyNN.models.common.MultiSpikeRecorder¶
Bases:
object
- class spynnaker.pyNN.models.common.NeuronRecorder(allowed_variables, data_types, bitfield_variables, n_neurons, per_timestep_variables, per_timestep_datatypes, events_per_core_variables, events_per_core_datatypes)¶
Bases:
object
- Parameters:
- MAX_REWIRES = 'max_rewires'¶
- PACKETS = 'packets-per-timestep'¶
- PACKETS_TYPE = 2¶
- REWIRING = 'rewiring'¶
- REWIRING_TYPE = 2¶
- SPIKES = 'spikes'¶
- add_region_offset(offset)[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_buffered_sdram(variable, vertex_slice)[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_timestep(variable, vertex_slice)[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_generator_data(vertex_slice=None)[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)[source]¶
Get the SDRAM usage of the generator data for recording metadata.
- get_metadata_sdram_usage_in_bytes(n_atoms)[source]¶
Get the SDRAM usage of the metadata for recording.
- get_recorded_indices(application_vertex, variable)[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:
- get_region_sizes(vertex_slice)[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)[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
- property is_global_generatable¶
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)[source]¶
- Parameters:
max_rewires_per_ts (int) – the maximum rewires per timestep
- class spynnaker.pyNN.models.common.ParameterHolder(data_items_to_return, get_call, selector=None)¶
Bases:
object
Holds 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=None)->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
,HasCustomAtomKeyMap
A 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¶
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, partition_id, routing_info)[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)[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, selector=None)[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)[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, selector=None)[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, 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.
- 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:
- Raises:
KeyError – if the parameter is not something that can be read
- 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.
- 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()
- inject(current_source, selector=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
None
for all. See:selector_to_ids()
- Raises:
ConfigurationException – if the population doesn’t support injection
- property n_colour_bits¶
The number of colour bits sent by this vertex.
Assumed 0 unless overridden
- Return type:
- set_current_state_values(name, value, selector=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, value, selector=None)[source]¶
Set the initial values of a state variable for the whole Population or a subset if the selector is used.
- 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.