Skip to content

Commit

Permalink
use shorter-form PyGeNN class names
Browse files Browse the repository at this point in the history
  • Loading branch information
neworderofjamie committed Oct 26, 2021
1 parent 3952972 commit cfaeec9
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions doxygen/02_Quickstart.dox
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ There are several steps to be completed to define a neuronal network model.
\ref sect_new_var_init section for more information on
initialising these variables to hetererogenous values.

c) A pygenn.genn_model.GeNNModel object needs to be created and the floating point precision to use should be set (see \ref floatPrecision for more information on floating point precision), i.e.
c) A pygenn.GeNNModel object needs to be created and the floating point precision to use should be set (see \ref floatPrecision for more information on floating point precision), i.e.
\code
model = GeNNModel("float", "example")
\endcode
Expand All @@ -266,7 +266,7 @@ There are several steps to be completed to define a neuronal network model.
model.load()
\endcode
\note
If the model isn't changed, pygenn.genn_model.GeNNModel.build doesn't need to be called.
If the model isn't changed, pygenn.GeNNModel.build doesn't need to be called.

4. Also, within the same script, the programmer defines their own "simulation" code. In this code,

Expand All @@ -279,7 +279,7 @@ There are several steps to be completed to define a neuronal network model.
\note
The initial values or initialisation "snippets" specified when defining the model are automatically applied.

c) They use pygenn.genn_model.GeNNModel.step_time() to run one time step on either the CPU or GPU depending on the available hardware.
c) They use pygenn.GeNNModel.step_time() to run one time step on either the CPU or GPU depending on the available hardware.

d) They use functions like pygenn.genn_groups.Group.pull_state_from_device etc to transfer the
results from GPU calculations to the main memory of the host computer
Expand Down
4 changes: 2 additions & 2 deletions doxygen/07_PyGeNN.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/*! \page PyGeNN Python interface (PyGeNN)

As well as being able to build GeNN models and user code directly from C++, you can also access all GeNN features from Python.
The ``pygenn.genn_model.GeNNModel`` class provides a thin wrapper around ``ModelSpec`` as well as providing support for loading and running simulations; and accessing their state.
``SynapseGroup``, ``NeuronGroup`` and ``CurrentSource`` are similarly wrapped by the ``pygenn.genn_groups.SynapseGroup``, ``pygenn.genn_groups.NeuronGroup`` and ``pygenn.genn_groups.CurrentSource`` classes respectively.
The ``pygenn.GeNNModel`` class provides a thin wrapper around ``ModelSpec`` as well as providing support for loading and running simulations; and accessing their state.
``SynapseGroup``, ``NeuronGroup`` and ``CurrentSource`` are similarly wrapped by the ``pygenn.SynapseGroup``, ``pygenn.NeuronGroup`` and ``pygenn.CurrentSource`` classes respectively.

Full installation instructions can be found in \ref pygenn. The following example shows how PyGeNN can be easily interfaced with standard Python packages such as numpy and matplotlib to plot 4 different Izhikevich neuron regimes:

Expand Down
8 changes: 4 additions & 4 deletions doxygen/09_ReleaseNotes.dox
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ User Side Changes
5. To aid debugging, debug versions of PyGeNN can now be built (see \ref Debugging).
6. OpenCL performance on AMD devices is improved - this has only been tested on a Radeon RX 5700 XT so any feedback from users with other devices would be much appreciated.
7. Exceptions raised by GeNN are now correctly passed through PyGeNN to Python.
8. Spike times (and spike-like event times) can now be accessed, pushed and pulled from PyGeNN (see ``pygenn.genn_groups.NeuronGroup.spike_times``, ``pygenn.genn_groups.NeuronGroup.push_spike_times_to_device`` and ``pygenn.genn_groups.NeuronGroup.pull_spike_times_from_device`` )
9. On models where postsynaptic merging isn't enabled, the postsynaptic input current from a synapse group can now be accessed from PyGeNN via ``pygenn.genn_groups.SynapseGroup.in_syn``; and pushed and pulled with ``pygenn.genn_groups.SynapseGroup.push_in_syn_to_device`` and ``pygenn.genn_groups.SynapseGroup.pull_in_syn_from_device`` respectively.
10. Accessing extra global parameters from PyGeNN was previously rather cumbersome. Now, you don't need to manually pass a size to e.g. ``pygenn.genn_groups.NeuronGroup.pull_extra_global_param_from_device`` and, if you are using non-pointer extra global parameters, you no longer need to call e.g. ``pygenn.genn_groups.NeuronGroup.set_extra_global_param`` before loading your model.
8. Spike times (and spike-like event times) can now be accessed, pushed and pulled from PyGeNN (see ``pygenn.NeuronGroup.spike_times``, ``pygenn.NeuronGroup.push_spike_times_to_device`` and ``pygenn.NeuronGroup.pull_spike_times_from_device`` )
9. On models where postsynaptic merging isn't enabled, the postsynaptic input current from a synapse group can now be accessed from PyGeNN via ``pygenn.SynapseGroup.in_syn``; and pushed and pulled with ``pygenn.SynapseGroup.push_in_syn_to_device`` and ``pygenn.SynapseGroup.pull_in_syn_from_device`` respectively.
10. Accessing extra global parameters from PyGeNN was previously rather cumbersome. Now, you don't need to manually pass a size to e.g. ``pygenn.NeuronGroup.pull_extra_global_param_from_device`` and, if you are using non-pointer extra global parameters, you no longer need to call e.g. ``pygenn.NeuronGroup.set_extra_global_param`` before loading your model.

Bug fixes:
----
Expand Down Expand Up @@ -130,7 +130,7 @@ User Side Changes
1. Previously GeNN performed poorly with large numbers of populations. This version includes a new code generator which effectively solves this problem (see \cite Knight2020).
2. ``InitSparseConnectivitySnippet::Base`` row build state and ``NeuronModels::Base`` additional input variables could previously only be initialised with a numeric value. Now they can be initialised with a code string supporting substitutions etc.
3. Added GeNN implementation of cortical microcircuit model \cite Potjans2012 to userprojects (discussed further in \cite Knight2018). Also demonstrates how to dynamically load GeNN models rather than linking against them.
4. Previously one pushed states and spikes to and from device in PyGeNN using methods like ``pygenn.GeNNModel.push_current_spikes_to_device`` which was somewhat cumbersome. These have now been wrapped in methods like ``pygenn.genn_groups.NeuronGroup.push_current_spikes_to_device`` which is somewhat nicer.
4. Previously one pushed states and spikes to and from device in PyGeNN using methods like ``pygenn.GeNNModel.push_current_spikes_to_device`` which was somewhat cumbersome. These have now been wrapped in methods like ``pygenn.NeuronGroup.push_current_spikes_to_device`` which is somewhat nicer.
5. The ``CodeGenerator::generateAll`` function now returns memory estimates which are, in turn, returned from ``pygenn.GeNNModel.build``.
6. To better support batching of inputs into multiple instances of the same model, added ``ModelSpec::addSlaveSynapsePopulation`` to add synapse populations which share per-synapse state with a 'master' synapse group.
7. Added extra global parameters to variable initialisation snippets - can be used for lookup table style functionality.
Expand Down
26 changes: 13 additions & 13 deletions doxygen/10_UserManual.dox
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tasks must be completed:
\add_toggle_python
A network model is defined as follows:
\end_toggle
1. \add_cpp_python_text{The name of the model must be defined,A pygenn.genn_model.GeNNModel must be created with a name and a default precision (see \ref floatPrecision)}:
1. \add_cpp_python_text{The name of the model must be defined,A pygenn.GeNNModel must be created with a name and a default precision (see \ref floatPrecision)}:
\add_toggle_code_cpp
model.setName("MyModel");
\end_toggle_code
Expand Down Expand Up @@ -145,8 +145,8 @@ where the arguments are
\arg \add_cpp_python_text{`const string &name`,`pop_name`}: The name of the synapse population
\arg \add_cpp_python_text{`::SynapseMatrixType mType`: How,`matrix_type`: String specifying how} the synaptic matrix is stored. See \ref subsect34 for available options.
\arg \add_cpp_python_text{`unsigned int delay`,`delay_steps`}: Homogeneous (axonal) delay for synapse population (in terms of the simulation time step `DT`).
\arg \add_cpp_python_text{`const string preName`: Name, `source`: pygenn.genn_groups.NeuronGroup or name} of the (existing!) presynaptic neuron population.
\arg \add_cpp_python_text{`const string postName`: Name, `target`: pygenn.genn_groups.NeuronGroup or name} of the (existing!) postsynaptic neuron population.
\arg \add_cpp_python_text{`const string preName`: Name, `source`: pygenn.NeuronGroup or name} of the (existing!) presynaptic neuron population.
\arg \add_cpp_python_text{`const string postName`: Name, `target`: pygenn.NeuronGroup or name} of the (existing!) postsynaptic neuron population.
\arg \add_cpp_python_text{`WeightUpdateModel::ParamValues weightParamValues`: The, `wu_param_space`: Dictionary containing the} parameter values (common to all synapses of the population) for the weight update model.
\arg \add_cpp_python_text{``WeightUpdateModel::VarValues weightVarInitialisers`: The, `wu_var_space`: Dictionary containing the} initial values or initialisation snippets for the weight update model's state variables (see \ref sectVariableInitialisation)
\arg \add_cpp_python_text{`WeightUpdateModel::PreVarValues weightPreVarInitialisers`: The, `wu_pre_var_space`: Dictionary containing the} initial values or initialisation snippets for the weight update model's presynaptic state variables (see \ref sectVariableInitialisation)
Expand All @@ -166,8 +166,8 @@ When using a sparse connectivity initialisation snippet, these values are set au
- SynapseGroup::setPSTargetVar() sets the additional input variable (or standard "Isyn") on the postsynaptic neuron population where input from this synapse group is routed (see section \ref neuron_additional_input).
\end_toggle
\add_toggle_python
The pygenn.GeNNModel.add_synapse_population function returns a pygenn.genn_groups.SynapseGroup object which can be further configured, namely with:
- pygenn.genn_groups.SynapseGroup.ps_target_var sets the additional input variable (or standard "Isyn") on the postsynaptic neuron population where input from this synapse group is routed (see section \ref neuron_additional_input).
The pygenn.GeNNModel.add_synapse_population function returns a pygenn.SynapseGroup object which can be further configured, namely with:
- pygenn.SynapseGroup.ps_target_var sets the additional input variable (or standard "Isyn") on the postsynaptic neuron population where input from this synapse group is routed (see section \ref neuron_additional_input).
\end_toggle

\note
Expand Down Expand Up @@ -233,7 +233,7 @@ Read-write state variables are duplicated for each batch and, by default, read-o
//----------------------------------------------------------------------------
/*!
\page sectNeuronModels Neuron models
There is a number of predefined models which can be used with the \add_cpp_python_text{ModelSpec::addNeuronPopulation,pygenn.genn_model.GeNNModel.add_neuron_population} method:
There is a number of predefined models which can be used with the \add_cpp_python_text{ModelSpec::addNeuronPopulation,pygenn.GeNNModel.add_neuron_population} method:
- NeuronModels::RulkovMap
- NeuronModels::Izhikevich
- NeuronModels::IzhikevichVariable
Expand Down Expand Up @@ -268,7 +268,7 @@ For convenience, \add_cpp_python_text{the methods this class should implement ca
\add_toggle_cpp The length of this list should match the NUM_PARAM specified in DECLARE_MODEL. \end_toggle
Parameters are assumed to be always of type double.
- \add_cpp_python_text{SET_VARS(),`var_name_types`} defines the names, type strings (e.g. "float", "double", etc) and (optionally) access mode
of the neuron state variables. The type string "scalar" can be used for variables which should be implemented using the precision set globally for the model \add_cpp_python_text{with ModelSpec::setPrecision, from ``pygenn.genn_model.GeNNModel.__init__``}.
of the neuron state variables. The type string "scalar" can be used for variables which should be implemented using the precision set globally for the model \add_cpp_python_text{with ModelSpec::setPrecision, from ``pygenn.GeNNModel.__init__``}.
The variables defined here as `NAME` can then be used in the
syntax \$(NAME) in the code string. If the access mode is set to \add_cpp_python_text{``VarAccess::READ_ONLY``,``VarAccess_READ_ONLY``}, GeNN applies additional optimisations and models should not write to it.
By default such read-only variables are shared across all batches (see section \ref batching).
Expand Down Expand Up @@ -833,17 +833,17 @@ Weight update model variables associated with the sparsely connected synaptic po
- SynapseMatrixConnectivity::BITMASK is an alternative sparse matrix implementation where which synapses within the matrix are present is specified as a binary array (see \ref ex_mbody). This structure is somewhat less efficient than the ``SynapseMatrixConnectivity::SPARSE`` format and doesn't allow individual weights per synapse. However it does require the smallest amount of GPU memory for large networks.
- SynapseMatrixConnectivity::PROCEDURAL is a new approach where, rather than being stored in memory, connectivity described using \ref sectSparseConnectivityInitialisation is generated 'on the fly' as spikes are processed (see \cite Knight2020 for more information). Therefore, this approach offers very large memory savings for a small performance cost but does not currently support plasticity.

\add_python_text{In Python\, SynapseMatrixConnectivity::SPARSE connectivity can be manually initialised from lists of pre and postsynaptic indices using the pygenn.genn_groups.SynapseGroup.set_sparse_connections method.}
\add_python_text{In Python\, SynapseMatrixConnectivity::SPARSE connectivity can be manually initialised from lists of pre and postsynaptic indices using the pygenn.SynapseGroup.set_sparse_connections method.}
Furthermore the SynapseMatrixWeight defines how
- SynapseMatrixWeight::INDIVIDUAL allows each individual synapse to have unique weight update model variables.
Their values must be initialised at runtime and, if running on the GPU, copied across from the user side code, using the \c pushXXXXXStateToDevice function, where XXXX is the name of the synapse population.
- SynapseMatrixWeight::INDIVIDUAL_PSM allows each postsynapic neuron to have unique post synaptic model variables.
Their values must be initialised at runtime and, if running on the GPU, copied across from the user side code, using the \c pushXXXXXStateToDevice function, where XXXX is the name of the synapse population.
- SynapseMatrixWeight::GLOBAL saves memory by only maintaining one copy of the weight update model variables.
This is automatically initialized to the initial value passed to \add_cpp_python_text{ModelSpec::addSynapsePopulation, pygenn.genn_model.GeNNModel.add_synapse_population}.
This is automatically initialized to the initial value passed to \add_cpp_python_text{ModelSpec::addSynapsePopulation, pygenn.GeNNModel.add_synapse_population}.
- SynapseMatrixWeight::PROCEDURAL generates weight update model variable values described using \ref sectVariableInitialisation 'on the fly' as spikes are processed. This is typically used alongside SynapseMatrixConnectivity::PROCEDURAL for large models with static connectivity and weights/delays sampled from probability distributions (see \cite Knight2020 for an example).

Only certain combinations of SynapseMatrixConnectivity and SynapseMatrixWeight are sensible therefore, to reduce confusion, the SynapseMatrixType enumeration defines the following options which can be passed to \add_cpp_python_text{ModelSpec::addSynapsePopulation, pygenn.genn_model.GeNNModel.add_synapse_population}:
Only certain combinations of SynapseMatrixConnectivity and SynapseMatrixWeight are sensible therefore, to reduce confusion, the SynapseMatrixType enumeration defines the following options which can be passed to \add_cpp_python_text{ModelSpec::addSynapsePopulation, pygenn.GeNNModel.add_synapse_population}:
- SynapseMatrixType::SPARSE_GLOBALG
- SynapseMatrixType::SPARSE_GLOBALG_INDIVIDUAL_PSM
- SynapseMatrixType::SPARSE_INDIVIDUALG
Expand Down Expand Up @@ -1013,7 +1013,7 @@ wu_pre_var_ref = {"R": genn_model.create_wu_pre_var_ref(sg, "Pre")}
wu_post_var_ref = {"R": genn_model.create_wu_post_var_ref(sg, "Post")}
\endcode
\end_toggle
where ng is a \add_cpp_python_text{NeuronGroup pointer (as returned by ModelSpec::addNeuronPopulation),pygenn.genn_groups.NeuronGroup (as returned by pygenn.genn_model.GeNNModel.add_neuron_population)}, cs is a \add_cpp_python_text{CurrentSource pointer (as returned by ModelSpec::addCurrentSource),pygenn.genn_groups.CurrentSource (as returned by pygenn.genn_model.GeNNModel.add_current_source)}, cu is a \add_cpp_python_text{CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate),pygenn.genn_groups.CustomUpdate (as returned by pygenn.genn_model.GeNNModel.add_custom_update)} and sg is a \add_cpp_python_text{SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation),pygenn.genn_groups.SynapseGroup (as returned by pygenn.genn_model.GeNNModel.add_synapse_population)}.
where ng is a \add_cpp_python_text{NeuronGroup pointer (as returned by ModelSpec::addNeuronPopulation),pygenn.NeuronGroup (as returned by pygenn.GeNNModel.add_neuron_population)}, cs is a \add_cpp_python_text{CurrentSource pointer (as returned by ModelSpec::addCurrentSource),pygenn.CurrentSource (as returned by pygenn.GeNNModel.add_current_source)}, cu is a \add_cpp_python_text{CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate),pygenn.genn_groups.CustomUpdate (as returned by pygenn.GeNNModel.add_custom_update)} and sg is a \add_cpp_python_text{SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation),pygenn.SynapseGroup (as returned by pygenn.GeNNModel.add_synapse_population)}.

While references of these types can be used interchangably in the same custom update, as long as all referenced variables have the same delays and belong to populations of the same size, per-synapse weight update model variables must be referenced with slightly different syntax:
\add_toggle_code_cpp
Expand All @@ -1024,7 +1024,7 @@ SetTime::WUVarReferences cuWUVarReferences(createWUVarRef(cu, "g"));
wu_var_ref = {"R": create_wu_var_ref(sg, "g")}
cu_wu_var_ref = {"R": create_wu_var_ref(cu, "g")}
\end_toggle_code
where sg is a \add_cpp_python_text{SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation),pygenn.genn_groups.SynapseGroup (as returned by pygenn.genn_model.GeNNModel.add_synapse_population)} and cu is a \add_cpp_python_text{CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate),pygenn.genn_groups.CustomUpdate (as returned by pygenn.genn_model.GeNNModel.add_custom_update)} which operates on another synapse group's state variables.
where sg is a \add_cpp_python_text{SynapseGroup pointer (as returned by ModelSpec::addSynapsePopulation),pygenn.SynapseGroup (as returned by pygenn.GeNNModel.add_synapse_population)} and cu is a \add_cpp_python_text{CustomUpdate pointer (as returned by ModelSpec::addCustomUpdate),pygenn.genn_groups.CustomUpdate (as returned by pygenn.GeNNModel.add_custom_update)} which operates on another synapse group's state variables.

These 'weight update variable references' also have the additional feature that they can be used to define a link to a 'transpose' variable:
\add_toggle_code_cpp
Expand All @@ -1033,7 +1033,7 @@ SetTime::WUVarReferences wuTransposeVarReferences(createWUVarRef(sg, "g", backSG
\add_toggle_code_python
wu_transpose_var_ref = {"R": create_wu_var_ref(sg, "g", back_sg, "g")}
\end_toggle_code
where \add_cpp_python_text{backSG is another SynapseGroup pointer,back_sg is another pygenn.genn_groups.SynapseGroup} with tranposed dimensions to sg i.e. its <i>postsynaptic</i> population has the same number of neurons as sg's <i>presynaptic</i> population and vice-versa.
where \add_cpp_python_text{backSG is another SynapseGroup pointer,back_sg is another pygenn.SynapseGroup} with tranposed dimensions to sg i.e. its <i>postsynaptic</i> population has the same number of neurons as sg's <i>presynaptic</i> population and vice-versa.

After the update has run, any updates made to the 'forward' variable will also be applied to the tranpose variable.
\note
Expand Down
Loading

0 comments on commit cfaeec9

Please sign in to comment.