Last modified by adavison on 2022/10/04 13:55

From version 11.4
edited by adavison
on 2021/09/30 14:18
Change comment: There is no comment for this version
To version 14.1
edited by adavison
on 2021/09/30 15:27
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -233,8 +233,7 @@
233 233   ),
234 234   title="Response of first five neurons with heterogeneous parameters",
235 235   annotations="Simulated with NEST"
236 -).show()(%%)
237 -\\**Run script in terminal, show figure**
236 +).show()
238 238  )))
239 239  
240 240  Now we want to create synaptic connections between the neurons in Population 1 and those in Population 2. There are lots of different ways these could be connected.
... ... @@ -311,26 +311,120 @@
311 311   ),
312 312   title="Response of first five neurons with heterogeneous parameters",
313 313   annotations="Simulated with NEST"
314 -).show()(%%)
315 -\\**Run script in terminal, show figure**
313 +).show()
316 316  )))
317 317  
318 -(% class="wikigeneratedid" id="HSummary28Inthistutorial2CyouhavelearnedtodoX202629" %)
319 -(% class="small" %)**Summary (In this tutorial, you have learned to do X…)**
316 +(% class="wikigeneratedid" %)
317 +Finally, let's update our figure, by adding a second panel to show the responses of Population 2.
320 320  
321 -.
319 +(% class="box infomessage" %)
320 +(((
321 +**Screencast** - current state of editor
322 +\\(% style="color:#000000" %)"""Simple network model using PyNN"""
323 +\\import pyNN.nest as sim(%%)
324 +(% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
325 +(% style="color:#000000" %)from pyNN.random import RandomDistribution(%%)
326 +(% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
327 +(% style="color:#000000" %)cell_type  = sim.IF_curr_exp(
328 + (% style="color:#e74c3c" %) (% style="color:#000000" %)v_rest=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}),
329 + v_thresh=RandomDistribution('normal', {'mu': -55.0, 'sigma': 1.0}),
330 + v_reset=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), (%%)
331 +(% style="color:#000000" %) t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%)
332 +(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")(%%)
333 +(% style="color:#000000" %)population2 = sim.Population(100, cell_type, label="Population 2")
334 +population2.set(i_offset=0)
335 +population1.record("v")
336 +population2.record("v")(%%)
337 +(% style="color:#000000" %)connection_algorithm = sim.FixedProbabilityConnector(p=0.5)
338 +synapse_type = sim.StaticSynapse(weight=0.5, delay=0.5)
339 +connections = sim.Projection(population1, population2, connection_algorithm, synapse_type)(%%)
340 +(% style="color:#000000" %)sim.run(100.0)(%%)
341 +(% style="color:#e74c3c" %)data1_v(% style="color:#000000" %) = population1.get_data().segments[0].filter(name='v')[0](%%)
342 +(% style="color:#e74c3c" %)data2_v = population2.get_data().segments[0].filter(name='v')[0](%%)
343 +(% style="color:#000000" %)Figure(
344 + Panel(
345 + (% style="color:#e74c3c" %)data1_v(% style="color:#000000" %)[:, 0:5],
346 + xticks=True, (% style="color:#e74c3c" %)--xlabel="Time (ms)",--(%%)
347 +(% style="color:#000000" %) yticks=True, ylabel="Membrane potential (mV)"
348 + ),
349 + (% style="color:#e74c3c" %)Panel(
350 + data2_v[:, 0:5],
351 + xticks=True, xlabel="Time (ms)",
352 + yticks=True"
353 + ),(%%)
354 +(% style="color:#000000" %) title="Response of (% style="color:#e74c3c" %)simple network(% style="color:#000000" %)",
355 + annotations="Simulated with NEST"
356 +).show()
322 322  
323 -(% class="wikigeneratedid" id="HAcknowledgementsifappropriate" %)
324 -(% class="small" %)**Acknowledgements if appropriate**
358 +**Run script in terminal, show figure**
359 +)))
325 325  
326 -.
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.
327 327  
328 -(% class="wikigeneratedid" id="HReferencestowebsites28Formoreinformation2Cvisitusat202629" %)
329 -(% class="small" %)**References to websites (For more information, visit us at…)**
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()
330 330  
331 -.
403 +**Run script in terminal, show figure**
404 +)))
332 332  
333 -(% class="wikigeneratedid" id="HContactinformation28Forquestions2Ccontactusat202629" %)
334 -(% class="small" %)**Contact information (For questions, contact us at…)**
406 +(% class="wikigeneratedid" %)
407 +As you would hope, NEST and NEURON give essentially identical results.
335 335  
336 -.
409 +(% class="box successmessage" %)
410 +(((
411 +**Slide** recap of learning objectives
412 +)))
413 +
414 +That is the end of this tutorial, in which I've demonstrated how to build a simple network using PyNN, and to simulate it using two different simulators, NEST and NEURON.
415 +
416 +Of course, PyNN allows you to create much more complex networks than this, with more realistic neuron models, synaptic plasticity, spatial structure, and so on. You can also use other simulators, such as Brian or SpiNNaker, and you can run simulations in parallel on clusters or supercomputers.
417 +
418 +We will be releasing a series of tutorials, throughout the rest of 2021 and 2022, to introduce these more advanced features of PyNN, so keep an eye on the EBRAINS website.
419 +
420 +(% class="box successmessage" %)
421 +(((
422 +**Slide** acknowledgements, contact information
423 +)))
424 +
425 +(% class="wikigeneratedid" %)
426 +PyNN has been developed by many different people, with financial support from several different organisations. I'd like to mention in particular the CNRS and the European Commission, through the FACETS, BrainScaleS and Human Brain Project grants.
427 +
428 +(% class="wikigeneratedid" %)
429 +For more information visit neuralensemble.org/PyNN. If you have questions you can contact us through the PyNN Github project, the NeuralEnsemble forum, EBRAINS support, or the EBRAINS Community.