Changes for page 03. Building and simulating a simple model
Last modified by adavison on 2022/10/04 13:55
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -358,6 +358,54 @@ 358 358 **Run script in terminal, show figure** 359 359 ))) 360 360 361 +(% class="wikigeneratedid" %) 362 +and there we have it, our simple neuronal network of integrate-and-fire neurons, written in PyNN, simulated with NEST. If you prefer to use the NEURON simulator, PyNN makes this very simple, we import the PyNN-for-NEURON module instead. 363 + 364 +(% class="box infomessage" %) 365 +((( 366 +**Screencast** - current state of editor 367 +\\(% style="color:#000000" %)"""Simple network model using PyNN""" 368 +\\import pyNN.(% style="color:#e74c3c" %)neuron(% style="color:#000000" %) as sim(%%) 369 +(% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%) 370 +(% style="color:#000000" %)from pyNN.random import RandomDistribution(%%) 371 +(% style="color:#000000" %)sim.setup(timestep=0.1)(%%) 372 +(% style="color:#000000" %)cell_type = sim.IF_curr_exp( 373 + (% style="color:#e74c3c" %) (% style="color:#000000" %)v_rest=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), 374 + v_thresh=RandomDistribution('normal', {'mu': -55.0, 'sigma': 1.0}), 375 + v_reset=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), (%%) 376 +(% style="color:#000000" %) t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%) 377 +(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")(%%) 378 +(% style="color:#000000" %)population2 = sim.Population(100, cell_type, label="Population 2") 379 +population2.set(i_offset=0) 380 +population1.record("v") 381 +population2.record("v")(%%) 382 +(% style="color:#000000" %)connection_algorithm = sim.FixedProbabilityConnector(p=0.5) 383 +synapse_type = sim.StaticSynapse(weight=0.5, delay=0.5) 384 +connections = sim.Projection(population1, population2, connection_algorithm, synapse_type)(%%) 385 +(% style="color:#000000" %)sim.run(100.0)(%%) 386 +(% style="color:#000000" %)data1_v = population1.get_data().segments[0].filter(name='v')[0] 387 +data2_v = population2.get_data().segments[0].filter(name='v')[0] 388 +Figure( 389 + Panel( 390 + data1_v[:, 0:5], 391 + xticks=True, 392 + yticks=True, ylabel="Membrane potential (mV)" 393 + ), 394 + Panel( 395 + data2_v[:, 0:5], 396 + xticks=True, xlabel="Time (ms)", 397 + yticks=True" 398 + ),(%%) 399 +(% style="color:#000000" %) title="Response of simple network", 400 + annotations="Simulated with (% style="color:#e74c3c" %)NEURON(% style="color:#000000" %)" 401 +).show() 402 + 403 +**Run script in terminal, show figure** 404 +))) 405 + 406 +(% class="wikigeneratedid" %) 407 +As you would hope, NEST and NEURON give essentially identical results. 408 + 361 361 (% class="wikigeneratedid" id="HSummary28Inthistutorial2CyouhavelearnedtodoX202629" %) 362 362 (% class="small" %)**Summary (In this tutorial, you have learned to do X…)** 363 363