1111from pyNN import common
1212from pyNN .standardmodels .synapses import TsodyksMarkramSynapse
1313from pyNN .core import is_listlike
14+ from .populations import PopulationView
1415from pyNN .parameters import ParameterSpace
1516from pyNN .space import Space
1617from . import simulator
@@ -139,7 +140,7 @@ def _partition(self, indices):
139140 else :
140141 partitions = [indices ]
141142 return partitions
142-
143+
143144 def _localize_index (self , index ):
144145 """determine which group the postsynaptic index belongs to """
145146 if isinstance (self .post , common .Assembly ):
@@ -192,7 +193,7 @@ def _set_attributes(self, connection_parameters):
192193 value = value .T
193194 filtered_value = value [syn_obj .postsynaptic , syn_obj .presynaptic ]
194195 setattr (syn_obj , name , filtered_value )
195-
196+
196197 def _get_attributes_as_arrays (self , attribute_names , multiple_synapses = 'sum' ):
197198 if isinstance (self .post , common .Assembly ) or isinstance (self .pre , common .Assembly ):
198199 raise NotImplementedError
@@ -215,8 +216,12 @@ def _get_attributes_as_list(self, attribute_names):
215216 for name in attribute_names :
216217 if name == "presynaptic_index" :
217218 value = self ._brian_synapses [0 ][0 ].presynaptic
219+ if isinstance (self .pre , PopulationView ):
220+ value = self .pre .id_to_index (value )
218221 elif name == "postsynaptic_index" :
219222 value = self ._brian_synapses [0 ][0 ].postsynaptic
223+ if isinstance (self .post , PopulationView ):
224+ value = self .post .id_to_index (value )
220225 else :
221226 data_obj = getattr (self ._brian_synapses [0 ][0 ], name ).data
222227 if hasattr (data_obj , "tolist" ):
0 commit comments