namespace pygenn::model_preprocessor

Overview

namespace model_preprocessor {

// classes

class ExtraGlobalVariable;
class Variable;

// global variables

dictionary genn_to_numpy_types;

// global functions

def prepare_model();
def prepare_snippet();
def is_model_valid();
def param_space_to_vals();
def param_space_to_val_vec();
def var_space_to_vals();
def pre_var_space_to_vals();
def post_var_space_to_vals();

} // namespace model_preprocessor

Detailed Documentation

Global Functions

def prepare_model()

Prepare a model by checking its validity and extracting information about variables and parameters.

Parameters:

model

string or instance of a class derived from pygenn.genn_wrapper.NeuronModels.Custom or pygenn.genn_wrapper.WeightUpdateModels.Custom or

                       ``pygenn.genn_wrapper.CurrentSourceModels.Custom``
@param     param_space dict with model parameters
@param     var_space   dict with model variables
@param     pre_var_space   optional dict with (weight update) model

presynaptic variables

post_var_space optional dict with (weight update) model postsynaptic variables
model_family

pygenn.genn_wrapper.NeuronModels or pygenn.genn_wrapper.WeightUpdateModels or

                       ``pygenn.genn_wrapper.CurrentSourceModels``

@return

tuple consisting of (model instance, model type, model parameter names, model parameters, list of variable names, dict mapping names of variables to instances of class Variable)

def prepare_snippet()

Prepare a snippet by checking its validity and extracting information about parameters.

Parameters:

snippet

string or instance of a class derived from pygenn.genn_wrapper.InitVarSnippet.Custom or

                       ``pygenn.genn_wrapper.InitSparseConnectivitySnippet.Custom``
@param     param_space dict with model parameters
@param     snippet_family  ``pygenn.genn_wrapper.InitVarSnippet`` or
                       ``pygenn.genn_wrapper.InitSparseConnectivitySnippet``

@return

tuple consisting of (snippet instance, snippet type, snippet parameter names, snippet parameters)

def is_model_valid()

Check whether the model is valid, i.e is native or derived from model_family.Custom.

Raises ValueError if model is not valid (i.e. is not custom and is not natively available)

Parameters:

model string or instance of model_family.Custom
model_family model family (NeuronModels, WeightUpdateModels or PostsynapticModels) to which model should belong to

Returns:

instance of the model and its type as string

def param_space_to_vals()

Convert a param_space dict to ParamValues.

Parameters:

model instance of the model
param_space dict with parameters

Returns:

native model’s ParamValues

def param_space_to_val_vec()

Convert a param_space dict to a std::vector<double>

Parameters:

model instance of the model
param_space dict with parameters

Returns:

native vector of parameters

def var_space_to_vals()

Convert a var_space dict to VarValues.

Parameters:

model instance of the model
var_space dict with Variables

Returns:

native model’s VarValues

def pre_var_space_to_vals()

Convert a var_space dict to PreVarValues.

Parameters:

model instance of the weight update model
var_space dict with Variables

Returns:

native model’s VarValues

def post_var_space_to_vals()

Convert a var_space dict to PostVarValues.

Parameters:

model instance of the weight update model
var_space dict with Variables

Returns:

native model’s VarValues