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

From version 13.1
edited by adavison
on 2021/09/30 14:24
Change comment: There is no comment for this version
To version 15.1
edited by adavison
on 2021/09/30 15:30
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -142,17 +142,11 @@
142 142  
143 143  (% class="box infomessage" %)
144 144  (((
145 -**Screencast** - current state of editor
146 -\\(% style="color:#000000" %)"""Simple network model using PyNN"""
147 -\\import pyNN.nest as sim(%%)
148 -(% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
149 -(% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
150 -(% 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)(%%)
151 -(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")
152 -population1.record("v")
153 -sim.run(100.0)(%%)
154 -(% style="color:#000000" %)data_v = population1.get_data().segments[0].filter(name='v')[0]
155 -Figure(
145 +**Screencast** - changes in editor
146 +
147 +
148 +**...**
149 +(% style="color:#000000" %)Figure(
156 156   Panel(
157 157   data_v[:, (% style="color:#e74c3c" %)0:5(% style="color:#000000" %)],
158 158   xticks=True, xlabel="Time (ms)",
... ... @@ -168,7 +168,7 @@
168 168  
169 169  (% class="box infomessage" %)
170 170  (((
171 -**Screencast** - current state of editor
165 +**Screencast** - changes in editor
172 172  \\(% style="color:#000000" %)"""Simple network model using PyNN"""
173 173  \\import pyNN.nest as sim(%%)
174 174  (% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
... ... @@ -179,11 +179,12 @@
179 179   v_thresh=RandomDistribution('normal', {'mu': -55.0, 'sigma': 1.0}),
180 180   v_reset=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), (%%)
181 181  (% style="color:#000000" %) t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%)
182 -(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")
183 -population1.record("v")
184 -sim.run(100.0)(%%)
185 -(% style="color:#000000" %)data_v = population1.get_data().segments[0].filter(name='v')[0]
186 -Figure(
176 +
177 +
178 +**...**
179 +
180 +
181 +(% style="color:#000000" %)Figure(
187 187   Panel(
188 188   data_v[:, 0:5],
189 189   xticks=True, xlabel="Time (ms)",
... ... @@ -207,17 +207,8 @@
207 207  
208 208  (% class="box infomessage" %)
209 209  (((
210 -**Screencast** - current state of editor
211 -\\(% style="color:#000000" %)"""Simple network model using PyNN"""
212 -\\import pyNN.nest as sim(%%)
213 -(% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
214 -(% style="color:#000000" %)from pyNN.random import RandomDistribution(%%)
215 -(% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
216 -(% style="color:#000000" %)cell_type  = sim.IF_curr_exp(
217 - (% style="color:#e74c3c" %) (% style="color:#000000" %)v_rest=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}),
218 - v_thresh=RandomDistribution('normal', {'mu': -55.0, 'sigma': 1.0}),
219 - v_reset=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), (%%)
220 -(% style="color:#000000" %) t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%)
205 +**Screencast** - changes in editor
206 +\\**...**
221 221  (% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")(%%)
222 222  (% style="color:#e74c3c" %)population2 = sim.Population(100, cell_type, label="Population 2")
223 223  population2.set(i_offset=0)(%%)
... ... @@ -224,16 +224,7 @@
224 224  (% style="color:#000000" %)population1.record("v")(%%)
225 225  (% style="color:#e74c3c" %)population2.record("v")(%%)
226 226  (% style="color:#000000" %)sim.run(100.0)(%%)
227 -(% style="color:#000000" %)data_v = population1.get_data().segments[0].filter(name='v')[0]
228 -Figure(
229 - Panel(
230 - data_v[:, 0:5],
231 - xticks=True, xlabel="Time (ms)",
232 - yticks=True, ylabel="Membrane potential (mV)"
233 - ),
234 - title="Response of first five neurons with heterogeneous parameters",
235 - annotations="Simulated with NEST"
236 -).show()
213 +**...**
237 237  )))
238 238  
239 239  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.
... ... @@ -281,46 +281,54 @@
281 281  
282 282  (% class="box infomessage" %)
283 283  (((
284 -**Screencast** - current state of editor
285 -\\(% style="color:#000000" %)"""Simple network model using PyNN"""
286 -\\import pyNN.nest as sim(%%)
287 -(% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
288 -(% style="color:#000000" %)from pyNN.random import RandomDistribution(%%)
289 -(% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
290 -(% style="color:#000000" %)cell_type  = sim.IF_curr_exp(
291 - (% style="color:#e74c3c" %) (% style="color:#000000" %)v_rest=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}),
292 - v_thresh=RandomDistribution('normal', {'mu': -55.0, 'sigma': 1.0}),
293 - v_reset=RandomDistribution('normal', {'mu': -65.0, 'sigma': 1.0}), (%%)
294 -(% style="color:#000000" %) t_refrac=1, tau_m=10, cm=1, i_offset=0.1)(%%)
295 -(% style="color:#000000" %)population1 = sim.Population(100, cell_type, label="Population 1")(%%)
296 -(% style="color:#000000" %)population2 = sim.Population(100, cell_type, label="Population 2")
297 -population2.set(i_offset=0)
298 -population1.record("v")
299 -population2.record("v")(%%)
261 +**Screencast** - changes in editor
262 +
263 +
264 +**...**
265 +(% style="color:#000000" %)population2.record("v")(%%)
300 300  (% style="color:#e74c3c" %)connection_algorithm = sim.FixedProbabilityConnector(p=0.5)
301 301  synapse_type = sim.StaticSynapse(weight=0.5, delay=0.5)
302 302  connections = sim.Projection(population1, population2, connection_algorithm, synapse_type)(%%)
303 303  (% style="color:#000000" %)sim.run(100.0)(%%)
304 -(% style="color:#000000" %)data_v = population1.get_data().segments[0].filter(name='v')[0]
305 -Figure(
270 +**...**
271 +)))
272 +
273 +(% class="wikigeneratedid" %)
274 +Finally, let's update our figure, by adding a second panel to show the responses of Population 2.
275 +
276 +(% class="box infomessage" %)
277 +(((
278 +**Screencast** - changes in editor
279 +\\**...**
280 +(% style="color:#000000" %)sim.run(100.0)(%%)
281 +(% style="color:#e74c3c" %)data1_v(% style="color:#000000" %) = population1.get_data().segments[0].filter(name='v')[0](%%)
282 +(% style="color:#e74c3c" %)data2_v = population2.get_data().segments[0].filter(name='v')[0](%%)
283 +(% style="color:#000000" %)Figure(
306 306   Panel(
307 - data_v[:, 0:5],
308 - xticks=True, xlabel="Time (ms)",
309 - yticks=True, ylabel="Membrane potential (mV)"
285 + (% style="color:#e74c3c" %)data1_v(% style="color:#000000" %)[:, 0:5],
286 + xticks=True, (% style="color:#e74c3c" %)--xlabel="Time (ms)",--(%%)
287 +(% style="color:#000000" %) yticks=True, ylabel="Membrane potential (mV)"
310 310   ),
311 - title="Response of first five neurons with heterogeneous parameters",
289 + (% style="color:#e74c3c" %)Panel(
290 + data2_v[:, 0:5],
291 + xticks=True, xlabel="Time (ms)",
292 + yticks=True"
293 + ),(%%)
294 +(% style="color:#000000" %) title="Response of (% style="color:#e74c3c" %)simple network(% style="color:#000000" %)",
312 312   annotations="Simulated with NEST"
313 313  ).show()
297 +
298 +**Run script in terminal, show figure**
314 314  )))
315 315  
316 316  (% class="wikigeneratedid" %)
317 -Finally, let's update our figure, by adding a second panel to show the responses of Population 2.
302 +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.
318 318  
319 319  (% class="box infomessage" %)
320 320  (((
321 -**Screencast** - current state of editor
306 +**Screencast** - final state of editor
322 322  \\(% style="color:#000000" %)"""Simple network model using PyNN"""
323 -\\import pyNN.nest as sim(%%)
308 +\\import pyNN.(% style="color:#e74c3c" %)neuron(% style="color:#000000" %) as sim(%%)
324 324  (% style="color:#000000" %)from pyNN.utility.plotting import Figure, Panel(%%)
325 325  (% style="color:#000000" %)from pyNN.random import RandomDistribution(%%)
326 326  (% style="color:#000000" %)sim.setup(timestep=0.1)(%%)
... ... @@ -338,42 +338,47 @@
338 338  synapse_type = sim.StaticSynapse(weight=0.5, delay=0.5)
339 339  connections = sim.Projection(population1, population2, connection_algorithm, synapse_type)(%%)
340 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(
326 +(% style="color:#000000" %)data1_v = population1.get_data().segments[0].filter(name='v')[0]
327 +data2_v = population2.get_data().segments[0].filter(name='v')[0]
328 +Figure(
344 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)"
330 + data1_v[:, 0:5],
331 + xticks=True,
332 + yticks=True, ylabel="Membrane potential (mV)"
348 348   ),
349 - (% style="color:#e74c3c" %)Panel(
334 + Panel(
350 350   data2_v[:, 0:5],
351 351   xticks=True, xlabel="Time (ms)",
352 352   yticks=True"
353 353   ),(%%)
354 -(% style="color:#000000" %) title="Response of (% style="color:#e74c3c" %)simple network(% style="color:#000000" %)",
355 - annotations="Simulated with NEST"
339 +(% style="color:#000000" %) title="Response of simple network",
340 + annotations="Simulated with (% style="color:#e74c3c" %)NEURON(% style="color:#000000" %)"
356 356  ).show()
357 357  
358 358  **Run script in terminal, show figure**
359 359  )))
360 360  
361 -(% class="wikigeneratedid" id="HSummary28Inthistutorial2CyouhavelearnedtodoX202629" %)
362 -(% class="small" %)**Summary (In this tutorial, you have learned to do X…)**
346 +(% class="wikigeneratedid" %)
347 +As you would hope, NEST and NEURON give essentially identical results.
363 363  
364 -.
349 +(% class="box successmessage" %)
350 +(((
351 +**Slide** recap of learning objectives
352 +)))
365 365  
366 -(% class="wikigeneratedid" id="HAcknowledgementsifappropriate" %)
367 -(% class="small" %)**Acknowledgements if appropriate**
354 +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.
368 368  
369 -.
356 +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.
370 370  
371 -(% class="wikigeneratedid" id="HReferencestowebsites28Formoreinformation2Cvisitusat202629" %)
372 -(% class="small" %)**References to websites (For more information, visit us at…)**
358 +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.
373 373  
374 -.
360 +(% class="box successmessage" %)
361 +(((
362 +**Slide** acknowledgements, contact information
363 +)))
375 375  
376 -(% class="wikigeneratedid" id="HContactinformation28Forquestions2Ccontactusat202629" %)
377 -(% class="small" %)**Contact information (For questions, contact us at…)**
365 +(% class="wikigeneratedid" %)
366 +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.
378 378  
379 -.
368 +(% class="wikigeneratedid" %)
369 +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.