spynnaker.pyNN.models.common package

Submodules

spynnaker.pyNN.models.common.abstract_neuron_recordable module

class spynnaker.pyNN.models.common.abstract_neuron_recordable.AbstractNeuronRecordable[source]

Bases: object

Indicates that a variable (e.g., membrane voltage) can be recorded from this object

clear_recording(variable, buffer_manager, placements, graph_mapper)[source]

Clear the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

get_data(variable, n_machine_time_steps, placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded data

Parameters:
  • variable
  • n_machine_time_steps
  • placements
  • graph_mapper
  • buffer_manager
  • machine_time_step
Returns:

get_neuron_sampling_interval(variable)[source]

Returns the current sampling interval for this variable

Parameters:variable – PyNN name of the variable
Returns:Sampling interval in micro seconds
get_recordable_variables()[source]

Returns a list of the variables this models is expected to collect

is_recording(variable)[source]

Determines if variable is being recorded

Returns:True if variable are being recorded, False otherwise
Return type:bool
set_recording(variable, new_state=True, sampling_interval=None, indexes=None)[source]

Sets variable to being recorded

spynnaker.pyNN.models.common.abstract_spike_recordable module

class spynnaker.pyNN.models.common.abstract_spike_recordable.AbstractSpikeRecordable[source]

Bases: object

Indicates that spikes can be recorded from this object

clear_spike_recording(buffer_manager, placements, graph_mapper)[source]

Clear the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

get_spikes(placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded spikes from the object

Parameters:
  • placements – the placements object
  • graph_mapper – the graph mapper object
  • buffer_manager – the buffer manager object
  • machine_time_step – the time step of the simulation
Returns:

A numpy array of 2-element arrays of (neuron_id, time) ordered by time

get_spikes_sampling_interval()[source]

Return the current sampling interval for spikes

Returns:Sampling interval in micro seconds
is_recording_spikes()[source]

Determine if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
set_recording_spikes(new_state=True, sampling_interval=None, indexes=None)[source]

Set spikes to being recorded. If new_state is false all other parameters are ignored.

Parameters:
  • new_state (bool) – Set if the spikes are recording or not
  • sampling_interval – The interval at which spikes are recorded. Must be a whole multiple of the timestep None will be taken as the timestep
  • indexes – The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording

spynnaker.pyNN.models.common.eieio_spike_recorder module

class spynnaker.pyNN.models.common.eieio_spike_recorder.EIEIOSpikeRecorder[source]

Bases: object

Records spikes using EIEIO format

get_dtcm_usage_in_bytes()[source]
get_n_cpu_cycles(n_neurons)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, base_key_function, machine_time_step)[source]
record
set_recording(new_state, sampling_interval=None)[source]

spynnaker.pyNN.models.common.multi_spike_recorder module

class spynnaker.pyNN.models.common.multi_spike_recorder.MultiSpikeRecorder[source]

Bases: object

get_dtcm_usage_in_bytes()[source]
get_n_cpu_cycles(n_neurons)[source]
get_sdram_usage_in_bytes(n_neurons, spikes_per_timestep)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, machine_time_step)[source]
record

spynnaker.pyNN.models.common.neuron_recorder module

class spynnaker.pyNN.models.common.neuron_recorder.NeuronRecorder(allowed_variables, n_neurons)[source]

Bases: object

MAX_RATE = 4294967295
N_BYTES_FOR_TIMESTAMP = 4
N_BYTES_PER_INDEX = 1
N_BYTES_PER_POINTER = 4
N_BYTES_PER_RATE = 4
N_BYTES_PER_SIZE = 4
N_BYTES_PER_VALUE = 4
N_CPU_CYCLES_PER_NEURON = 8
SARK_BLOCK_SIZE = 8
check_indexes(indexes)[source]
get_buffered_sdram(variable, vertex_slice, n_machine_time_steps)[source]

Returns the SDRAM used for this may timesteps

If required the total is rounded up so the space will always fit

Parameters:
  • variable – The
  • vertex_slice
Returns:

get_buffered_sdram_per_record(variable, vertex_slice)[source]

Return the SDRAM used per record

Parameters:
  • variable
  • vertex_slice
Returns:

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

Parameters:
  • variable
  • vertex_slice
Returns:

get_data(vertex_slice)[source]
get_dtcm_usage_in_bytes(vertex_slice)[source]
get_global_parameters(vertex_slice)[source]
get_index_parameters(vertex_slice)[source]
get_matrix_data(label, buffer_manager, region, placements, graph_mapper, application_vertex, variable, n_machine_time_steps)[source]

Read a uint32 mapped to time and neuron IDs from the SpiNNaker machine.

Parameters:
  • label – vertex label
  • buffer_manager – the manager for buffered data
  • region – the DSG region ID used for this data
  • placements – the placements object
  • graph_mapper – the mapping between application and machine vertices
  • application_vertex
  • variable (str) – PyNN name for the variable (V, gsy_inh etc.)
  • n_machine_time_steps
Returns:

get_n_cpu_cycles(n_neurons)[source]
get_neuron_sampling_interval(variable)[source]

Return the current sampling interval for this variable

Parameters:variable – PyNN name of the variable
Returns:Sampling interval in micro seconds
get_recordable_variables()[source]
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

Parameters:vertex_slice
Returns:Highest possible overflow needed
get_sdram_usage_in_bytes(vertex_slice)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, machine_time_step)[source]
get_variable_sdram_usage(vertex_slice)[source]
is_recording(variable)[source]
recorded_ids_by_slice(vertex_slice)[source]
recorded_region_ids
recording_variables
set_recording(variable, new_state, sampling_interval=None, indexes=None)[source]

spynnaker.pyNN.models.common.recording_utils module

spynnaker.pyNN.models.common.recording_utils.get_buffer_sizes(buffer_max, space_needed, enable_buffered_recording)[source]
spynnaker.pyNN.models.common.recording_utils.get_data(transceiver, placement, region, region_size)[source]

Get the recorded data from a region

spynnaker.pyNN.models.common.recording_utils.get_recording_region_size_in_bytes(n_machine_time_steps, bytes_per_timestep)[source]

Get the size of a recording region in bytes

spynnaker.pyNN.models.common.recording_utils.make_missing_string(missing)[source]
spynnaker.pyNN.models.common.recording_utils.needs_buffering(buffer_max, space_needed, enable_buffered_recording)[source]
spynnaker.pyNN.models.common.recording_utils.pull_off_cached_lists(no_loads, cache_file)[source]

Extracts numpy based data from a file

Parameters:
  • no_loads – the number of numpy elements in the file
  • cache_file – the file to extract from
Returns:

The extracted data

spynnaker.pyNN.models.common.simple_population_settable module

class spynnaker.pyNN.models.common.simple_population_settable.SimplePopulationSettable[source]

Bases: spynnaker.pyNN.models.abstract_models.abstract_population_settable.AbstractPopulationSettable

An object all of whose properties can be accessed from a PyNN Population i.e. no properties are hidden

get_value(key)[source]

Get a property

set_value(key, value)[source]

Set a property

Parameters:
  • key – the name of the parameter to change
  • value – the new value of the parameter to assign

Module contents

class spynnaker.pyNN.models.common.AbstractNeuronRecordable[source]

Bases: object

Indicates that a variable (e.g., membrane voltage) can be recorded from this object

clear_recording(variable, buffer_manager, placements, graph_mapper)[source]

Clear the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

get_data(variable, n_machine_time_steps, placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded data

Parameters:
  • variable
  • n_machine_time_steps
  • placements
  • graph_mapper
  • buffer_manager
  • machine_time_step
Returns:

get_neuron_sampling_interval(variable)[source]

Returns the current sampling interval for this variable

Parameters:variable – PyNN name of the variable
Returns:Sampling interval in micro seconds
get_recordable_variables()[source]

Returns a list of the variables this models is expected to collect

is_recording(variable)[source]

Determines if variable is being recorded

Returns:True if variable are being recorded, False otherwise
Return type:bool
set_recording(variable, new_state=True, sampling_interval=None, indexes=None)[source]

Sets variable to being recorded

class spynnaker.pyNN.models.common.AbstractSpikeRecordable[source]

Bases: object

Indicates that spikes can be recorded from this object

clear_spike_recording(buffer_manager, placements, graph_mapper)[source]

Clear the recorded data from the object

Parameters:
  • buffer_manager – the buffer manager object
  • placements – the placements object
  • graph_mapper – the graph mapper object
Return type:

None

get_spikes(placements, graph_mapper, buffer_manager, machine_time_step)[source]

Get the recorded spikes from the object

Parameters:
  • placements – the placements object
  • graph_mapper – the graph mapper object
  • buffer_manager – the buffer manager object
  • machine_time_step – the time step of the simulation
Returns:

A numpy array of 2-element arrays of (neuron_id, time) ordered by time

get_spikes_sampling_interval()[source]

Return the current sampling interval for spikes

Returns:Sampling interval in micro seconds
is_recording_spikes()[source]

Determine if spikes are being recorded

Returns:True if spikes are being recorded, False otherwise
Return type:bool
set_recording_spikes(new_state=True, sampling_interval=None, indexes=None)[source]

Set spikes to being recorded. If new_state is false all other parameters are ignored.

Parameters:
  • new_state (bool) – Set if the spikes are recording or not
  • sampling_interval – The interval at which spikes are recorded. Must be a whole multiple of the timestep None will be taken as the timestep
  • indexes – The indexes of the neurons that will record spikes. If None the assumption is all neurons are recording
class spynnaker.pyNN.models.common.EIEIOSpikeRecorder[source]

Bases: object

Records spikes using EIEIO format

get_dtcm_usage_in_bytes()[source]
get_n_cpu_cycles(n_neurons)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, base_key_function, machine_time_step)[source]
record
set_recording(new_state, sampling_interval=None)[source]
class spynnaker.pyNN.models.common.NeuronRecorder(allowed_variables, n_neurons)[source]

Bases: object

MAX_RATE = 4294967295
N_BYTES_FOR_TIMESTAMP = 4
N_BYTES_PER_INDEX = 1
N_BYTES_PER_POINTER = 4
N_BYTES_PER_RATE = 4
N_BYTES_PER_SIZE = 4
N_BYTES_PER_VALUE = 4
N_CPU_CYCLES_PER_NEURON = 8
SARK_BLOCK_SIZE = 8
check_indexes(indexes)[source]
get_buffered_sdram(variable, vertex_slice, n_machine_time_steps)[source]

Returns the SDRAM used for this may timesteps

If required the total is rounded up so the space will always fit

Parameters:
  • variable – The
  • vertex_slice
Returns:

get_buffered_sdram_per_record(variable, vertex_slice)[source]

Return the SDRAM used per record

Parameters:
  • variable
  • vertex_slice
Returns:

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

Parameters:
  • variable
  • vertex_slice
Returns:

get_data(vertex_slice)[source]
get_dtcm_usage_in_bytes(vertex_slice)[source]
get_global_parameters(vertex_slice)[source]
get_index_parameters(vertex_slice)[source]
get_matrix_data(label, buffer_manager, region, placements, graph_mapper, application_vertex, variable, n_machine_time_steps)[source]

Read a uint32 mapped to time and neuron IDs from the SpiNNaker machine.

Parameters:
  • label – vertex label
  • buffer_manager – the manager for buffered data
  • region – the DSG region ID used for this data
  • placements – the placements object
  • graph_mapper – the mapping between application and machine vertices
  • application_vertex
  • variable (str) – PyNN name for the variable (V, gsy_inh etc.)
  • n_machine_time_steps
Returns:

get_n_cpu_cycles(n_neurons)[source]
get_neuron_sampling_interval(variable)[source]

Return the current sampling interval for this variable

Parameters:variable – PyNN name of the variable
Returns:Sampling interval in micro seconds
get_recordable_variables()[source]
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

Parameters:vertex_slice
Returns:Highest possible overflow needed
get_sdram_usage_in_bytes(vertex_slice)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, machine_time_step)[source]
get_variable_sdram_usage(vertex_slice)[source]
is_recording(variable)[source]
recorded_ids_by_slice(vertex_slice)[source]
recorded_region_ids
recording_variables
set_recording(variable, new_state, sampling_interval=None, indexes=None)[source]
class spynnaker.pyNN.models.common.MultiSpikeRecorder[source]

Bases: object

get_dtcm_usage_in_bytes()[source]
get_n_cpu_cycles(n_neurons)[source]
get_sdram_usage_in_bytes(n_neurons, spikes_per_timestep)[source]
get_spikes(label, buffer_manager, region, placements, graph_mapper, application_vertex, machine_time_step)[source]
record
class spynnaker.pyNN.models.common.SimplePopulationSettable[source]

Bases: spynnaker.pyNN.models.abstract_models.abstract_population_settable.AbstractPopulationSettable

An object all of whose properties can be accessed from a PyNN Population i.e. no properties are hidden

get_value(key)[source]

Get a property

set_value(key, value)[source]

Set a property

Parameters:
  • key – the name of the parameter to change
  • value – the new value of the parameter to assign
spynnaker.pyNN.models.common.get_buffer_sizes(buffer_max, space_needed, enable_buffered_recording)[source]
spynnaker.pyNN.models.common.get_data(transceiver, placement, region, region_size)[source]

Get the recorded data from a region

spynnaker.pyNN.models.common.needs_buffering(buffer_max, space_needed, enable_buffered_recording)[source]
spynnaker.pyNN.models.common.get_recording_region_size_in_bytes(n_machine_time_steps, bytes_per_timestep)[source]

Get the size of a recording region in bytes

spynnaker.pyNN.models.common.pull_off_cached_lists(no_loads, cache_file)[source]

Extracts numpy based data from a file

Parameters:
  • no_loads – the number of numpy elements in the file
  • cache_file – the file to extract from
Returns:

The extracted data