Skip to content

Commit

Permalink
fix for #659
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Nov 14, 2019
1 parent c0fcc53 commit b26bed0
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pyNN/nest/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def _convergent_connect(self, presynaptic_indices, postsynaptic_index,
synapse_model=self.nest_synapse_model,
synapse_label=self.nest_synapse_label)
for name, value in connection_parameters.items():
value = make_sli_compatible(value)
if name not in self._common_synapse_property_names:
value = make_sli_compatible(value)
#logger.debug("Setting %s=%s for connections %s" % (name, value, connections))
if isinstance(value, numpy.ndarray):
# the str() is to work around a bug handling unicode names in SetStatus in NEST 2.4.1 when using Python 2
Expand Down Expand Up @@ -258,8 +258,8 @@ def _set_attributes(self, parameter_space):
for name, value in connection_parameters.items():
if name == "weight" and self.receptor_type == 'inhibitory' and self.post.conductance_based:
value *= -1 # NEST uses negative values for inhibitory weights, even if these are conductances
value = make_sli_compatible(value)
if name not in self._common_synapse_property_names:
value = make_sli_compatible(value)
if len(source_mask) > 1:
nest.SetStatus(connections, name, value[source_mask])
elif isinstance(value, numpy.ndarray): # OneToOneConnector
Expand Down Expand Up @@ -288,9 +288,19 @@ def _set_common_synapse_property(self, name, value):
" 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)
value1 = value[0]
else:
value1 = value
self._common_synapse_properties[name] = value1
# we delay make_sli_compatible until this late stage so that we can
# distinguish "parameter is an array consisting of scalar values"
# (one value per connection) from
# "parameter is a scalar value containing an array"
# (one value for the entire projection)
# In the latter case the value is wrapped in a Sequence object,
# which is removed by make_sli_compatible
value2 = make_sli_compatible(value1)
nest.SetDefaults(self.nest_synapse_model, name, value2)

#def saveConnections(self, file, gather=True, compatible_output=True):
# """
Expand Down

0 comments on commit b26bed0

Please sign in to comment.