Skip to content

Commit 7d81ec5

Browse files
author
Alexander Ororbia
committed
cleaned up dyn-syn lesson
1 parent a028e28 commit 7d81ec5

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed
Loading
Loading
Loading

docs/tutorials/neurocog/dynamic_synapses.md

+20-10
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,11 @@ We can track and visualize the conductance outputs of our two different dynamic
112112
To create the simulation of a single input pulse stream, you can write the following code:
113113

114114
```python
115-
time_ticks = []
116-
time_labs = []
117-
Tsteps = int(T/dt) + 1
118-
for t in range(Tsteps):
119-
if t % 10 == 0:
120-
time_ticks.append(t)
121-
time_labs.append(f"{t * dt:.1f}")
122-
123115
time_span = []
124116
g = []
125117
ga = []
126118
ctx.reset()
119+
Tsteps = int(T/dt) + 1
127120
for t in range(Tsteps):
128121
s_t = jnp.zeros((1, 1))
129122
if t * dt == 1.: ## pulse at 1 ms
@@ -156,6 +149,13 @@ matplotlib.use('Agg')
156149
import matplotlib.pyplot as plt
157150
cmap = plt.cm.jet
158151

152+
time_ticks = []
153+
time_labs = []
154+
for t in range(Tsteps):
155+
if t % 10 == 0:
156+
time_ticks.append(t)
157+
time_labs.append(f"{t * dt:.1f}")
158+
159159
## ---- plot the exponential synapse conductance time-course ----
160160
fig, ax = plt.subplots()
161161

@@ -312,7 +312,7 @@ pre_inh.inputs.set(jnp.ones((1, n_inh)))
312312
post_exc.v.set(post_exc.v.value * 0 - 65.) ## initial condition for LIF is -65 mV
313313
volts.append(post_exc.v.value)
314314
time_span.append(0.)
315-
Tsteps = int(T/dt)
315+
Tsteps = int(T/dt) + 1
316316
for t in range(1, Tsteps):
317317
ctx.run(t=t * dt, dt=dt)
318318
print(f"\r v {post_exc.v.value}", end="")
@@ -332,6 +332,16 @@ matplotlib.use('Agg')
332332
import matplotlib.pyplot as plt
333333
cmap = plt.cm.jet
334334

335+
time_ticks = []
336+
time_labs = []
337+
time_ticks.append(0)
338+
time_labs.append(f"{0.}")
339+
tdiv = 1000
340+
for t in range(Tsteps):
341+
if t % tdiv == 0:
342+
time_ticks.append(t)
343+
time_labs.append(f"{t * dt:.0f}")
344+
335345
fig, ax = plt.subplots()
336346

337347
volt_vals = ax.plot(time_span, volts, '-.', color='tab:red')
@@ -373,7 +383,7 @@ Notice that the above shows the behavior of the post-synaptic LIF in response to
373383
:align: center
374384
375385
+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
376-
| .. image:: ../../images/tutorials/neurocog/ei_circuit_denser_exc.jpg | .. image:: ../../images/tutorials/neurocog/ei_circuit_sparse_inh.jpg |
386+
| .. image:: ../../images/tutorials/neurocog/ei_circuit_dense_exc.jpg | .. image:: ../../images/tutorials/neurocog/ei_circuit_sparse_inh.jpg |
377387
| :width: 400px | :width: 400px |
378388
| :align: center | :align: center |
379389
+-----------------------------------------------------------------------+-----------------------------------------------------------------------+

0 commit comments

Comments
 (0)