ANNarchy 5.0.0
  • ANNarchy
  • Installation
  • Tutorial
  • Manual
  • Notebooks
  • Reference

  • ANNarchy
  • Core components
    • Network
    • Population
    • Projection
    • Monitor
    • PopulationView
    • Dendrite
  • Neuron and Synapse models
    • Neuron
    • Synapse
    • Parameter
    • Variable
    • Creating
    • Pruning
    • Constant
  • Neuron models
    • LeakyIntegrator
    • Izhikevich
    • IF_curr_exp
    • IF_cond_exp
    • IF_curr_alpha
    • IF_cond_alpha
    • HH_cond_exp
    • EIF_cond_alpha_isfa_ista
    • EIF_cond_exp_isfa_ista
  • Synapse models
    • Hebb
    • Oja
    • IBCM
    • STP
    • STDP
  • Inputs
    • InputArray
    • TimedArray
    • PoissonPopulation
    • TimedPoissonPopulation
    • SpikeSourceArray
    • HomogeneousCorrelatedSpikeTrains
    • CurrentInjection
    • DecodingProjection
    • ImagePopulation
    • VideoPopulation
  • Random Distributions
    • Uniform
    • DiscreteUniform
    • Normal
    • LogNormal
    • Exponential
    • Gamma
    • Binomial
  • Functions
    • add_function
    • functions
  • Callbacks
    • every
  • Utilities
    • report
    • timeit
    • sparse_random_matrix
    • sparse_delays_from_weights
    • magic_network
  • Convolution
    • Convolution
    • Pooling
    • Transpose
    • Copy
  • BOLD monitoring
    • BoldMonitor
    • BoldModel
    • balloon_RN
    • balloon_RL
    • balloon_CN
    • balloon_CL
    • balloon_maith2021
    • balloon_two_inputs
  • Tensorboard logging
    • Logger
  • ANN-to-SNN conversion
    • ANNtoSNNConverter
  • DEPRECATED Top-level API
    • setup
    • compile
    • clear
    • reset
    • set_seed
    • get_population
    • get_projection
    • populations
    • projections
    • monitors
    • simulate
    • simulate_until
    • step
    • enable_learning
    • disable_learning
    • get_time
    • set_time
    • get_current_step
    • set_current_step
    • dt
    • save
    • load
    • save_parameters
    • load_parameters
    • callbacks_enabled
    • disable_callbacks
    • enable_callbacks
    • clear_all_callbacks

On this page

  • ANNarchy
    • Core components
    • Neuron and Synapse models
    • Neuron models
    • Synapse models
    • Inputs
    • Random Distributions
    • Functions
    • Callbacks
    • Utilities
    • Convolution
    • BOLD monitoring
    • Tensorboard logging
    • ANN-to-SNN conversion
    • DEPRECATED Top-level API

ANNarchy

Core components

Basic objects composing a network. The Network class is the main access point for all functionalities.

Network A network creates the populations, projections and monitors, and controls the simulation.
Population Population of neurons.
Projection Projection between two populations.
Monitor Object allowing to record variables from Population, PopulationView, Dendrite or Projection instances.
PopulationView Subset of a Population.
Dendrite Sub-group of a Projection for a single post-synaptic neuron.

Neuron and Synapse models

Objects allowing to design neuron and synapse models.

Neuron Base class to define a neuron model.
Synapse Base class to define a synapse model.
Parameter Dataclass to represent a parameter in a Neuron or Synapse definition.
Variable Dataclass to represent a variable in a Neuron or Synapse definition.
Creating Dataclass to represent a creation condition for structural plasticity.
Pruning Dataclass to represent a pruning condition for structural plasticity.
Constant Constant parameter that can be used by all neurons and synapses.

Neuron models

Default neuron models that can be used directly. The naming follows the PyNN convention.

LeakyIntegrator Leaky-integrator rate-coded neuron, optionally noisy.
Izhikevich Izhikevich quadratic spiking neuron.
IF_curr_exp Leaky integrate-and-fire model with fixed threshold and decaying-exponential post-synaptic current.
IF_cond_exp Leaky integrate-and-fire model with fixed threshold and decaying-exponential post-synaptic conductance.
IF_curr_alpha Leaky integrate-and-fire model with fixed threshold and alpha post-synaptic currents.
IF_cond_alpha Leaky integrate-and-fire model with fixed threshold and alpha post-synaptic conductance.
HH_cond_exp Single-compartment Hodgkin-Huxley-type neuron with transient sodium and delayed-rectifier potassium currents using the ion channel models from Traub.
EIF_cond_alpha_isfa_ista Exponential integrate-and-fire neuron with spike triggered and sub-threshold adaptation conductances (isfa, ista reps.), alpha post-synaptic conductances.
EIF_cond_exp_isfa_ista Exponential integrate-and-fire neuron with spike triggered and sub-threshold adaptation currents (isfa, ista reps.), decaying-exponential post-synaptic conductances.

Synapse models

Default synapse models that can be used directly.

Hebb Rate-coded synapse with Hebbian plasticity.
Oja Rate-coded synapse with regularized Hebbian plasticity (Oja).
IBCM Rate-coded synapse with Intrator & Cooper (1992) plasticity.
STP Synapse exhibiting short-term facilitation and depression.
STDP Spike-timing dependent plasticity, online version.

Inputs

Input populations that can be used to stimulate the networks.

Input populations can be passed to Network.create() directly, e.g.:

pop1 = net.create(ann.PoissonPopulation(100, rates=15.))

Input projections (CurrentInjection and DecodingProjection) can be passed to Network.connect():

net.connect(ann.DecodingProjection(pop1, pop2, 'exc', window=10.0))
InputArray Population holding static inputs for a rate-coded network.
TimedArray Data structure holding sequential inputs for a rate-coded network.
PoissonPopulation Population of spiking neurons following a Poisson distribution.
TimedPoissonPopulation Poisson population whose rate vary with the provided schedule.
SpikeSourceArray Spike source generating spikes at the times given in the spike_times array.
HomogeneousCorrelatedSpikeTrains Population of spiking neurons following a homogeneous distribution with correlated spike trains.
CurrentInjection Inject current from a rate-coded population into a spiking population.
DecodingProjection Decoding projection to transform spike trains into firing rates.
ImagePopulation Rate-coded Population allowing to represent images (png, jpg…) as the firing rate of a population (each neuron represents one pixel).
VideoPopulation Rate-coded Population allowing to feed a webcam input into the firing rate of a population (each neuron represents one pixel).

Random Distributions

Random distributions that can be used to generate numpy arrays.

Uniform Uniform distribution between min and max.
DiscreteUniform Discrete uniform distribution between min and max.
Normal Normal distribution.
LogNormal Log-normal distribution.
Exponential Exponential distribution, according to the density function:
Gamma Gamma distribution.
Binomial Binomial distribution.

Functions

Functions declared at the global level.

add_function Defines a global function which can be used by all neurons and synapses.
functions Allows to access a global function declared with add_function() and use it from Python using arrays after compilation of the magic network.

Callbacks

Decorator used to interrupt the simulation at the desired time.

@every(period=100., offset=-10.)
def step_input(n):
    pop.I = float(n) / 100.

simulate(10000.)
every Decorator to declare a callback method that will be called periodically during the simulation.

Utilities

Various additional utilities.

report Generates a report describing the network.
timeit Decorator to measure the execution time of a method.
sparse_random_matrix Returns a sparse lil-matrix for use in Projection.from_sparse().
sparse_delays_from_weights Returns a sparse delay matrix with the same connectivity as the sparse matrix weight_matrix.
magic_network Returns the magic network of ID 0.

Convolution

Extension for convolution and pooling projections. The extension has to be explicitly imported:

import ANNarchy as ann
from ANNarchy.extensions.convolution import Convolution, Pooling, Copy, Transpose
Convolution Performs a convolution of a weight kernel on the pre-synaptic population.
Pooling Performs a pooling operation (e.g. max.pooling) on the pre-synaptic population.
Transpose Transposed projection reusing the weights of an already-defined projection.
Copy Creates a virtual projection reusing the weights and delays of an already-defined projection.

BOLD monitoring

Extension for monitoring BOLD signals in a population.

import ANNarchy as ann
import ANNarchy.extensions.bold as bold
BoldMonitor Monitors the BOLD signal for several populations using a computational model.
BoldModel Base class to define a BOLD model to be used in a BOLD monitor.
balloon_RN A balloon model with revised coefficients and non-linear BOLD equation derived from Stephan et al. (2007).
balloon_RL A balloon model with revised coefficients and linear BOLD equation derived from Stephan et al. (2007).
balloon_CN A balloon model with classic coefficients and non-linear BOLD equation derived from Stephan et al. (2007).
balloon_CL A balloon model with classical coefficients and linear BOLD equation derived from Stephan et al. (2007).
balloon_maith2021 The balloon model as used in Maith et al. (2021).
balloon_two_inputs BOLD model with two input signals (CBF-driving and CMRO2-driving) for the ballon model and non-linear BOLD equation with revised coefficients based on Buxton et al. (2004), Friston et al. (2000) and Stephan et al. (2007).

Tensorboard logging

Logging utilities based on tensorboard are provided in the module ANNarchy.extensions.tensorboard, which must be explicitly imported:

import ANNarchy as ann
from ANNarchy.extensions.tensorboard import Logger

The main object is the Logger class.

Logger Logger class to use tensorboard to visualize ANNarchy simulations. Requires the tensorboardX package (pip install tensorboardX).

ANN-to-SNN conversion

Module allowing to convert an ANN trained with keras into a spiking neural network:

import ANNarchy as ann
from ANNarchy.extensions.ann_to_snn_conversion import ANNtoSNNConverter
ANNtoSNNConverter Converts a pre-trained Keras model .keras into an ANNarchy spiking neural network.

DEPRECATED Top-level API

Accessing objects at the global level is deprecated since ANNarchy 5.0.

setup The setup function is used to configure ANNarchy simulations.
compile This method uses the network architecture to generate optimized C++ code and compile a shared library that will perform the simulation.
clear Clears all variables (erasing already defined populations, projections, monitors), as if you had just imported ANNarchy.
reset Reinitialises the network to its state before the call to compile. The network time will be set to 0ms.
set_seed Sets the seed of the random number generators, both in ANNarchy.RandomDistributions and in the C++ library when it is created.
get_population Returns the population with the given name.
get_projection Returns the projection with the given name.
populations Returns a list of all declared populations.
projections Returns a list of all declared populations.
monitors Returns a list of declared monitors.
simulate Simulates the network for the given duration in milliseconds.
simulate_until Runs the network for the maximal duration in milliseconds. If the stop_condition defined in the population becomes true during the simulation, it is stopped.
step Performs a single simulation step (duration = dt).
enable_learning Enables learning for all projections. Optionally period and offset can be changed for all projections.
disable_learning Disables learning for all projections.
get_time Returns the current time in ms.
set_time Sets the current time in ms.
get_current_step Returns the current simulation step.
set_current_step Sets the current simulation step (integer).
dt Returns the simulation step size dt used in the simulation.
save Save the current network state (parameters and variables) to a file.
load Loads a saved state of the network.
save_parameters Saves the global parameters of a network (flag population for neurons, projection for synapses) to a JSON file.
load_parameters Loads the global parameters of a network (flag population for neurons, projection for synapses) from a JSON file.
callbacks_enabled Returns True if callbacks are enabled for the network.
disable_callbacks Disables all callbacks for the network.
enable_callbacks Enables all declared callbacks for the network.
clear_all_callbacks Clears the list of declared callbacks for the network.
Network
 

Copyright Julien Vitay, Helge Ülo Dinkelbach, Fred Hamker