Skip to content

Commit 17a3c38

Browse files
authored
Merge pull request #845 from apdavison/issue844
Fix IF_curr_delta ignoring initial v and unable to record v on NEST
2 parents 8b01fcb + f0fc047 commit 17a3c38

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

pyNN/nest/standardmodels/cells.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class IF_curr_delta(cells.IF_curr_delta):
7474
('v_thresh', 'V_th'),
7575
('i_offset', 'I_e', 1000.0), # I_e is in pA, i_offset in nA
7676
)
77+
variable_map = {'v': 'V_m'}
78+
scale_factors = {'v': 1}
7779
# extra parameters in the NEST model
7880
# V_min mV Absolute lower value for the membrane potenial
7981
# refractory_input boolean If true, do not discard input during

test/system/scenarios/test_cell_types.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,32 @@ def test_update_SpikeSourceArray(sim, plot_figure=False):
297297
assert_array_equal(data[0].magnitude, np.array([12, 15, 18, 22, 25]))
298298

299299

300+
@run_with_simulators("nest", "brian2")
301+
def test_IF_curr_delta_voltage_step(sim):
302+
"""A single delta-synapse input steps V by the weight (mV).
303+
304+
Guards the Arbor weight scaling: a lif_cell delta event adds weight/C_m to
305+
V_m, so the connection weight is scaled by C_m to recover PyNN's mV step.
306+
"""
307+
sim.setup(timestep=0.1)
308+
v_rest = -65.0
309+
weight = 5.0 # mV voltage step
310+
source = sim.Population(1, sim.SpikeSourceArray(spike_times=[20.0]))
311+
cell = sim.Population(1, sim.IF_curr_delta(
312+
v_rest=v_rest, v_reset=v_rest, v_thresh=-40.0,
313+
tau_m=20.0, cm=1.0, tau_refrac=0.1),
314+
initial_values={'v': v_rest})
315+
sim.Projection(source, cell, sim.AllToAllConnector(),
316+
sim.StaticSynapse(weight=weight, delay=1.0),
317+
receptor_type="excitatory")
318+
cell.record('v')
319+
sim.run(60.0)
320+
v = cell.get_data().segments[0].filter(name='v')[0].magnitude[:, 0]
321+
step = v.max() - v_rest
322+
assert abs(step - weight) < 1e-12, step
323+
sim.end()
324+
325+
300326
@run_with_simulators("nest", "neuron", "brian2")
301327
def test_composed_neuron_model_homogeneous_receptors(sim, plot_figure=False):
302328
sim.setup()

0 commit comments

Comments
 (0)