-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99cb268
commit ad3ce3b
Showing
3 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Conversion of NEST example script one_neuron_with_noise.py | ||
""" | ||
|
||
import pyNN.nest as sim | ||
from pyNN.utility.plotting import Figure, Panel | ||
|
||
sim.setup() | ||
|
||
parameters = { | ||
'v_rest': -70, | ||
'cm': 0.25, | ||
'tau_m': 10.0, | ||
'tau_refrac': 2.0, | ||
'tau_syn_E': 2.0, | ||
'tau_syn_I': 2.0, | ||
'i_offset': 0.376, | ||
'v_reset': -70.0, | ||
'v_thresh': -55.0 | ||
} | ||
|
||
|
||
neuron = sim.Population(1, sim.IF_curr_alpha(**parameters), initial_values={"v": -70}) | ||
noise = sim.Population(2, sim.SpikeSourcePoisson(rate=[80000, 15000])) | ||
|
||
neuron.record("v") | ||
|
||
|
||
# weight = [0.0012, -0.001] # nA | ||
weight = 0.0012 | ||
delay = 1.0 | ||
|
||
connections = sim.Projection( | ||
neuron, noise, | ||
sim.AllToAllConnector(), | ||
sim.StaticSynapse(weight=weight, delay=delay)) | ||
|
||
sim.run(1000.0) | ||
|
||
data_1 = neuron.get_data().segments[0].analogsignals[0] | ||
assert data_1.name == "v" | ||
|
||
Figure( | ||
Panel( | ||
data_1, | ||
xticks=True, | ||
yticks=True | ||
) | ||
).show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
Conversion of NEST example script oneneuron.py | ||
""" | ||
|
||
import pyNN.nest as sim | ||
from pyNN.utility.plotting import Panel, Figure | ||
|
||
sim.setup() | ||
|
||
parameters = { | ||
'v_rest': -70, | ||
'cm': 0.25, | ||
'tau_m': 10.0, | ||
'tau_refrac': 2.0, | ||
'tau_syn_E': 2.0, | ||
'tau_syn_I': 2.0, | ||
'i_offset': 0.376, | ||
'v_reset': -70.0, | ||
'v_thresh': -55.0 | ||
} | ||
|
||
|
||
neuron = sim.Population(1, sim.IF_curr_alpha(**parameters), initial_values={"v": -70}) | ||
neuron.record("v") | ||
|
||
sim.run(200.0) | ||
|
||
|
||
data_1 = neuron.get_data().segments[0].analogsignals[0] | ||
|
||
assert data_1.name == "v" | ||
|
||
Figure( | ||
Panel( | ||
data_1, | ||
xticks=True, | ||
yticks=True | ||
) | ||
).show() | ||
|
||
|
||
neuron.set(i_offset=0.450) | ||
|
||
|
||
sim.run(1000.0) | ||
|
||
data_2 = neuron.get_data().segments[0].analogsignals[0] | ||
|
||
assert data_2.name == "v" | ||
|
||
Figure( | ||
|
||
Panel( | ||
data_2, | ||
xticks=True, | ||
yticks=True | ||
) | ||
).show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
Conversion of NEST example script twoneurons.py | ||
""" | ||
|
||
import pyNN.nest as sim | ||
from pyNN.utility.plotting import Figure, Panel | ||
|
||
|
||
sim.setup() | ||
|
||
|
||
parameters_1 = { | ||
'v_rest': -70, | ||
'cm': 0.25, | ||
'tau_m': 10.0, | ||
'tau_refrac': 2.0, | ||
'tau_syn_E': 2.0, | ||
'tau_syn_I': 2.0, | ||
'i_offset': 0.376, | ||
'v_reset': -70.0, | ||
'v_thresh': -55.0 | ||
} | ||
parameters_2 = parameters_1.copy() | ||
parameters_2["i_offset"] = 0.0 | ||
|
||
neuron_1 = sim.Population(1, sim.IF_curr_alpha(**parameters_1), initial_values={"v": -70}) | ||
neuron_2 = sim.Population(1, sim.IF_curr_alpha(**parameters_2), initial_values={"v": -70}) | ||
|
||
neuron_1.record("v") | ||
neuron_2.record("v") | ||
|
||
weight = 0.02 # nA | ||
delay = 1.0 | ||
|
||
connections = sim.Projection( | ||
neuron_1, neuron_2, | ||
sim.AllToAllConnector(), | ||
sim.StaticSynapse(weight=weight, delay=delay)) | ||
|
||
sim.run(1000.0) | ||
|
||
data_1 = neuron_1.get_data().segments[0].analogsignals[0] | ||
data_2 = neuron_2.get_data().segments[0].analogsignals[0] | ||
|
||
assert data_1.name == "v" | ||
|
||
Figure( | ||
Panel( | ||
data_1, | ||
xticks=True, | ||
yticks=True | ||
), | ||
Panel( | ||
data_2, | ||
xticks=True, | ||
yticks=True | ||
) | ||
).show() | ||
|