# Description of problem

I am trying to implement a form of STDP where the pre-synaptic activity variable is updated when the spike arrives at the postsynaptic neuron, rather than when the spike is initiated. Up until now, I have been using the standard Brian method of defining what happens at the pre- and post-synaptic neurons using the ‘on_pre’ and ‘on_post’ arguments of the ‘Synapse’ class. However, this defines what happens at the time the spike occurs, whereas I need to update the pre-synaptic activity variable at the time that the pre-synaptic neuron spikes plus the synaptic delay.

# Minimal code to reproduce problem

    # synapse equations
eqs = '''
dw/dt = rho*(((1*siemens-w)*C_pre-w*D_post)/tau_w) : siemens # synaptic weight
'''
# action upon excitatory presynaptic spike
on_pre = '''
C_pre += alpha_C*(1-C_pre)
'''
# action upon excitatory postsynaptic spike
on_post = '''
g_e_post += lamda*w
D_post += alpha_D*(1-D_post)
'''


where w is the synaptic weight, rho is the learning rate, C is the pre-synaptic activity, D is the postsynaptic activity and alpha_C and alpha_D are scaling factors.

To see the full equations for the type of STDP I am trying to implement, see equations 3.5 - 3.7 in the following paper: https://www.oftnai.org/articles/Brain_modelling_articles/Publications/Vision/20180021.pdf

I might have misunderstood what you want to do, but if you set a synaptic delay in Brian, this will delay the execution of the on_pre statement and therefore execute it at spike time + delay. I think this is what you want? The g_e_post += lambda*w statement on the other hand should be part of on_pre, since it is triggered by the pre-synaptic spike as well.

The general approach for these kind of equations:

• everything that is not multiplied by a \delta-function evolves continuously and should therefore go into the equations. From a quick look at your equations, it means that you have a \frac{dC}{dt} equation in the pre-synaptic neuron equations, a \frac{dD}{dt} and a \frac{dg}{dt} equation in the post-synaptic neuron equations, and a \frac{d\Delta g}{dt} (which you call w I think) equation in the synaptic equations.
• each term that is multiplied by \delta(t - \Delta t_{ij} - t^l_j) needs to go into on_pre, to be executed at pre-synaptic spike time + delay
• each term that is multiplied by \delta(t - t^k_i) needs to go into on_post, to be executed at post-synaptic spike time.

And of course you’ll have to set the delays \Delta t_{ij} on the synapses.

1 Like

Thanks for your quick response! I didn’t realise that when you set a delay, it delays the time at which everything in the ‘on_pre’ term is executed. What you have described is exactly what I want to do, so I will move the g_e_post += lambda*w statement into the ‘on_pre’ term and everything else should be fine since I have already set delays.

Thanks again,

Patrick

1 Like