spynnaker.pyNN.models.neuron.implementations package

Submodules

spynnaker.pyNN.models.neuron.implementations.abstract_neuron_impl module

class spynnaker.pyNN.models.neuron.implementations.abstract_neuron_impl.AbstractNeuronImpl[source]

Bases: object

An abstraction of a whole neuron model including all parts

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
binary_name

The name of the binary executable of this implementation

:rtype str

get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_global_weight_scale()[source]

Get the weight scaling required by this model

Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_n_synapse_types()[source]

Get the number of synapse types supported by the model

Return type:int
get_recordable_units(variable)[source]

Get the units of the given variable that can be recorded

Parameters:variable (str) – The name of the variable
get_recordable_variable_index(variable)[source]

Get the index of the variable in the list of variables that can be recorded

Parameters:variable (str) – The name of the variable
Return type:int
get_recordable_variables()[source]

Get the names of the variables that can be recorded in this model

Return type:list of str
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_synapse_id_by_target(target)[source]

Get the id of a synapse given the name

Parameters:target (str) – The name of the synapse
Return type:int
get_synapse_targets()[source]

Get the target names of the synapse type

Return type:array of str
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
is_conductance_based

Determine if the model uses conductance

Return type:bool
is_recordable(variable)[source]

Determine if the given variable can be recorded

Parameters:variable (str) – The name of the variable being requested
Return type:bool
model_name

The name of the model

Return type:str
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update

spynnaker.pyNN.models.neuron.implementations.abstract_standard_neuron_component module

class spynnaker.pyNN.models.neuron.implementations.abstract_standard_neuron_component.AbstractStandardNeuronComponent(data_types)[source]

Bases: object

Represents a component of a standard neural model

Parameters:data_types – A list of data types in the component structure, in the order that they appear
add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
get_values(parameters, state_variables, vertex_slice)[source]

Get the values to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of variables being retrieved
Returns:

A list with the same length as self.struct.field_types

Return type:

A list of (single value or list of values or RangedList)

has_variable(variable)[source]

Determine if this component has a variable by the given name

Parameters:variable (str) – The name of the variable
Return type:bool
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update
Returns:

The offset after reading the data

struct

The structure of the component

Return type::py:class:’spynnaker.pyNN.models.neuron.implementations.struct.Struct’
update_values(values, parameters, state_variables)[source]

Update the parameters and state variables with the given struct values that have been read from the machine

Parameters:
  • values – The values read from the machine, one for each struct element
  • parameters – The holder of the parameters to update
  • state_variables – The holder of the state variables to update

spynnaker.pyNN.models.neuron.implementations.neuron_impl_standard module

class spynnaker.pyNN.models.neuron.implementations.neuron_impl_standard.NeuronImplStandard(model_name, binary, neuron_model, input_type, synapse_type, threshold_type, additional_input_type=None)[source]

Bases: spynnaker.pyNN.models.neuron.implementations.abstract_neuron_impl.AbstractNeuronImpl

The standard neuron implementation, consisting of various components

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
binary_name

The name of the binary executable of this implementation

:rtype str

get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_global_weight_scale()[source]

Get the weight scaling required by this model

Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_n_synapse_types()[source]

Get the number of synapse types supported by the model

Return type:int
get_recordable_units(variable)[source]

Get the units of the given variable that can be recorded

Parameters:variable (str) – The name of the variable
get_recordable_variable_index(variable)[source]

Get the index of the variable in the list of variables that can be recorded

Parameters:variable (str) – The name of the variable
Return type:int
get_recordable_variables()[source]

Get the names of the variables that can be recorded in this model

Return type:list of str
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_synapse_id_by_target(target)[source]

Get the id of a synapse given the name

Parameters:target (str) – The name of the synapse
Return type:int
get_synapse_targets()[source]

Get the target names of the synapse type

Return type:array of str
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
is_conductance_based

Determine if the model uses conductance

Return type:bool
is_recordable(variable)[source]

Determine if the given variable can be recorded

Parameters:variable (str) – The name of the variable being requested
Return type:bool
model_name

The name of the model

Return type:str
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update

spynnaker.pyNN.models.neuron.implementations.ranged_dict_vertex_slice module

class spynnaker.pyNN.models.neuron.implementations.ranged_dict_vertex_slice.RangedDictVertexSlice(ranged_dict, vertex_slice)[source]

Bases: object

A slice of a ranged dict to be used to update values

spynnaker.pyNN.models.neuron.implementations.struct module

class spynnaker.pyNN.models.neuron.implementations.struct.Struct(field_types)[source]

Bases: object

Represents a C code structure

Parameters:field_types (list of data_specification.enums.data_type.DataType) – The types of the fields, ordered as they appear in the struct
field_types

The types of the fields, ordered as they appear in the struct

Return type:list of data_specification.enums.data_type.DataType
get_data(values, offset=0, array_size=1)[source]

Get a numpy array of uint32 of data for the given values

Parameters:
  • values (list of (single value or list of values or RangedList of values)) – A list of values with length the same size as the number of fields returned by field_types
  • offset – The offset into each of the values where to start
  • array_size – The number of structs to generate
Return type:

numpy.array(dtype=”uint32”)

get_size_in_whole_words(array_size=1)[source]

Get the size of the struct in whole words in an array of given size (default 1 item)

Parameters:array_size – The number of elements in an array of structs
Return type:int
numpy_dtype

The numpy data type of the struct

Return type:numpy.dtype
read_data(data, offset=0, array_size=1)[source]

Read a bytearray of data and convert to struct values

Parameters:
  • data – The data to be read
  • offset – Index of the byte at the start of the valid data
  • array_size – The number of struct elements to read
Returns:

a list of lists of data values, one list for each struct element

Module contents

class spynnaker.pyNN.models.neuron.implementations.AbstractStandardNeuronComponent(data_types)[source]

Bases: object

Represents a component of a standard neural model

Parameters:data_types – A list of data types in the component structure, in the order that they appear
add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
get_values(parameters, state_variables, vertex_slice)[source]

Get the values to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of variables being retrieved
Returns:

A list with the same length as self.struct.field_types

Return type:

A list of (single value or list of values or RangedList)

has_variable(variable)[source]

Determine if this component has a variable by the given name

Parameters:variable (str) – The name of the variable
Return type:bool
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update
Returns:

The offset after reading the data

struct

The structure of the component

Return type::py:class:’spynnaker.pyNN.models.neuron.implementations.struct.Struct’
update_values(values, parameters, state_variables)[source]

Update the parameters and state variables with the given struct values that have been read from the machine

Parameters:
  • values – The values read from the machine, one for each struct element
  • parameters – The holder of the parameters to update
  • state_variables – The holder of the state variables to update
class spynnaker.pyNN.models.neuron.implementations.Struct(field_types)[source]

Bases: object

Represents a C code structure

Parameters:field_types (list of data_specification.enums.data_type.DataType) – The types of the fields, ordered as they appear in the struct
field_types

The types of the fields, ordered as they appear in the struct

Return type:list of data_specification.enums.data_type.DataType
get_data(values, offset=0, array_size=1)[source]

Get a numpy array of uint32 of data for the given values

Parameters:
  • values (list of (single value or list of values or RangedList of values)) – A list of values with length the same size as the number of fields returned by field_types
  • offset – The offset into each of the values where to start
  • array_size – The number of structs to generate
Return type:

numpy.array(dtype=”uint32”)

get_size_in_whole_words(array_size=1)[source]

Get the size of the struct in whole words in an array of given size (default 1 item)

Parameters:array_size – The number of elements in an array of structs
Return type:int
numpy_dtype

The numpy data type of the struct

Return type:numpy.dtype
read_data(data, offset=0, array_size=1)[source]

Read a bytearray of data and convert to struct values

Parameters:
  • data – The data to be read
  • offset – Index of the byte at the start of the valid data
  • array_size – The number of struct elements to read
Returns:

a list of lists of data values, one list for each struct element

class spynnaker.pyNN.models.neuron.implementations.NeuronImplStandard(model_name, binary, neuron_model, input_type, synapse_type, threshold_type, additional_input_type=None)[source]

Bases: spynnaker.pyNN.models.neuron.implementations.abstract_neuron_impl.AbstractNeuronImpl

The standard neuron implementation, consisting of various components

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
binary_name

The name of the binary executable of this implementation

:rtype str

get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_global_weight_scale()[source]

Get the weight scaling required by this model

Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_n_synapse_types()[source]

Get the number of synapse types supported by the model

Return type:int
get_recordable_units(variable)[source]

Get the units of the given variable that can be recorded

Parameters:variable (str) – The name of the variable
get_recordable_variable_index(variable)[source]

Get the index of the variable in the list of variables that can be recorded

Parameters:variable (str) – The name of the variable
Return type:int
get_recordable_variables()[source]

Get the names of the variables that can be recorded in this model

Return type:list of str
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_synapse_id_by_target(target)[source]

Get the id of a synapse given the name

Parameters:target (str) – The name of the synapse
Return type:int
get_synapse_targets()[source]

Get the target names of the synapse type

Return type:array of str
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
is_conductance_based

Determine if the model uses conductance

Return type:bool
is_recordable(variable)[source]

Determine if the given variable can be recorded

Parameters:variable (str) – The name of the variable being requested
Return type:bool
model_name

The name of the model

Return type:str
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update
class spynnaker.pyNN.models.neuron.implementations.AbstractNeuronImpl[source]

Bases: object

An abstraction of a whole neuron model including all parts

add_parameters(parameters)[source]

Add the initial values of the parameters to the parameter holder

Parameters:parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the parameters
add_state_variables(state_variables)[source]

Add the initial values of the state variables to the state variables holder

Parameters:state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – A holder of the state variables
binary_name

The name of the binary executable of this implementation

:rtype str

get_data(parameters, state_variables, vertex_slice)[source]

Get the data to be written to the machine for this model

Parameters:
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables
  • vertex_slice – The slice of the vertex to generate parameters for
Return type:

numpy array of uint32

get_dtcm_usage_in_bytes(n_neurons)[source]

Get the DTCM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_global_weight_scale()[source]

Get the weight scaling required by this model

Return type:int
get_n_cpu_cycles(n_neurons)[source]

Get the number of CPU cycles required to update the state

Parameters:n_neurons (int) – The number of neurons to get the cycles for
Return type:int
get_n_synapse_types()[source]

Get the number of synapse types supported by the model

Return type:int
get_recordable_units(variable)[source]

Get the units of the given variable that can be recorded

Parameters:variable (str) – The name of the variable
get_recordable_variable_index(variable)[source]

Get the index of the variable in the list of variables that can be recorded

Parameters:variable (str) – The name of the variable
Return type:int
get_recordable_variables()[source]

Get the names of the variables that can be recorded in this model

Return type:list of str
get_sdram_usage_in_bytes(n_neurons)[source]

Get the SDRAM memory usage required

Parameters:n_neurons (int) – The number of neurons to get the usage for
Return type:int
get_synapse_id_by_target(target)[source]

Get the id of a synapse given the name

Parameters:target (str) – The name of the synapse
Return type:int
get_synapse_targets()[source]

Get the target names of the synapse type

Return type:array of str
get_units(variable)[source]

Get the units of the given variable

Parameters:variable (str) – The name of the variable
is_conductance_based

Determine if the model uses conductance

Return type:bool
is_recordable(variable)[source]

Determine if the given variable can be recorded

Parameters:variable (str) – The name of the variable being requested
Return type:bool
model_name

The name of the model

Return type:str
read_data(data, offset, vertex_slice, parameters, state_variables)[source]

Read the parameters and state variables of the model from the given data

Parameters:
  • data – The data to be read
  • offset – The offset where the data should be read from
  • vertex_slice – The slice of the vertex to read parameters for
  • parameters (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the parameters to update
  • state_variables (spinn_utilities.ranged.range_dictionary.RangeDictionary) – The holder of the state variables to update
class spynnaker.pyNN.models.neuron.implementations.RangedDictVertexSlice(ranged_dict, vertex_slice)[source]

Bases: object

A slice of a ranged dict to be used to update values