-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanothertest.py
More file actions
35 lines (29 loc) · 1.02 KB
/
anothertest.py
File metadata and controls
35 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from pyNN.random import RandomDistribution, NumpyRNG
from pyNN.utility.plotting import Figure, Panel
import pyNN.nest as sim
# simulation setup
sim.setup(timestep=0.1) # 0.1ms resolution
rng = NumpyRNG(seed=69)
# configuring neuron model
cell_parameters = {
'v_rest': RandomDistribution('normal', (-65.0, 1.0), rng),
'v_thresh': RandomDistribution('normal', (-55.0, 1.0), rng),
'v_reset': -65.0,
'tau_refrac': 1.0, # ms
'tau_m': 10.0, # ms
'cm': 1.0, # nF
'i_offset': 1.1 # nA
}
# 100 integrate & fire neurons
population = sim.Population(100, sim.IF_curr_exp(**cell_parameters))
population.record('v') # record membrane voltage
sim.run(100.0) # run simulation for 100 ms
# data plotting!
data = population.get_data().segments[0]
Figure(
Panel(data.filter(name='v')[0][:, 0], # voltage of first neuron
xlabel="Time (ms)", ylabel="Membrane potential (mV)"),
title="PyNN simulation results",
annotations=f"Simulated with {sim.__name__}"
).show()
sim.end()