ANNarchy 4.8.2
  • ANNarchy
  • Installation
  • Tutorial
  • Manual
  • Notebooks
  • Reference

  • Reference
  • Core components
    • Population
    • Projection
    • Neuron
    • Synapse
    • Monitor
    • PopulationView
    • Dendrite
    • Network
  • Configuration
    • setup
    • compile
    • clear
    • reset
    • set_seed
    • get_population
    • get_projection
    • populations
    • projections
    • monitors
  • Simulation
    • simulate
    • simulate_until
    • step
    • parallel_run
    • enable_learning
    • disable_learning
    • get_time
    • set_time
    • get_current_step
    • set_current_step
    • dt
  • 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
    • STP
    • STDP
    • Hebb
    • Oja
    • IBCM
  • Inputs
    • InputArray
    • TimedArray
    • PoissonPopulation
    • TimedPoissonPopulation
    • SpikeSourceArray
    • HomogeneousCorrelatedSpikeTrains
    • CurrentInjection
    • DecodingProjection
    • ImagePopulation
    • VideoPopulation
  • IO
    • save
    • load
    • save_parameters
    • load_parameters
  • Utilities
    • report
  • Random Distributions
    • Uniform
    • DiscreteUniform
    • Normal
    • LogNormal
    • Exponential
    • Gamma
    • Binomial
  • Functions and Constants
    • add_function
    • functions
    • Constant
    • get_constant
  • Plotting
    • raster_plot
    • histogram
    • inter_spike_interval
    • coefficient_of_variation
    • population_rate
    • smoothed_rate
  • Callbacks
    • every
    • callbacks_enabled
    • disable_callbacks
    • enable_callbacks
    • clear_all_callbacks
  • 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

On this page

  • Reference
    • Core components
    • Configuration
    • Simulation
    • Neuron models
    • Synapse models
    • Inputs
    • IO
    • Utilities
    • Random Distributions
    • Functions and Constants
    • Plotting
    • Callbacks
    • Convolution
    • BOLD monitoring
    • Tensorboard logging
    • ANN-to-SNN conversion

Reference

Core components

Basic objects that should be used to create a network.

Population Structure for a population of homogeneous neurons.
Projection Structure holding all synapses of the same type between two populations.
Neuron Base class to define a neuron.
Synapse Base class to define a synapse.
Monitor Monitoring class allowing to record easily parameters or variables from Population, PopulationView, Dendrite or Projection objects.
PopulationView Container representing a subset of neurons of a Population.
Dendrite A Dendrite is a sub-group of a Projection, gathering the synapses between the pre-synaptic population and a single post-synaptic neuron.
Network A network gathers already defined populations, projections and monitors in order to run them independently.

Configuration

Configuration and compilation of the network.

setup The setup function is used to configure ANNarchy simulation environment. It takes various optional arguments:
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 and constants), 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. By default, the method returns all connections which were defined.
monitors Returns a list of declared monitors. By default, all monitors are returned.

Simulation

Methods to control the simulation.

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).
parallel_run Allows to run multiple networks in parallel using multiprocessing.
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.

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.).
EIF_cond_exp_isfa_ista Exponential integrate-and-fire neuron with spike triggered and sub-threshold adaptation currents (isfa, ista reps.).

Synapse models

Default synapse models that can be used directly.

STP Synapse exhibiting short-term facilitation and depression.
STDP Spike-timing dependent plasticity, online version.
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.

Inputs

Input populations that can be used to stimulate the networks.

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

IO

Saving and loading methods for the network.

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.

Utilities

Various additional utilities.

report Generates a report describing the network.

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 and Constants

Functions and constants 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.
Constant Constant parameter that can be used by all neurons and synapses.
get_constant Returns the Constant object with the given name, None otherwise.

Plotting

Plotting methods from Monitorthat can be used without the Monitor object, i.e. offline.

raster_plot Returns two vectors representing for each recorded spike 1) the spike times and 2) the ranks of the neurons.
histogram Returns a histogram for the recorded spikes in the population.
inter_spike_interval Computes the inter-spike interval (ISI) for the recorded spike events of a population.
coefficient_of_variation Computes the coefficient of variation of the inter-spike intervals for the recorded spike events of a population.
population_rate Takes the recorded spikes of a population and returns a smoothed firing rate for the population of recorded neurons.
smoothed_rate Computes the smoothed firing rate of the recorded spiking neurons.

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.
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.

Convolution

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

import ANNarchy as ann
from ANNarchy.extensions.convolution import *
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 rate-coded 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
from ANNarchy.extensions.bold import *
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.
Population
 

Copyright Julien Vitay, Helge Ülo Dinkelbach, Fred Hamker