Skip to content

Commit 3fcbf80

Browse files
author
Alexander Ororbia
committedApr 28, 2025
fixed scaling issue in exp/alpha syn
1 parent 24f48d9 commit 3fcbf80

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed
 

‎docs/tutorials/neurocog/dynamic_synapses.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ In this lesson, we will study dynamic synapses, or synaptic cable components in
44
ngc-learn that evolve on fast time-scales in response to their pre-synaptic inputs.
55
These types of chemical synapse components are useful for modeling time-varying
66
conductance which ultimately drives eletrical current input into neuronal units
7-
(such as spiking cells).
8-
Here, we will learn how to build two important types of dynamic synapses in
7+
(such as spiking cells). Here, we will learn how to build two important types of dynamic synapses in
98
ngc-learn -- the exponential synapse and the alpha synapse -- and visualize
109
the time-course of their resulting conductances. In addition, we will then
1110
construct and study a small neuronal circuit involving a leaky integrator that
@@ -366,3 +365,8 @@ voltage threshold.
366365
+--------------------------------------------------------------------+
367366
```
368367

368+
Notice that the above shows the behavior of the post-synaptic LIF in response to the integration of pulses coming from two Poisson spike trains both at rates of $10$ Hz (since both `exc_freq` and `inh_freq` have been set to ten). Messing with the frequencies of the excitatory and inhibitory pulse trains can lead to sparser or denser post-synaptic spike outputs.
369+
370+
## References
371+
372+
<b>[1]</b> Sterratt, David, et al. Principles of computational modelling in neuroscience. Cambridge university press, 2023.

‎ngclearn/components/synapses/alphaSynapse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ def advance_state(
9090
dt, tau_syn, g_syn_bar, syn_rest, Rscale, inputs, weights, i_syn, g_syn, h_syn, v
9191
):
9292
s = inputs
93-
## advance conductance variable
93+
## advance conductance variable(s)
9494
_out = jnp.matmul(s, weights) ## sum all pre-syn spikes at t going into post-neuron)
9595
dhsyn_dt = -h_syn/tau_syn + _out * g_syn_bar
9696
h_syn = h_syn + dhsyn_dt * dt ## run Euler step to move intermediate conductance h
9797

9898
dgsyn_dt = -g_syn/tau_syn + h_syn # or -g_syn/tau_syn + h_syn/tau_syn
9999
g_syn = g_syn + dgsyn_dt * dt ## run Euler step to move conductance g
100-
g_syn = g_syn * Rscale
101100

102-
i_syn = -g_syn
101+
## compute derive electrical current variable
102+
i_syn = -g_syn * Rscale
103103
if syn_rest is not None:
104-
i_syn = -g_syn * (v - syn_rest)
104+
i_syn = -(g_syn * Rscale) * (v - syn_rest)
105105
outputs = i_syn #jnp.matmul(inputs, Wdyn * Rscale) + biases
106106
return outputs, i_syn, g_syn, h_syn
107107

‎ngclearn/components/synapses/exponentialSynapse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def advance_state(
9090
s = inputs
9191
## advance conductance variable
9292
_out = jnp.matmul(s, weights) ## sum all pre-syn spikes at t going into post-neuron)
93-
dgsyn_dt = -g_syn/tau_syn + _out * g_syn_bar
93+
dgsyn_dt = -g_syn/tau_syn + (_out * g_syn_bar) * (1./dt)
9494
g_syn = g_syn + dgsyn_dt * dt ## run Euler step to move conductance
95-
g_syn = g_syn * Rscale
96-
i_syn = -g_syn
95+
## compute derive electrical current variable
96+
i_syn = -g_syn * Rscale
9797
if syn_rest is not None:
98-
i_syn = -g_syn * (v - syn_rest)
98+
i_syn = -(g_syn * Rscale) * (v - syn_rest)
9999
outputs = i_syn #jnp.matmul(inputs, Wdyn * Rscale) + biases
100100
return outputs, i_syn, g_syn
101101

0 commit comments

Comments
 (0)