The classes below are only working with the Connection class. Consider using the newer Synapses class as a replacement, it allows you to flexibily express plasticity rules in a very similar way to the classes below. A single Synapses object can therefore completely replace the combination of Connection + STDP, for example. See Synapses for more details.

Spike timing dependent plasticity (STDP)

class brian.STDP(C, eqs, pre, post, wmin=0, wmax=inf, level=0, clock=None, delay_pre=None, delay_post=None)

Spike-timing-dependent plasticity

Initialised with arguments:

Connection object to apply STDP to.
Differential equations (with units)
Python code for presynaptic spikes, use the reserved symbol w to refer to the synaptic weight.
Python code for postsynaptic spikes, use the reserved symbol w to refer to the synaptic weight.
Minimum weight (default 0), weights are restricted to be within this value and wmax.
Maximum weight (default unlimited), weights are restricted to be within wmin and this value.
Presynaptic delay
Postsynaptic delay (backward propagating spike)

The STDP object works by specifying a set of differential equations associated to each synapse (eqs) and two rules to specify what should happen when a presynaptic neuron fires (pre) and when a postsynaptic neuron fires (post). The equations should be standard set of equations in the usual string format. The pre and post rules should be a sequence of statements to be executed triggered on pre- and post-synaptic spikes. The sequence of statements can be separated by a ; or by using a multiline string. The reserved symbol w can be used to refer to the synaptic weight of the associated synapse.

This framework allows you to implement most STDP rules. Specifying differential equations and pre- and post-synaptic event code allows for a much more efficient implementation than specifying, for example, the spike pair weight modification function, but does unfortunately require transforming the definition into this form.

There is one restriction on the equations that can be implemented in this system, they need to be separable into independent pre- and post-synaptic systems (this is done automatically). In this way, synaptic variables and updates can be stored per neuron rather than per synapse.


eqs_stdp = """
dA_pre/dt  = -A_pre/tau_pre   : 1
dA_post/dt = -A_post/tau_post : 1
stdp = STDP(C, eqs=eqs_stdp, pre='A_pre+=delta_A_pre; w+=A_post',
            post='A_post+=delta_A_post; w+=A_pre', wmax=gmax)

STDP variables

You can access the pre- and post-synaptic variables as follows:

stdp = STDP(...)
print stdp.A_pre

Alternatively, you can access the group of pre/post-synaptic variables as:


These latter attributes can be passed to a StateMonitor to record their activity, for example. However, note that in the case of STDP acting on a connection with heterogeneous delays, the recent values of these variables are automatically monitored and these can be accesses as follows:


Technical details

The equations are split into two groups, pre and post. Two groups are created to carry these variables and to update them (these are implemented as NeuronGroup objects). As well as propagating spikes from the source and target of C via C, spikes are also propagated to the respective groups created. At spike propagation time the weight values are updated.

class brian.ExponentialSTDP(C, taup, taum, Ap, Am, interactions='all', wmin=0, wmax=None, update='additive', delay_pre=None, delay_post=None, clock=None)

Exponential STDP.

Initialised with the following arguments:

taup, taum, Ap, Am

Synaptic weight change (relative to the maximum weight wmax):

f(s) = Ap*exp(-s/taup) if s >0
f(s) = Am*exp(s/taum) if s <0
  • ‘all’: contributions from all pre-post pairs are added
  • ‘nearest’: only nearest-neighbour pairs are considered
  • ‘nearest_pre’: nearest presynaptic spike, all postsynaptic spikes
  • ‘nearest_post’: nearest postsynaptic spike, all presynaptic spikes
minimum synaptic weight
maximum synaptic weight
  • ‘additive’: modifications are additive (independent of synaptic weight) (or “hard bounds”)
  • ‘multiplicative’: modifications are multiplicative (proportional to w) (or “soft bounds”)
  • ‘mixed’: depression is multiplicative, potentiation is additive

See documentation for STDP for more details.

Short term plasticity (STP)

class brian.STP(C, taud, tauf, U)

Short-term synaptic plasticity, following the Tsodyks-Markram model.

Implements the short-term plasticity model described in Markram et al (1998). Differential signaling via the same axon of neocortical pyramidal neurons, PNAS. Synaptic dynamics is described by two variables x and u, which follow the following differential equations:

dx/dt=(1-x)/taud  (depression)
du/dt=(U-u)/tauf  (facilitation)

where taud, tauf are time constants and U is a parameter in 0..1. Each presynaptic spike triggers modifications of the variables:


Synaptic weights are modulated by the product u*x (in 0..1) (before update).


  • Markram et al (1998). “Differential signaling via the same axon of neocortical pyramidal neurons”, PNAS.