GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
pygenn.genn_model Namespace Reference

Classes

class  GeNNModel
 GeNNModel class This class helps to define, build and run a GeNN model from python. More...
 

Functions

def init_var (init_var_snippet, param_space)
 This helper function creates a VarInit object to easily initialise a variable using a snippet. More...
 
def init_connectivity (init_sparse_connect_snippet, param_space)
 This helper function creates a InitSparseConnectivitySnippet::Init object to easily initialise connectivity using a snippet. More...
 
def create_custom_neuron_class (class_name, param_names=None, var_name_types=None, derived_params=None, sim_code=None, threshold_condition_code=None, reset_code=None, support_code=None, extra_global_params=None, additional_input_vars=None, is_auto_refractory_required=None, custom_body=None)
 This helper function creates a custom NeuronModel class. More...
 
def create_custom_postsynaptic_class (class_name, param_names=None, var_name_types=None, derived_params=None, decay_code=None, apply_input_code=None, support_code=None, custom_body=None)
 This helper function creates a custom PostsynapticModel class. More...
 
def create_custom_weight_update_class (class_name, param_names=None, var_name_types=None, pre_var_name_types=None, post_var_name_types=None, derived_params=None, sim_code=None, event_code=None, learn_post_code=None, synapse_dynamics_code=None, event_threshold_condition_code=None, pre_spike_code=None, post_spike_code=None, sim_support_code=None, learn_post_support_code=None, synapse_dynamics_suppport_code=None, extra_global_params=None, is_pre_spike_time_required=None, is_post_spike_time_required=None, custom_body=None)
 This helper function creates a custom WeightUpdateModel class. More...
 
def create_custom_current_source_class (class_name, param_names=None, var_name_types=None, derived_params=None, injection_code=None, extra_global_params=None, custom_body=None)
 This helper function creates a custom NeuronModel class. More...
 
def create_custom_model_class (class_name, base, param_names, var_name_types, derived_params, custom_body)
 This helper function completes a custom model class creation. More...
 
def create_dpf_class (dp_func)
 Helper function to create derived parameter function class. More...
 
def create_cmlf_class (cml_func)
 Helper function to create function class for calculating sizes of matrices initialised with sparse connectivity initialisation snippet. More...
 
def create_custom_init_var_snippet_class (class_name, param_names=None, derived_params=None, var_init_code=None, custom_body=None)
 This helper function creates a custom InitVarSnippet class. More...
 
def create_custom_sparse_connect_init_snippet_class (class_name, param_names=None, derived_params=None, row_build_code=None, row_build_state_vars=None, calc_max_row_len_func=None, calc_max_col_len_func=None, extra_global_params=None, custom_body=None)
 This helper function creates a custom InitSparseConnectivitySnippet class. More...
 
def create_custom_neuron_class (class_name, param_names=None, var_name_types=None, derived_params=None, sim_code=None, threshold_condition_code=None, reset_code=None, support_code=None, extra_global_params=None, additional_input_vars=None, custom_body=None)
 This helper function creates a custom NeuronModel class. More...
 

Variables

 backend_modules = OrderedDict()
 
 m = import_module(".genn_wrapper." + b + "Backend", "pygenn")
 

Function Documentation

◆ create_cmlf_class()

def pygenn.genn_model.create_cmlf_class (   cml_func)

Helper function to create function class for calculating sizes of matrices initialised with sparse connectivity initialisation snippet.

Parameters
cml_funca function which computes the length and takes three args "num_pre" (unsigned int), "num_post" (unsigned int) and "pars" (vector of double)

◆ create_custom_current_source_class()

def pygenn.genn_model.create_custom_current_source_class (   class_name,
  param_names = None,
  var_name_types = None,
  derived_params = None,
  injection_code = None,
  extra_global_params = None,
  custom_body = None 
)

This helper function creates a custom NeuronModel class.

sa create_custom_neuron_class sa create_custom_weight_update_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with varible names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of the class which inherits from genn_wrapper.Snippet.DerivedParamFunc
injection_codestring with the current injection code
extra_global_paramslist of pairs of strings with names and types of additional parameters
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_init_var_snippet_class()

def pygenn.genn_model.create_custom_init_var_snippet_class (   class_name,
  param_names = None,
  derived_params = None,
  var_init_code = None,
  custom_body = None 
)

This helper function creates a custom InitVarSnippet class.

sa create_custom_neuron_class sa create_custom_weight_update_class sa create_custom_postsynaptic_class sa create_custom_current_source_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of the class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
var_initcodestring with the variable initialization code
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_model_class()

def pygenn.genn_model.create_custom_model_class (   class_name,
  base,
  param_names,
  var_name_types,
  derived_params,
  custom_body 
)

This helper function completes a custom model class creation.

This part is common for all model classes and is nearly useless on its own unless you specify custom_body. sa create_custom_neuron_class sa create_custom_weight_update_class sa create_custom_postsynaptic_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
basebase class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with varible names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of the class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
custom_bodydictionary with attributes and methods of the new class

◆ create_custom_neuron_class() [1/2]

def pygenn.genn_model.create_custom_neuron_class (   class_name,
  param_names = None,
  var_name_types = None,
  derived_params = None,
  sim_code = None,
  threshold_condition_code = None,
  reset_code = None,
  support_code = None,
  extra_global_params = None,
  additional_input_vars = None,
  custom_body = None 
)

This helper function creates a custom NeuronModel class.

sa create_custom_postsynaptic_class sa create_custom_weight_update_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with varible names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of a class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
sim_codestring with the simulation code
threshold_condition_codestring with the threshold condition code
reset_codestring with the reset code
support_codestring with the support code
extra_global_paramslist of pairs of strings with names and types of additional parameters
additional_input_varslist of tuples with names and types as strings and initial values of additional local input variables
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_neuron_class() [2/2]

def pygenn.genn_model.create_custom_neuron_class (   class_name,
  param_names = None,
  var_name_types = None,
  derived_params = None,
  sim_code = None,
  threshold_condition_code = None,
  reset_code = None,
  support_code = None,
  extra_global_params = None,
  additional_input_vars = None,
  is_auto_refractory_required = None,
  custom_body = None 
)

This helper function creates a custom NeuronModel class.

sa create_custom_postsynaptic_class sa create_custom_weight_update_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with varible names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of a class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
sim_codestring with the simulation code
threshold_condition_codestring with the threshold condition code
reset_codestring with the reset code
support_codestring with the support code
extra_global_paramslist of pairs of strings with names and types of additional parameters
additional_input_varslist of tuples with names and types as strings and initial values of additional local input variables
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_postsynaptic_class()

def pygenn.genn_model.create_custom_postsynaptic_class (   class_name,
  param_names = None,
  var_name_types = None,
  derived_params = None,
  decay_code = None,
  apply_input_code = None,
  support_code = None,
  custom_body = None 
)

This helper function creates a custom PostsynapticModel class.

sa create_custom_neuron_class sa create_custom_weight_update_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with varible names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of a class which inherits from genn_wrapper.Snippet.DerivedParamFunc
decay_codestring with the decay code
apply_input_codestring with the apply input code
support_codestring with the support code
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_sparse_connect_init_snippet_class()

def pygenn.genn_model.create_custom_sparse_connect_init_snippet_class (   class_name,
  param_names = None,
  derived_params = None,
  row_build_code = None,
  row_build_state_vars = None,
  calc_max_row_len_func = None,
  calc_max_col_len_func = None,
  extra_global_params = None,
  custom_body = None 
)

This helper function creates a custom InitSparseConnectivitySnippet class.

sa create_custom_neuron_class sa create_custom_weight_update_class sa create_custom_postsynaptic_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of the class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
row_build_codestring with row building initialization code
row_build_state_varslist of tuples of state variables, their types and their initial values to use across row building loop
calc_max_row_len_funcinstance of class inheriting from
InitSparseConnectivitySnippet.CalcMaxLengthFuncused to calculate maximum row length of synaptic matrix
calc_max_col_len_funcinstance of class inheriting from
InitSparseConnectivitySnippet.CalcMaxLengthFuncused to calculate maximum col length of synaptic matrix
extra_global_paramslist of pairs of strings with names and types of additional parameters
custom_bodydictionary with additional attributes and methods of the new class

◆ create_custom_weight_update_class()

def pygenn.genn_model.create_custom_weight_update_class (   class_name,
  param_names = None,
  var_name_types = None,
  pre_var_name_types = None,
  post_var_name_types = None,
  derived_params = None,
  sim_code = None,
  event_code = None,
  learn_post_code = None,
  synapse_dynamics_code = None,
  event_threshold_condition_code = None,
  pre_spike_code = None,
  post_spike_code = None,
  sim_support_code = None,
  learn_post_support_code = None,
  synapse_dynamics_suppport_code = None,
  extra_global_params = None,
  is_pre_spike_time_required = None,
  is_post_spike_time_required = None,
  custom_body = None 
)

This helper function creates a custom WeightUpdateModel class.

sa create_custom_neuron_class sa create_custom_postsynaptic_class sa create_custom_current_source_class sa create_custom_init_var_snippet_class sa create_custom_sparse_connect_init_snippet_class

Parameters
class_namename of the new class
param_nameslist of strings with param names of the model
var_name_typeslist of pairs of strings with variable names and types of the model
pre_var_name_typeslist of pairs of strings with presynaptic variable names and types of the model
post_var_name_typeslist of pairs of strings with postsynaptic variable names and types of the model
derived_paramslist of pairs, where the first member is string with name of the derived parameter and the second MUST be an instance of a class which inherits from
genn_wrapper.Snippet.DerivedParamFunc
sim_codestring with the simulation code
event_codestring with the event code
learn_post_codestring with the code to include in learn_synapse_post kernel/function
synapse_dynamics_codestring with the synapse dynamics code
event_threshold_condition_codestring with the event threshold condition code
pre_spike_codestring with the code run once per spiking presynaptic neuron
post_spike_codestring with the code run once per spiking postsynaptic neuron
sim_support_codestring with simulation support code
learn_post_support_codestring with support code for learn_synapse_post kernel/function
synapse_dynamics_suppport_codestring with synapse dynamics support code
extra_global_paramslist of pairs of strings with names and types of additional parameters
is_pre_spike_time_requiredboolean, is presynaptic spike time required in any weight update kernels?
is_post_spike_time_requiredboolean, is postsynaptic spike time required in any weight update kernels?
custom_bodydictionary with additional attributes and methods of the new class

◆ create_dpf_class()

def pygenn.genn_model.create_dpf_class (   dp_func)

Helper function to create derived parameter function class.

Parameters
dp_funca function which computes the derived parameter and takes two args "pars" (vector of double) and "dt" (double)

◆ init_connectivity()

def pygenn.genn_model.init_connectivity (   init_sparse_connect_snippet,
  param_space 
)

This helper function creates a InitSparseConnectivitySnippet::Init object to easily initialise connectivity using a snippet.

Parameters
init_sparse_connect_snippettype of the InitSparseConnectivitySnippet class as string or instance of class derived from InitSparseConnectivitySnippet::Custom.
param_spacedict with param values for the InitSparseConnectivitySnippet class

◆ init_var()

def pygenn.genn_model.init_var (   init_var_snippet,
  param_space 
)

This helper function creates a VarInit object to easily initialise a variable using a snippet.

Parameters
init_var_snippettype of the InitVarSnippet class as string or instance of class derived from InitVarSnippet::Custom class.
param_spacedict with param values for the InitVarSnippet class

Variable Documentation

◆ backend_modules

pygenn.genn_model.backend_modules = OrderedDict()

◆ m

pygenn.genn_model.m = import_module(".genn_wrapper." + b + "Backend", "pygenn")