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

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

Summary

Details

Page properties
Content
... ... @@ -106,11 +106,36 @@
106 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 107  (% style="color:#e74c3c" %)population1 = sim.Population(100, cell_type, label="Population 1")
108 108  population1.record("v")
109 -sim.run(100.0)
109 +sim.run(100.0)(%%)
110 +\\**Run script in terminal**
110 110  )))
111 111  
112 112  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).
113 113  
115 +(% class="box infomessage" %)
116 +(((
117 +**Screencast** - current state of editor
118 +\\(% style="color:#000000" %)"""Simple network model using PyNN"""
119 +\\import pyNN.nest as sim(%%)
120 +(% style="color:#e74c3c" %)from pyNN.utility.plotting import Figure, Panel(%%)
121 +(% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
122 +(% 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)(%%)
123 +(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")
124 +population1.record("v")
125 +sim.run(100.0)(%%)
126 +(% style="color:#e74c3c" %)data_v = population1.get_data().segments[0].filter(name='v')[0]
127 +Figure(
128 + Panel(
129 + data_v[:, 0],
130 + xticks=True, xlabel="Time (ms)",
131 + yticks=True, ylabel="Membrane potential (mV)"
132 + ),
133 + title="Response of neuron #0",
134 + annotations="Simulated with NEST"
135 +).show()(%%)
136 +\\**Run script in terminal**
137 +)))
138 +
114 114  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.
115 115  
116 116  Now, all 100 neurons in our population are identical, so if we plotted the first neuron, the second neuron, ..., we'd get the same trace.