Skip to content

Commit 1f98a6d

Browse files
author
Andrew Davison
committed
Allow slicing an Assembly with a boolean mask
1 parent 3fce02d commit 1f98a6d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pyNN/common/populations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ def record(self, variables, to_file=None, sampling_interval=None):
442442
multiple of the simulation timestep.
443443
"""
444444
if variables is None: # reset the list of things to record
445-
# note that if record(None) is called on a view of a population
446-
# recording will be reset for the entire population, not just the view
445+
# note that if record(None) is called on a view of a population
446+
# recording will be reset for the entire population, not just the view
447447
self.recorder.reset()
448448
else:
449449
logger.debug("%s.record('%s')", self.label, variables)
@@ -1144,7 +1144,7 @@ def __getitem__(self, index):
11441144
pindex = boundaries[1:].searchsorted(index, side='right')
11451145
return self.populations[pindex][index - boundaries[pindex]]
11461146
elif isinstance(index, (slice, tuple, list, numpy.ndarray)):
1147-
if isinstance(index, slice):
1147+
if isinstance(index, slice) or index.dtype == bool:
11481148
indices = numpy.arange(self.size)[index]
11491149
else:
11501150
indices = numpy.array(index)

0 commit comments

Comments
 (0)