Skip to content

Commit

Permalink
Merge 3709339 into 44d1500
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Sep 5, 2017
2 parents 44d1500 + 3709339 commit 3e1aaad
Show file tree
Hide file tree
Showing 2 changed files with 11 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
9 changes: 9 additions & 0 deletions test/system/test_nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,14 @@ def test_tsodyks_markram_synapse():
assert_arrays_equal(tau_psc, numpy.arange(0.2, 0.7, 0.1))


def test_issue505():
sim = pyNN.nest
sim.setup()
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])


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

0 comments on commit 3e1aaad

Please sign in to comment.