|
5 | 5 | import brainpy as bp |
6 | 6 | import brainpy.math as bm |
7 | 7 |
|
| 8 | +show = False |
8 | 9 |
|
9 | 10 | neu_pars = dict(V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5., |
10 | 11 | V_initializer=bp.init.Normal(-55., 2.)) |
@@ -66,12 +67,12 @@ def update(self): |
66 | 67 | net = EICOBA_PreAlign(0.5) |
67 | 68 | indices = np.arange(400) |
68 | 69 | spks = bm.for_loop(net.step_run, indices) |
69 | | - bp.visualize.raster_plot(indices * bm.dt, spks, show=True) |
| 70 | + bp.visualize.raster_plot(indices * bm.dt, spks, show=show) |
70 | 71 |
|
71 | 72 | net = EICOBA_PreAlign(0.5, delay=1.) |
72 | 73 | indices = np.arange(400) |
73 | 74 | spks = bm.for_loop(net.step_run, indices) |
74 | | - bp.visualize.raster_plot(indices * bm.dt, spks, show=True) |
| 75 | + bp.visualize.raster_plot(indices * bm.dt, spks, show=show) |
75 | 76 |
|
76 | 77 | plt.close() |
77 | 78 | bm.clear_buffer_memory() |
@@ -137,17 +138,17 @@ def update(self): |
137 | 138 | net = EICOBA_PostAlign(0.5) |
138 | 139 | indices = np.arange(400) |
139 | 140 | spks = bm.for_loop(net.step_run, indices) |
140 | | - bp.visualize.raster_plot(indices * bm.dt, spks, show=True) |
| 141 | + bp.visualize.raster_plot(indices * bm.dt, spks, show=show) |
141 | 142 |
|
142 | 143 | net = EICOBA_PostAlign(0.5, delay=1.) |
143 | 144 | indices = np.arange(400) |
144 | 145 | spks = bm.for_loop(net.step_run, indices) |
145 | | - bp.visualize.raster_plot(indices * bm.dt, spks, show=True) |
| 146 | + bp.visualize.raster_plot(indices * bm.dt, spks, show=show) |
146 | 147 |
|
147 | 148 | net = EICOBA_PostAlign(0.5, ltc=False) |
148 | 149 | indices = np.arange(400) |
149 | 150 | spks = bm.for_loop(net.step_run, indices) |
150 | | - bp.visualize.raster_plot(indices * bm.dt, spks, show=True) |
| 151 | + bp.visualize.raster_plot(indices * bm.dt, spks, show=show) |
151 | 152 |
|
152 | 153 | plt.close() |
153 | 154 | bm.clear_buffer_memory() |
@@ -184,7 +185,7 @@ def update(self, input): |
184 | 185 | model = EINet(0.5) |
185 | 186 | indices = bm.arange(400) |
186 | 187 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
187 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 188 | + bp.visualize.raster_plot(indices, spks, show=show) |
188 | 189 | bm.clear_buffer_memory() |
189 | 190 | plt.close() |
190 | 191 |
|
@@ -237,12 +238,12 @@ def update(self, inp): |
237 | 238 | model = EINet(0.5, delay=1.) |
238 | 239 | indices = bm.arange(400) |
239 | 240 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
240 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 241 | + bp.visualize.raster_plot(indices, spks, show=show) |
241 | 242 |
|
242 | 243 | model = EINet(0.5, delay=None) |
243 | 244 | indices = bm.arange(400) |
244 | 245 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
245 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 246 | + bp.visualize.raster_plot(indices, spks, show=show) |
246 | 247 |
|
247 | 248 | bm.clear_buffer_memory() |
248 | 249 | plt.close() |
@@ -279,7 +280,7 @@ def update(self, input): |
279 | 280 | model = EINet() |
280 | 281 | indices = bm.arange(400) |
281 | 282 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
282 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 283 | + bp.visualize.raster_plot(indices, spks, show=show) |
283 | 284 | bm.clear_buffer_memory() |
284 | 285 | plt.close() |
285 | 286 |
|
@@ -331,12 +332,12 @@ def update(self, inp): |
331 | 332 | model = EINet() |
332 | 333 | indices = bm.arange(400) |
333 | 334 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
334 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 335 | + bp.visualize.raster_plot(indices, spks, show=show) |
335 | 336 |
|
336 | 337 | model = EINet(delay=1.) |
337 | 338 | indices = bm.arange(400) |
338 | 339 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
339 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 340 | + bp.visualize.raster_plot(indices, spks, show=show) |
340 | 341 |
|
341 | 342 | bm.clear_buffer_memory() |
342 | 343 | plt.close() |
@@ -389,12 +390,12 @@ def update(self, inp): |
389 | 390 | model = EINet(scale=0.2, delay=None) |
390 | 391 | indices = bm.arange(400) |
391 | 392 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
392 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 393 | + bp.visualize.raster_plot(indices, spks, show=show) |
393 | 394 |
|
394 | 395 | model = EINet(scale=0.2, delay=1.) |
395 | 396 | indices = bm.arange(400) |
396 | 397 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices) |
397 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 398 | + bp.visualize.raster_plot(indices, spks, show=show) |
398 | 399 |
|
399 | 400 | bm.clear_buffer_memory() |
400 | 401 | plt.close() |
@@ -435,6 +436,6 @@ def update(self, input): |
435 | 436 | model = EINet() |
436 | 437 | indices = bm.arange(400) |
437 | 438 | spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices, progress_bar=True) |
438 | | - bp.visualize.raster_plot(indices, spks, show=True) |
| 439 | + bp.visualize.raster_plot(indices, spks, show=show) |
439 | 440 | plt.close() |
440 | 441 | bm.clear_buffer_memory() |
0 commit comments