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

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

Inheritance diagram for pygenn.genn_model.GeNNModel:

Public Member Functions

def __init__ (self, precision=None, model_name="GeNNModel", enable_debug=False, backend=None)
 Init GeNNModel. More...
 
def use_backend (self)
 
def use_backend (self, backend)
 
def default_var_location (self)
 Default variable location - defines where state variables are initialised. More...
 
def default_var_location (self, location)
 
def default_sparse_connectivity_location (location)
 Default sparse connectivity mode - where connectivity is initialised. More...
 
def default_sparse_connectivity_location (self, location)
 
def model_name (self)
 Name of the model. More...
 
def model_name (self, model_name)
 
def t (self)
 Simulation time in ms. More...
 
def t (self, t)
 
def timestep (self)
 Simulation time step. More...
 
def timestep (self, timestep)
 
def dT (self)
 Step size. More...
 
def dT (self, dt)
 
def add_neuron_population (self, pop_name, num_neurons, neuron, param_space, var_space)
 Add a neuron population to the GeNN model. More...
 
def add_synapse_population (self, pop_name, matrix_type, delay_steps, source, target, w_update_model, wu_param_space, wu_var_space, wu_pre_var_space, wu_post_var_space, postsyn_model, ps_param_space, ps_var_space, connectivity_initialiser=None)
 Add a synapse population to the GeNN model. More...
 
def add_current_source (self, cs_name, current_source_model, pop_name, param_space, var_space)
 Add a current source to the GeNN model. More...
 
def build (self, path_to_model="./")
 Finalize and build a GeNN model. More...
 
def load (self)
 import the model as shared library and initialize it More...
 
def reinitialise (self)
 reinitialise model to its original state without re-loading More...
 
def step_time (self)
 
def pull_state_from_device (self, pop_name)
 Pull state from the device for a given population. More...
 
def pull_spikes_from_device (self, pop_name)
 Pull spikes from the device for a given population. More...
 
def pull_current_spikes_from_device (self, pop_name)
 Pull spikes from the device for a given population. More...
 
def push_state_to_device (self, pop_name)
 Push state to the device for a given population. More...
 
def push_spikes_to_device (self, pop_name)
 Push spikes from the device for a given population. More...
 
def push_current_spikes_from_device (self, pop_name)
 Push spikes from the device for a given population. More...
 
def end (self)
 Free memory. More...
 
def __init__ (self, precision=None, model_name="GeNNModel", enable_debug=False, cpu=None)
 Init GeNNModel. More...
 
def use_cpu (self)
 
def use_cpu (self, cpu)
 
def default_var_mode (self)
 Default variable mode - defines how and where state variables are initialised. More...
 
def default_var_mode (self, mode)
 
def default_sparse_connectivity_mode (self)
 Default sparse connectivity mode - how and where connectivity is initialised. More...
 
def default_sparse_connectivity_mode (self, mode)
 
def model_name (self)
 Name of the model. More...
 
def model_name (self, model_name)
 
def t (self)
 Simulation time in ms. More...
 
def t (self, t)
 
def timestep (self)
 Simulation time step. More...
 
def timestep (self, timestep)
 
def dT (self)
 Step size. More...
 
def dT (self, dt)
 
def add_neuron_population (self, pop_name, num_neurons, neuron, param_space, var_space)
 Add a neuron population to the GeNN model. More...
 
def add_synapse_population (self, pop_name, matrix_type, delay_steps, source, target, w_update_model, wu_param_space, wu_var_space, wu_pre_var_space, wu_post_var_space, postsyn_model, ps_param_space, ps_var_space, connectivity_initialiser=None)
 Add a synapse population to the GeNN model. More...
 
def add_current_source (self, cs_name, current_source_model, pop_name, param_space, var_space)
 Add a current source to the GeNN model. More...
 
def build (self, path_to_model="./")
 Finalize and build a GeNN model. More...
 
def load (self)
 import the model as shared library and initialize it More...
 
def reinitialise (self)
 reinitialise model to its original state without re-loading More...
 
def step_time (self)
 Make one simulation step. More...
 
def pull_state_from_device (self, pop_name)
 Pull state from the device for a given population. More...
 
def pull_spikes_from_device (self, pop_name)
 Pull spikes from the device for a given population. More...
 
def pull_current_spikes_from_device (self, pop_name)
 Pull spikes from the device for a given population. More...
 
def push_state_to_device (self, pop_name)
 Push state to the device for a given population. More...
 
def push_spikes_to_device (self, pop_name)
 Push spikes from the device for a given population. More...
 
def push_current_spikes_from_device (self, pop_name)
 Push spikes from the device for a given population. More...
 
def end (self)
 Free memory. More...
 

Public Attributes

 use_backend
 
 default_var_location
 
 model_name
 
 neuron_populations
 
 synapse_populations
 
 current_sources
 
 dT
 
 T
 
 use_cpu
 
 default_var_mode
 
 step_time
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__() [1/2]

def pygenn.genn_model.GeNNModel.__init__ (   self,
  precision = None,
  model_name = "GeNNModel",
  enable_debug = False,
  backend = None 
)

Init GeNNModel.

Parameters
precisionstring precision as string ("float", "double" or "long double"). defaults to float.
model_namestring name of the model. Defaults to "GeNNModel".
enable_debugboolean enable debug mode. Disabled by default.
backendstring specifying name of backend module to use Defaults to None to pick 'best' backend for your system

◆ __init__() [2/2]

def pygenn.genn_model.GeNNModel.__init__ (   self,
  precision = None,
  model_name = "GeNNModel",
  enable_debug = False,
  cpu = None 
)

Init GeNNModel.

Parameters
precisionstring precision as string ("float", "double" or "long double"). defaults to float.
model_namestring name of the model. Defaults to "GeNNModel".
enable_debugboolean enable debug mode. Disabled by default.
cpuboolean whether GeNN should use CPU. Defaults to None to defer to whether module was built without GPU support.

Member Function Documentation

◆ add_current_source() [1/2]

def pygenn.genn_model.GeNNModel.add_current_source (   self,
  cs_name,
  current_source_model,
  pop_name,
  param_space,
  var_space 
)

Add a current source to the GeNN model.

Parameters
cs_namename of the new current source
current_source_modeltype of the CurrentSourceModels class as string or instance of CurrentSourceModels class derived from CurrentSourceModels::Custom class sa createCustomCurrentSourceClass
pop_namename of the population into which the current source should be injected
param_spacedict with param values for the CurrentSourceModels class
var_spacedict with initial variable values for the CurrentSourceModels class

◆ add_current_source() [2/2]

def pygenn.genn_model.GeNNModel.add_current_source (   self,
  cs_name,
  current_source_model,
  pop_name,
  param_space,
  var_space 
)

Add a current source to the GeNN model.

Parameters
cs_namename of the new current source
current_source_modeltype of the CurrentSourceModels class as string or instance of CurrentSourceModels class derived from CurrentSourceModels::Custom class sa createCustomCurrentSourceClass
pop_namename of the population into which the current source should be injected
param_spacedict with param values for the CurrentSourceModels class
var_spacedict with initial variable values for the CurrentSourceModels class

◆ add_neuron_population() [1/2]

def pygenn.genn_model.GeNNModel.add_neuron_population (   self,
  pop_name,
  num_neurons,
  neuron,
  param_space,
  var_space 
)

Add a neuron population to the GeNN model.

Parameters
pop_namename of the new population
num_neuronsnumber of neurons in the new population
neurontype of the NeuronModels class as string or instance of neuron class derived from NeuronModels::Custom class. sa create_custom_neuron_class
param_spacedict with param values for the NeuronModels class
var_spacedict with initial variable values for the NeuronModels class

◆ add_neuron_population() [2/2]

def pygenn.genn_model.GeNNModel.add_neuron_population (   self,
  pop_name,
  num_neurons,
  neuron,
  param_space,
  var_space 
)

Add a neuron population to the GeNN model.

Parameters
pop_namename of the new population
num_neuronsnumber of neurons in the new population
neurontype of the NeuronModels class as string or instance of neuron class derived from NeuronModels::Custom class. sa create_custom_neuron_class
param_spacedict with param values for the NeuronModels class
var_spacedict with initial variable values for the NeuronModels class

◆ add_synapse_population() [1/2]

def pygenn.genn_model.GeNNModel.add_synapse_population (   self,
  pop_name,
  matrix_type,
  delay_steps,
  source,
  target,
  w_update_model,
  wu_param_space,
  wu_var_space,
  wu_pre_var_space,
  wu_post_var_space,
  postsyn_model,
  ps_param_space,
  ps_var_space,
  connectivity_initialiser = None 
)

Add a synapse population to the GeNN model.

Parameters
pop_namename of the new population
matrix_typetype of the matrix as string
delay_stepsdelay in number of steps
sourcesource neuron group
targettarget neuron group
w_update_modeltype of the WeightUpdateModels class as string or instance of weight update model class derived from WeightUpdateModels::Custom class. sa createCustomWeightUpdateClass
wu_param_valuesdict with param values for the WeightUpdateModels class
wu_init_var_valuesdict with initial variable values for the WeightUpdateModels class
postsyn_modeltype of the PostsynapticModels class as string or instance of postsynaptic model class derived from PostsynapticModels::Custom class. sa create_custom_postsynaptic_class
postsyn_param_valuesdict with param values for the PostsynapticModels class
postsyn_init_var_valuesdict with initial variable values for the PostsynapticModels class
connectivity_initialiserInitSparseConnectivitySnippet::Init for connectivity

◆ add_synapse_population() [2/2]

def pygenn.genn_model.GeNNModel.add_synapse_population (   self,
  pop_name,
  matrix_type,
  delay_steps,
  source,
  target,
  w_update_model,
  wu_param_space,
  wu_var_space,
  wu_pre_var_space,
  wu_post_var_space,
  postsyn_model,
  ps_param_space,
  ps_var_space,
  connectivity_initialiser = None 
)

Add a synapse population to the GeNN model.

Parameters
pop_namename of the new population
matrix_typetype of the matrix as string
delay_stepsdelay in number of steps
sourcesource neuron group
targettarget neuron group
w_update_modeltype of the WeightUpdateModels class as string or instance of weight update model class derived from WeightUpdateModels::Custom class. sa createCustomWeightUpdateClass
wu_param_valuesdict with param values for the WeightUpdateModels class
wu_init_var_valuesdict with initial variable values for the WeightUpdateModels class
postsyn_modeltype of the PostsynapticModels class as string or instance of postsynaptic model class derived from PostsynapticModels::Custom class. sa create_custom_postsynaptic_class
postsyn_param_valuesdict with param values for the PostsynapticModels class
postsyn_init_var_valuesdict with initial variable values for the PostsynapticModels class
connectivity_initialiserInitSparseConnectivitySnippet::Init for connectivity

◆ build() [1/2]

def pygenn.genn_model.GeNNModel.build (   self,
  path_to_model = "./" 
)

Finalize and build a GeNN model.

Parameters
path_to_modelpath where to place the generated model code. Defaults to the local directory.

◆ build() [2/2]

def pygenn.genn_model.GeNNModel.build (   self,
  path_to_model = "./" 
)

Finalize and build a GeNN model.

Parameters
path_to_modelpath where to place the generated model code. Defaults to the local directory.

◆ default_sparse_connectivity_location() [1/2]

def pygenn.genn_model.GeNNModel.default_sparse_connectivity_location (   location)

Default sparse connectivity mode - where connectivity is initialised.

◆ default_sparse_connectivity_location() [2/2]

def pygenn.genn_model.GeNNModel.default_sparse_connectivity_location (   self,
  location 
)

◆ default_sparse_connectivity_mode() [1/2]

def pygenn.genn_model.GeNNModel.default_sparse_connectivity_mode (   self)

Default sparse connectivity mode - how and where connectivity is initialised.

◆ default_sparse_connectivity_mode() [2/2]

def pygenn.genn_model.GeNNModel.default_sparse_connectivity_mode (   self,
  mode 
)

◆ default_var_location() [1/2]

def pygenn.genn_model.GeNNModel.default_var_location (   self)

Default variable location - defines where state variables are initialised.

◆ default_var_location() [2/2]

def pygenn.genn_model.GeNNModel.default_var_location (   self,
  location 
)

◆ default_var_mode() [1/2]

def pygenn.genn_model.GeNNModel.default_var_mode (   self)

Default variable mode - defines how and where state variables are initialised.

◆ default_var_mode() [2/2]

def pygenn.genn_model.GeNNModel.default_var_mode (   self,
  mode 
)

◆ dT() [1/4]

def pygenn.genn_model.GeNNModel.dT (   self)

Step size.

◆ dT() [2/4]

def pygenn.genn_model.GeNNModel.dT (   self,
  dt 
)

◆ dT() [3/4]

def pygenn.genn_model.GeNNModel.dT (   self)

Step size.

◆ dT() [4/4]

def pygenn.genn_model.GeNNModel.dT (   self,
  dt 
)

◆ end() [1/2]

def pygenn.genn_model.GeNNModel.end (   self)

Free memory.

◆ end() [2/2]

def pygenn.genn_model.GeNNModel.end (   self)

Free memory.

◆ load() [1/2]

def pygenn.genn_model.GeNNModel.load (   self)

import the model as shared library and initialize it

◆ load() [2/2]

def pygenn.genn_model.GeNNModel.load (   self)

import the model as shared library and initialize it

◆ model_name() [1/4]

def pygenn.genn_model.GeNNModel.model_name (   self)

Name of the model.

◆ model_name() [2/4]

def pygenn.genn_model.GeNNModel.model_name (   self,
  model_name 
)

◆ model_name() [3/4]

def pygenn.genn_model.GeNNModel.model_name (   self)

Name of the model.

◆ model_name() [4/4]

def pygenn.genn_model.GeNNModel.model_name (   self,
  model_name 
)

◆ pull_current_spikes_from_device() [1/2]

def pygenn.genn_model.GeNNModel.pull_current_spikes_from_device (   self,
  pop_name 
)

Pull spikes from the device for a given population.

◆ pull_current_spikes_from_device() [2/2]

def pygenn.genn_model.GeNNModel.pull_current_spikes_from_device (   self,
  pop_name 
)

Pull spikes from the device for a given population.

◆ pull_spikes_from_device() [1/2]

def pygenn.genn_model.GeNNModel.pull_spikes_from_device (   self,
  pop_name 
)

Pull spikes from the device for a given population.

◆ pull_spikes_from_device() [2/2]

def pygenn.genn_model.GeNNModel.pull_spikes_from_device (   self,
  pop_name 
)

Pull spikes from the device for a given population.

◆ pull_state_from_device() [1/2]

def pygenn.genn_model.GeNNModel.pull_state_from_device (   self,
  pop_name 
)

Pull state from the device for a given population.

◆ pull_state_from_device() [2/2]

def pygenn.genn_model.GeNNModel.pull_state_from_device (   self,
  pop_name 
)

Pull state from the device for a given population.

◆ push_current_spikes_from_device() [1/2]

def pygenn.genn_model.GeNNModel.push_current_spikes_from_device (   self,
  pop_name 
)

Push spikes from the device for a given population.

◆ push_current_spikes_from_device() [2/2]

def pygenn.genn_model.GeNNModel.push_current_spikes_from_device (   self,
  pop_name 
)

Push spikes from the device for a given population.

◆ push_spikes_to_device() [1/2]

def pygenn.genn_model.GeNNModel.push_spikes_to_device (   self,
  pop_name 
)

Push spikes from the device for a given population.

◆ push_spikes_to_device() [2/2]

def pygenn.genn_model.GeNNModel.push_spikes_to_device (   self,
  pop_name 
)

Push spikes from the device for a given population.

◆ push_state_to_device() [1/2]

def pygenn.genn_model.GeNNModel.push_state_to_device (   self,
  pop_name 
)

Push state to the device for a given population.

◆ push_state_to_device() [2/2]

def pygenn.genn_model.GeNNModel.push_state_to_device (   self,
  pop_name 
)

Push state to the device for a given population.

◆ reinitialise() [1/2]

def pygenn.genn_model.GeNNModel.reinitialise (   self)

reinitialise model to its original state without re-loading

◆ reinitialise() [2/2]

def pygenn.genn_model.GeNNModel.reinitialise (   self)

reinitialise model to its original state without re-loading

◆ step_time() [1/2]

def pygenn.genn_model.GeNNModel.step_time (   self)

Make one simulation step.

◆ step_time() [2/2]

def pygenn.genn_model.GeNNModel.step_time (   self)

◆ t() [1/4]

def pygenn.genn_model.GeNNModel.t (   self)

Simulation time in ms.

◆ t() [2/4]

def pygenn.genn_model.GeNNModel.t (   self,
  t 
)

◆ t() [3/4]

def pygenn.genn_model.GeNNModel.t (   self)

Simulation time in ms.

◆ t() [4/4]

def pygenn.genn_model.GeNNModel.t (   self,
  t 
)

◆ timestep() [1/4]

def pygenn.genn_model.GeNNModel.timestep (   self)

Simulation time step.

◆ timestep() [2/4]

def pygenn.genn_model.GeNNModel.timestep (   self,
  timestep 
)

◆ timestep() [3/4]

def pygenn.genn_model.GeNNModel.timestep (   self)

Simulation time step.

◆ timestep() [4/4]

def pygenn.genn_model.GeNNModel.timestep (   self,
  timestep 
)

◆ use_backend() [1/2]

def pygenn.genn_model.GeNNModel.use_backend (   self)

◆ use_backend() [2/2]

def pygenn.genn_model.GeNNModel.use_backend (   self,
  backend 
)

◆ use_cpu() [1/2]

def pygenn.genn_model.GeNNModel.use_cpu (   self)

◆ use_cpu() [2/2]

def pygenn.genn_model.GeNNModel.use_cpu (   self,
  cpu 
)

Member Data Documentation

◆ current_sources

pygenn.genn_model.GeNNModel.current_sources

◆ default_var_location

pygenn.genn_model.GeNNModel.default_var_location

◆ default_var_mode

pygenn.genn_model.GeNNModel.default_var_mode

◆ dT

pygenn.genn_model.GeNNModel.dT

◆ model_name

pygenn.genn_model.GeNNModel.model_name

◆ neuron_populations

pygenn.genn_model.GeNNModel.neuron_populations

◆ step_time

pygenn.genn_model.GeNNModel.step_time

◆ synapse_populations

pygenn.genn_model.GeNNModel.synapse_populations

◆ T

pygenn.genn_model.GeNNModel.T

◆ use_backend

pygenn.genn_model.GeNNModel.use_backend

◆ use_cpu

pygenn.genn_model.GeNNModel.use_cpu

The documentation for this class was generated from the following file: