-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwo_Neurons.py
executable file
·40 lines (30 loc) · 1001 Bytes
/
Two_Neurons.py
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
36
37
38
39
40
import nest
import pylab
neuron1 = nest.Create("iaf_neuron")
neuron2 = nest.Create("iaf_neuron")
nest.GetStatus(neuron1, "I_e")
nest.GetStatus(neuron1, ["V_reset","V_th"])
nest.SetStatus(neuron1, {"I_e": 55.0})
nest.GetStatus(neuron2, "I_e")
nest.GetStatus(neuron2, ["V_reset","V_th"])
nest.SetStatus(neuron2, {"I_e": 376.0})
multimeter = nest.Create("multimeter")
nest.SetStatus(multimeter, {"withtime": True, "record_from": ["V_m"]})
spikedetector = nest.Create("spike_detector", params={"withgid": True, "withtime": True})
nest.Connect(multimeter, neuron2)
nest.Connect(neuron1, neuron2, syn_spec = {"weight":20.0})
nest.Connect(neuron2, spikedetector)
nest.Simulate(1000.0)
"""dmm = nest.GetStatus(multimeter)[0]
Vms = dmm["events"]["V_m"]
ts = dmm["events"]["times"]
pylab.figure(1)
pylab.plot(ts, Vms)
pylab.show()"""
dSD = nest.GetStatus(spikedetector, keys='events')[0]
evs = dSD["senders"]
ts = dSD["times"]
print(ts[0],evs[0])
pylab.figure(2)
pylab.plot(ts, evs, ".")
pylab.show()