Skip to content

Commit

Permalink
Fix for #529
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Jan 4, 2018
1 parent 17ba161 commit 76d3517
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyNN/nest/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ def _set_common_synapse_property(self, name, value):
"Projection was only partially initialized."
" Please call sim.nest.reset() to reset "
"your network and start over!".format(name))
if hasattr(value, "__len__"):
value = value[0]
self._common_synapse_properties[name] = value
nest.SetDefaults(self.nest_synapse_model, name, value)

Expand Down
41 changes: 41 additions & 0 deletions test/system/test_nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,47 @@ def test_native_electrode_types():
assert_array_equal(vm[:, 2].magnitude, vm[:, 3].magnitude)


def test_issue529():
# A combination of NEST Common synapse properties and FromListConnector doesn't work
if not have_nest:
raise SkipTest
import nest
sim = pyNN.nest

sim.setup()

iaf_neuron = sim.native_cell_type('iaf_psc_exp')
poisson = sim.native_cell_type('poisson_generator')

p1 = sim.Population(10, iaf_neuron(tau_m=20.0, tau_syn_ex=3., tau_syn_in=3.))
p2 = sim.Population(10, iaf_neuron(tau_m=20.0, tau_syn_ex=3., tau_syn_in=3.))

nest.SetStatus(list(p2), [{'tau_minus': 20.}])

stdp = sim.native_synapse_type("stdp_synapse_hom")(**{
'lambda': 0.005,
'mu_plus': 0.,
'mu_minus': 0.,
'alpha': 1.1,
'tau_plus': 20.,
'Wmax': 10.,
})

W = numpy.random.rand(5)

connections = [
(0, 0, W[0]),
(0, 1, W[1]),
(0, 2, W[2]),
(1, 5, W[3]),
(6, 1, W[4]),
]

ee_connector = sim.FromListConnector(connections, column_names=["weight"])

prj_plastic = sim.Projection(p1, p2, ee_connector, receptor_type='excitatory', synapse_type=stdp)


if __name__ == '__main__':
#data = test_random_seeds()
test_native_electrode_types()

0 comments on commit 76d3517

Please sign in to comment.