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

From version 9.8
edited by adavison
on 2021/08/04 16:01
Change comment: There is no comment for this version
To version 10.2
edited by adavison
on 2021/08/04 16:19
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -21,8 +21,10 @@
21 21  
22 22  == Script ==
23 23  
24 -(% class="wikigeneratedid" id="HIntroduceyourself28ifvideo29" %)
25 -(% class="small" %)**Introduce yourself**
24 +(% class="box successmessage" %)
25 +(((
26 +**Slide** showing tutorial title, PyNN logo, link to PyNN service page.
27 +)))
26 26  
27 27  Hello, my name is X.
28 28  
... ... @@ -30,20 +30,26 @@
30 30  
31 31  For a list of the other tutorials in this series, you can visit ebrains.eu/service/pynn, that's p-y-n-n.
32 32  
33 -(% class="wikigeneratedid" id="HStatethelearningobjectives28Inthistutorial2CyouwilllearntodoX202629" %)
34 -(% class="small" %)**State the learning objectives**
35 +(% class="box successmessage" %)
36 +(((
37 +**Slide** listing learning objectives
38 +)))
35 35  
36 36  In this tutorial, you will learn the basics of PyNN: how to build a simple network of integrate-and-fire neurons using PyNN, how to run simulation experiments with this network using different simulators, and how to visualize the data generated by these experiments.
37 37  
38 -(% class="wikigeneratedid" id="HStateprerequisites" %)
39 -(% class="small" %)**State prerequisites**
42 +(% class="box successmessage" %)
43 +(((
44 +**Slide** listing prerequisites
45 +)))
40 40  
41 41  To follow this tutorial, you need a basic knowledge of neuroscience (high-school level or greater), basic familiarity with the Python programming language, and you should have already followed our earlier tutorial video which guides you through the installation process.
42 42  
43 43  This video covers PyNN 0.10. If you've installed a more recent version of PyNN, you might want to look for an updated version of this video.
44 44  
45 -(% class="wikigeneratedid" id="HDescription2Cexplanation2Candpractice" %)
46 -(% class="small" %)**Description, explanation, and practice**
51 +(% class="box successmessage" %)
52 +(((
53 +**Slide** showing animation of leaky integrate-and-fire model
54 +)))
47 47  
48 48  PyNN is a tool for building models of nervous systems, and parts of nervous systems, at the level of individual neurons and synapses.
49 49  
... ... @@ -53,6 +53,13 @@
53 53  
54 54  At that point, the neuron produces an action potential, also called a spike, and the membrane voltage is reset.
55 55  
64 +(% class="box infomessage" %)
65 +(((
66 +**Screencast** - blank document in editor
67 +)))
68 +
69 +In this video, you'll see my editor on the left, and on the right my terminal and my file browser. I'll be writing code in the editor, and then running my scripts in the terminal. You're welcome to follow along~-~--you can pause the video at any time if I'm going too fast~-~--or you can just watch.
70 +
56 56  Let's start by writing a docstring, "Simple network model using PyNN".
57 57  
58 58  For now, we're going to use the NEST simulator to simulate this model, so we import the PyNN-for-NEST module.
... ... @@ -59,12 +59,41 @@
59 59  
60 60  Like with any numerical model, we need to break time down into small steps, so let's set that up with steps of 0.1 milliseconds.
61 61  
77 +(% class="box infomessage" %)
78 +(((
79 +**Screencast** - current state of editor
80 +\\(% style="color:#e74c3c" %)"""Simple network model using PyNN"""
81 +\\import pyNN.nest as sim
82 +sim.setup(timestep=0.1)
83 +)))
84 +
62 62  PyNN comes with a selection of integrate-and-fire models. We're going to use the IF_curr_exp model, where "IF" is for integrate-and-fire, "curr" means that synaptic responses are changes in current, and "exp" means that the shape of the current is a decaying exponential function.
63 63  
64 64  This is where we set the parameters of the model: the resting membrane potential is -65 millivolts, the spike threshold is -55 millivolts, the reset voltage after a spike is again -65 millivolts, the refractory period after a spike is one millisecond, the membrane time constant is 10 milliseconds, and the membrane capacitance is 1 nanofarad. We're also going to inject a constant bias current of 0.1 nanoamps into these neurons, so that we get some action potentials.
65 65  
89 +(% class="box infomessage" %)
90 +(((
91 +**Screencast** - current state of editor
92 +\\(% style="color:#000000" %)"""Simple network model using PyNN"""
93 +\\import pyNN.nest as sim
94 +sim.setup(timestep=0.1)(%%)
95 +(% style="color:#e74c3c" %)cell_type  = sim.IF_curr_exp(v_rest=-65, v_thresh=-55, v_reset=-65, t_refrac=1, tau_m=10, cm=1, i_offset=0.1)
96 +)))
97 +
66 66  Let's create 100 of these neurons, then we're going to record the membrane voltage, and run a simulation for 100 milliseconds.
67 67  
100 +(% class="box infomessage" %)
101 +(((
102 +**Screencast** - current state of editor
103 +\\(% style="color:#000000" %)"""Simple network model using PyNN"""
104 +\\import pyNN.nest as sim
105 +sim.setup(timestep=0.1)(%%)
106 +(% style="color:#000000" %)cell_type  = sim.IF_curr_exp(v_rest=-65, v_thresh=-55, v_reset=-65, t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%)
107 +(% style="color:#e74c3c" %)population1 = sim.Population(100, cell_type, label="Population 1")
108 +population1.record("v")
109 +sim.run(100.0)
110 +)))
111 +
68 68  PyNN has some built-in tools for making simple plots, so let's import those, and plot the membrane voltage of the zeroth neuron in our population (remember Python starts counting at zero).
69 69  
70 70  As you'd expect, the bias current causes the membrane voltage to increase until it reaches threshold~-~--it doesn't increase in a straight line because it's a //leaky// integrate-and-fire neuron~-~--then once it hits the threshold the voltage is reset, and then stays at the same level for a short time~-~--this is the refractory period~-~--before it starts to increase again.