Skip to content

Commit

Permalink
Merge 799bd10 into 6351ae8
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Sep 6, 2017
2 parents 6351ae8 + 799bd10 commit 73b00e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pyNN/nest/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,23 +318,18 @@ def _get_attributes_as_list(self, names):
nest_names.append('target')
else:
nest_names.append(name)
values = nest.GetStatus(self.nest_connections, nest_names)
values = numpy.array(nest.GetStatus(self.nest_connections, nest_names)) # ought to preserve int type for source, target
if 'weight' in names: # other attributes could also have scale factors - need to use translation mechanisms
values = numpy.array(values) # ought to preserve int type for source, target
scale_factors = numpy.ones(len(names))
scale_factors[names.index('weight')] = 0.001
if self.receptor_type == 'inhibitory' and self.post.conductance_based:
scale_factors[names.index('weight')] *= -1 # NEST uses negative values for inhibitory weights, even if these are conductances
values *= scale_factors
values = values.tolist()
if 'presynaptic_index' in names:
values = numpy.array(values)
values[:, names.index('presynaptic_index')] -= self.pre.first_id
values = values.tolist()
if 'postsynaptic_index' in names:
values = numpy.array(values)
values[:, names.index('postsynaptic_index')] -= self.post.first_id
values = values.tolist()
values = values.tolist()
for i in xrange(len(values)):
values[i] = tuple(values[i])
return values
Expand Down
12 changes: 12 additions & 0 deletions test/system/scenarios/test_parameter_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,22 @@ def test_set_synaptic_parameters_multiply_connected(sim):
test_set_synaptic_parameters_multiply_connected.__test__ = False


@register()
def issue505(sim):
sim.setup(timestep=0.05, min_delay=0.05)
p = sim.Population(2, sim.IF_cond_exp())
projection = sim.Projection(p, p, sim.AllToAllConnector(), sim.TsodyksMarkramSynapse(U=0.543))
U = projection.get('U', format='list', with_address=False)
assert_equal(U, [0.543, 0.543, 0.543, 0.543])
delay = projection.get('delay', format='list', with_address=False)
assert_equal(delay, [0.05, 0.05, 0.05, 0.05])


if __name__ == '__main__':
from pyNN.utility import get_simulator
sim, args = get_simulator()
issue241(sim)
issue302(sim)
test_set_synaptic_parameters_fully_connected(sim)
test_set_synaptic_parameters_partially_connected(sim)
issue505(sim)

0 comments on commit 73b00e1

Please sign in to comment.