You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/neurocog/dynamic_synapses.md
+49-57Lines changed: 49 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
In this lesson, we will study dynamic synapses, or synaptic cable components in
4
4
ngc-learn that evolve on fast time-scales in response to their pre-synaptic inputs.
5
5
These types of chemical synapse components are useful for modeling time-varying
6
-
conductance which ultimately drives eletrical current input into neuronal units
6
+
conductance which ultimately drives electrical current input into neuronal units
7
7
(such as spiking cells). Here, we will learn how to build three important types of dynamic synapses in
8
8
ngc-learn -- the exponential, the alpha, and the double-exponential synapse -- and visualize
9
9
the time-course of their resulting conductances. In addition, we will then
@@ -24,17 +24,14 @@ value matrices we might initially employ (as in synapse components such as the
24
24
Building a dynamic synapse can be done by importing the [exponential synapse](ngclearn.components.synapses.exponentialSynapse),
25
25
the [double-exponential synapse](ngclearn.components.synapses.doubleExpSynapse), or the [alpha synapse](ngclearn.components.synapses.alphaSynapse) from ngc-learn's in-built components and setting them up within a model context for easy analysis. Go ahead and create a Python script named `probe_synapses.py` to place
26
26
the code you will write within.
27
-
For the first part of this lesson, we will import all three dynamic synpapse models and compare their behavior.
27
+
For the first part of this lesson, we will import all three dynamic synapse models and compare their behavior.
28
28
This can be done as follows (using the meta-parameters we provide in the code block below to ensure reasonable dynamics):
29
29
30
30
```python
31
31
from jax import numpy as jnp, random, jit
32
-
from ngcsimlib.context import Context
33
-
from ngclearn.components import ExponentialSynapse, AlphaSynapse, DoupleExpSynapse
34
-
35
-
from ngcsimlib.compilers.process import Process
36
-
from ngcsimlib.context import Context
37
-
import ngclearn.utils.weight_distribution as dist
32
+
from ngclearn import Context, MethodProcess
33
+
from ngclearn.components import ExponentialSynapse, AlphaSynapse, DoubleExpSynapse
34
+
from ngclearn.utils.distribution_generator import DistributionGenerator
38
35
39
36
40
37
dkey = random.PRNGKey(1234) ## creating seeding keys for synapses
@@ -46,29 +43,27 @@ T = 8. # ms ## total duration time
where we notice in the above we have instantiated three different kinds of chemical synapse components
@@ -90,7 +85,7 @@ $$
90
85
$$
91
86
92
87
where the conductance (for a post-synaptic unit) output of this synapse is driven by a sum over all of its incoming
93
-
pre-synaptic spikes; this ODE means that pre-synaptic spikes are filtered via an expoential kernel (i.e., a low-pass filter).
88
+
pre-synaptic spikes; this ODE means that pre-synaptic spikes are filtered via an exponential kernel (i.e., a low-pass filter).
94
89
On the other hand, for the alpha synapse, the dynamics adhere to the following coupled set of ODEs:
95
90
96
91
$$
@@ -100,7 +95,7 @@ $$
100
95
101
96
where $h_{\text{syn}}(t)$ is an intermediate variable that operates in service of driving the conductance variable $g_{\text{syn}}(t)$ itself.
102
97
The double-exponential (or difference of exponentials) synapse model looks similar to the alpha synapse except that the
103
-
rise and fall/decay of its condutance dynamics are set separately using two different time constants, i.e., $\tau_{\text{rise}}$ and $\tau_{\text{decay}}$,
98
+
rise and fall/decay of its conductance dynamics are set separately using two different time constants, i.e., $\tau_{\text{rise}}$ and $\tau_{\text{decay}}$,
104
99
as follows:
105
100
106
101
$$
@@ -128,29 +123,31 @@ time_span = []
128
123
g = []
129
124
ga = []
130
125
gexp2 = []
131
-
ctx.reset()
126
+
reset_process.run()
132
127
Tsteps =int(T/dt) +1
133
128
for t inrange(Tsteps):
134
129
s_t = jnp.zeros((1, 1))
135
130
if t * dt ==1.: ## pulse at 1 ms
136
131
s_t = jnp.ones((1, 1))
137
132
Wexp.inputs.set(s_t)
138
133
Walpha.inputs.set(s_t)
139
-
Wexp.v.set(Wexp.v.value*0)
134
+
Wexp.v.set(Wexp.v.get()*0)
140
135
Wexp2.inputs.set(s_t)
141
-
Walpha.v.set(Walpha.v.value *0)
142
-
Wexp2.v.set(Wexp2.v.value *0)
143
-
ctx.run(t=t * dt, dt=dt)
144
-
145
-
print(f"\r g = {Wexp.g_syn.value} ga = {Walpha.g_syn.value} gexp2 = {Wexp2.g_syn.value}", end="")
146
-
g.append(Wexp.g_syn.value)
147
-
ga.append(Walpha.g_syn.value)
136
+
Walpha.v.set(Walpha.v.get() *0)
137
+
Wexp2.v.set(Wexp2.v.get() *0)
138
+
advance_process.run(t=t * dt, dt=dt)
139
+
140
+
print(f"\r g = {Wexp.g_syn.get()} ga = {Walpha.g_syn.get()} gexp2 = {Wexp2.g_syn.get()}", end="")
which should produce a figure depicting dynamics similar to the one below. Black tick
388
-
marks indicate post-synaptic pulses whereas the horizontal dashed blue shows the LIF unit's
389
-
voltage threshold.
381
+
which should produce a figure depicting dynamics similar to the one below. Black tick marks indicate post-synaptic pulses whereas the horizontal dashed blue shows the LIF unit's voltage threshold.
0 commit comments