GeNN  4.9.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="float", model_name="GeNNModel", backend=None, time_precision=None, genn_log_level=genn_wrapper.warning, code_gen_log_level=genn_wrapper.warning, backend_log_level=genn_wrapper.warning, preference_kwargs)
 Init GeNNModel. More...
 
def use_backend (self)
 
def use_backend (self, backend)
 
def timing_enabled (self)
 
def timing_enabled (self, timing)
 
def batch_size (self)
 
def batch_size (self, batch_size)
 
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 free_device_mem_bytes (self)
 
def dT (self)
 Step size. More...
 
def dT (self, dt)
 
def neuron_update_time (self)
 
def init_time (self)
 
def presynaptic_update_time (self)
 
def postsynaptic_update_time (self)
 
def synapse_dynamics_time (self)
 
def init_sparse_time (self)
 
def get_custom_update_time (self, name)
 
def get_custom_update_transpose_time (self, name)
 
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_slave_synapse_population (self, pop_name, master_pop, delay_steps, source, target, postsyn_model, ps_param_space, ps_var_space)
 Add a 'slave' population to the GeNN model which shares weights and connectivity with a 'master' population. More...
 
def add_current_source (self, cs_name, current_source_model, pop, param_space, var_space)
 Add a current source to the GeNN model. More...
 
def add_custom_update (self, cu_name, group_name, custom_update_model, param_space, var_space, var_ref_space, egp_ref_space={})
 Add a current source to the GeNN model. More...
 
def build (self, path_to_model="./", force_rebuild=False)
 Finalize and build a GeNN model. More...
 
def load (self, path_to_model="./", num_recording_timesteps=None)
 import the model as shared library and initialize it More...
 
def unload (self)
 
def reinitialise (self)
 reinitialise model to its original state without re-loading More...
 
def step_time (self)
 Make one simulation step. More...
 
def custom_update (self, name)
 Perform custom update. 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_spike_events_from_device (self, pop_name)
 Pull spike events 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 pull_current_spike_events_from_device (self, pop_name)
 Pull spike events from the device for a given population. More...
 
def pull_connectivity_from_device (self, pop_name)
 Pull connectivity from the device for a given population. More...
 
def pull_var_from_device (self, pop_name, var_name)
 Pull variable from the device for a given population. More...
 
def pull_extra_global_param_from_device (self, pop_name, egp_name, size=None)
 Pull extra global parameter 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 to the device for a given population. More...
 
def push_spike_events_to_device (self, pop_name)
 Push spike events to the device for a given population. More...
 
def push_current_spikes_to_device (self, pop_name)
 Push current spikes to the device for a given population. More...
 
def push_current_spike_events_to_device (self, pop_name)
 Push current spike events to the device for a given population. More...
 
def push_connectivity_to_device (self, pop_name)
 Push connectivity to the device for a given population. More...
 
def push_var_to_device (self, pop_name, var_name)
 Push variable to the device for a given population. More...
 
def push_extra_global_param_to_device (self, pop_name, egp_name, size=None)
 Push extra global parameter to the device for a given population. More...
 
def pull_recording_buffers_from_device (self)
 Pull recording buffers from device. More...
 
def end (self)
 Free memory. More...
 

Public Attributes

 use_backend
 
 backend_log_level
 
 default_var_location
 
 model_name
 
 neuron_populations
 
 synapse_populations
 
 current_sources
 
 custom_updates
 
 dT
 
 genn_types
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

def pygenn.genn_model.GeNNModel.__init__ (   self,
  precision = "float",
  model_name = "GeNNModel",
  backend = None,
  time_precision = None,
  genn_log_level = genn_wrapper.warning,
  code_gen_log_level = genn_wrapper.warning,
  backend_log_level = genn_wrapper.warning,
  preference_kwargs 
)

Init GeNNModel.

Parameters
precisionstring precision as string ("float", "double" or "long double"). defaults to float.
model_namestring name of the model. Defaults to "GeNNModel".
backendstring specifying name of backend module to use Defaults to None to pick 'best' backend for your system
time_precisionstring time precision as string ("float", "double" or "long double"). defaults to float.
genn_log_levelLog level for GeNN
code_gen_log_levelLog level for GeNN code-generator
backend_log_levelLog level for backend
preference_kwargsAdditional keyword arguments to set in backend preferences structure

Member Function Documentation

◆ add_current_source()

def pygenn.genn_model.GeNNModel.add_current_source (   self,
  cs_name,
  current_source_model,
  pop,
  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 pygenn.genn_wrapper.CurrentSourceModels.Custom (see also pygenn.genn_model.create_custom_current_source_class)
poppopulation into which the current source should be injected (either name or NeuronGroup object)
param_spacedict with param values for the CurrentSourceModels class
var_spacedict with initial variable values for the CurrentSourceModels class

◆ add_custom_update()

def pygenn.genn_model.GeNNModel.add_custom_update (   self,
  cu_name,
  group_name,
  custom_update_model,
  param_space,
  var_space,
  var_ref_space,
  egp_ref_space = {} 
)

Add a current source to the GeNN model.

Parameters
cu_namename of the new current source
group_namename of
custom_update_modeltype of the CustomUpdateModel class as string or instance of CustomUpdateModel class derived from pygenn.genn_wrapper.CustomUpdateModel.Custom (see also pygenn.genn_model.create_custom_custom_update_class)
param_spacedict with param values for the CustomUpdateModel class
var_spacedict with initial variable values for the CustomUpdateModel class
var_ref_spacedict with variable references for the CustomUpdateModel class
egp_ref_spacedict with extra global parameter references for the CustomUpdateModel class

◆ add_neuron_population()

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 pygenn.genn_wrapper.NeuronModels.Custom (see also pygenn.genn_model.create_custom_neuron_class)
param_spacedict with param values for the NeuronModels class
var_spacedict with initial variable values for the NeuronModels class

◆ add_slave_synapse_population()

def pygenn.genn_model.GeNNModel.add_slave_synapse_population (   self,
  pop_name,
  master_pop,
  delay_steps,
  source,
  target,
  postsyn_model,
  ps_param_space,
  ps_var_space 
)

Add a 'slave' population to the GeNN model which shares weights and connectivity with a 'master' population.

Parameters
pop_namename of the new population
master_popmaster synapse group to share weights with (either name or SynapseGroup object)
delay_stepsdelay in number of steps
sourcesource neuron group (either name or NeuronGroup object)
targettarget neuron group (either name or NeuronGroup object)
postsyn_modeltype of the PostsynapticModels class as string or instance of postsynaptic model class derived from pygenn.genn_wrapper.PostsynapticModels.Custom (see also pygenn.genn_model.create_custom_postsynaptic_class)
ps_param_spacedict with param values for the PostsynapticModels class
ps_var_spacedict with initial variable values for the PostsynapticModels class

◆ add_synapse_population()

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 (either name or NeuronGroup object)
targettarget neuron group (either name or NeuronGroup object)
w_update_modeltype of the WeightUpdateModels class as string or instance of weight update model class derived from pygenn.genn_wrapper.WeightUpdateModels.Custom (see also pygenn.genn_model.create_custom_weight_update_class)
wu_param_spacedict with param values for the WeightUpdateModels class
wu_var_spacedict with initial values for WeightUpdateModels state variables
wu_pre_var_spacedict with initial values for WeightUpdateModels presynaptic variables
wu_post_var_spacedict with initial values for WeightUpdateModels postsynaptic variables
postsyn_modeltype of the PostsynapticModels class as string or instance of postsynaptic model class derived from pygenn.genn_wrapper.PostsynapticModels.Custom (see also pygenn.genn_model.create_custom_postsynaptic_class)
ps_param_spacedict with param values for the PostsynapticModels class
ps_var_spacedict with initial variable values for the PostsynapticModels class
connectivity_initialiserInitSparseConnectivitySnippet::Init for connectivity

◆ batch_size() [1/2]

def pygenn.genn_model.GeNNModel.batch_size (   self)

◆ batch_size() [2/2]

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

◆ build()

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

Finalize and build a GeNN model.

Parameters
path_to_modelpath where to place the generated model code. Defaults to the local directory.
force_rebuildshould model be rebuilt even if it doesn't appear to be required

◆ custom_update()

def pygenn.genn_model.GeNNModel.custom_update (   self,
  name 
)

Perform custom update.

◆ 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_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 
)

◆ dT() [1/2]

def pygenn.genn_model.GeNNModel.dT (   self)

Step size.

◆ dT() [2/2]

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

◆ end()

def pygenn.genn_model.GeNNModel.end (   self)

Free memory.

◆ free_device_mem_bytes()

def pygenn.genn_model.GeNNModel.free_device_mem_bytes (   self)

◆ get_custom_update_time()

def pygenn.genn_model.GeNNModel.get_custom_update_time (   self,
  name 
)

◆ get_custom_update_transpose_time()

def pygenn.genn_model.GeNNModel.get_custom_update_transpose_time (   self,
  name 
)

◆ init_sparse_time()

def pygenn.genn_model.GeNNModel.init_sparse_time (   self)

◆ init_time()

def pygenn.genn_model.GeNNModel.init_time (   self)

◆ load()

def pygenn.genn_model.GeNNModel.load (   self,
  path_to_model = "./",
  num_recording_timesteps = None 
)

import the model as shared library and initialize it

◆ model_name() [1/2]

def pygenn.genn_model.GeNNModel.model_name (   self)

Name of the model.

◆ model_name() [2/2]

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

◆ neuron_update_time()

def pygenn.genn_model.GeNNModel.neuron_update_time (   self)

◆ postsynaptic_update_time()

def pygenn.genn_model.GeNNModel.postsynaptic_update_time (   self)

◆ presynaptic_update_time()

def pygenn.genn_model.GeNNModel.presynaptic_update_time (   self)

◆ pull_connectivity_from_device()

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

Pull connectivity from the device for a given population.

◆ pull_current_spike_events_from_device()

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

Pull spike events from the device for a given population.

◆ pull_current_spikes_from_device()

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

Pull spikes from the device for a given population.

◆ pull_extra_global_param_from_device()

def pygenn.genn_model.GeNNModel.pull_extra_global_param_from_device (   self,
  pop_name,
  egp_name,
  size = None 
)

Pull extra global parameter from the device for a given population.

◆ pull_recording_buffers_from_device()

def pygenn.genn_model.GeNNModel.pull_recording_buffers_from_device (   self)

Pull recording buffers from device.

◆ pull_spike_events_from_device()

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

Pull spike events from the device for a given population.

◆ pull_spikes_from_device()

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()

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

Pull state from the device for a given population.

◆ pull_var_from_device()

def pygenn.genn_model.GeNNModel.pull_var_from_device (   self,
  pop_name,
  var_name 
)

Pull variable from the device for a given population.

◆ push_connectivity_to_device()

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

Push connectivity to the device for a given population.

◆ push_current_spike_events_to_device()

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

Push current spike events to the device for a given population.

◆ push_current_spikes_to_device()

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

Push current spikes to the device for a given population.

◆ push_extra_global_param_to_device()

def pygenn.genn_model.GeNNModel.push_extra_global_param_to_device (   self,
  pop_name,
  egp_name,
  size = None 
)

Push extra global parameter to the device for a given population.

◆ push_spike_events_to_device()

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

Push spike events to the device for a given population.

◆ push_spikes_to_device()

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

Push spikes to the device for a given population.

◆ push_state_to_device()

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

Push state to the device for a given population.

◆ push_var_to_device()

def pygenn.genn_model.GeNNModel.push_var_to_device (   self,
  pop_name,
  var_name 
)

Push variable to the device for a given population.

◆ reinitialise()

def pygenn.genn_model.GeNNModel.reinitialise (   self)

reinitialise model to its original state without re-loading

◆ step_time()

def pygenn.genn_model.GeNNModel.step_time (   self)

Make one simulation step.

◆ synapse_dynamics_time()

def pygenn.genn_model.GeNNModel.synapse_dynamics_time (   self)

◆ t() [1/2]

def pygenn.genn_model.GeNNModel.t (   self)

Simulation time in ms.

◆ t() [2/2]

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

◆ timestep() [1/2]

def pygenn.genn_model.GeNNModel.timestep (   self)

Simulation time step.

◆ timestep() [2/2]

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

◆ timing_enabled() [1/2]

def pygenn.genn_model.GeNNModel.timing_enabled (   self)

◆ timing_enabled() [2/2]

def pygenn.genn_model.GeNNModel.timing_enabled (   self,
  timing 
)

◆ unload()

def pygenn.genn_model.GeNNModel.unload (   self)

◆ 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 
)

Member Data Documentation

◆ backend_log_level

pygenn.genn_model.GeNNModel.backend_log_level

◆ current_sources

pygenn.genn_model.GeNNModel.current_sources

◆ custom_updates

pygenn.genn_model.GeNNModel.custom_updates

◆ default_var_location

pygenn.genn_model.GeNNModel.default_var_location

◆ dT

pygenn.genn_model.GeNNModel.dT

◆ genn_types

pygenn.genn_model.GeNNModel.genn_types

◆ model_name

pygenn.genn_model.GeNNModel.model_name

◆ neuron_populations

pygenn.genn_model.GeNNModel.neuron_populations

◆ synapse_populations

pygenn.genn_model.GeNNModel.synapse_populations

◆ use_backend

pygenn.genn_model.GeNNModel.use_backend

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