Closed CloudyDory closed 8 months ago
Thanks for the report! This is a great issue!
Let me first guess the reason behind this error.
The error may result from the incorrect discretization of the Alpha synapse model.
Current discretization is
$$ \begin{aligned} &\frac{d g}{d t}=-\frac{g}{\tau{\mathrm{decay}}}+h \ &\frac{d h}{d t}=-\frac{h}{\tau{\text {rise }}}+ \delta\left(t_{0}-t\right), \end{aligned} $$
However, it should be
$$ \begin{aligned} & \tau{\mathrm{decay}} \frac{d g}{d t}=-g+h \ &\frac{d h}{d t}=-\frac{h}{\tau{\text {rise }}}+ \delta\left(t_{0}-t\right), \end{aligned} $$
I will recheck the math later.
Thanks for the report, we have rechecked the error and fixed the bugs in BrainPy. Please see #578 .
The response of an Alpha synapse after a single spike input is:
For a train of input spikes (represented by binary vector
s(t) = [0 0 0 1 0 1 0 0 ...]
), the response will be the convolution betweens(t)
andg_syn(t)
.In BrainPy, for computational efficiency, the convolution is replaced by the following differential equations:
However, the recorded
g_syn(t)
by this method differs by the convolution method by a factor oftau
. The following code illustrates this:The key is the
h <-- h + s(t)
part. If I change it toh <-- h + s(t)/tau
, the outputs from differential equation form and convolution form will be the same. However, I have checked other simulator (https://brian2.readthedocs.io/en/stable/user/converting_from_integrated_form.html), but it seems that it uses similar implementation as in BrainPy (i.e. directly shiftingh
without divided bytau
). So I am a bit confused. Is the larger response of differential equation form correct?