Skip to content

Commit

Permalink
Allow slicing an Assembly with a boolean mask
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 28, 2019
1 parent 3fce02d commit 1f98a6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyNN/common/populations.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ def record(self, variables, to_file=None, sampling_interval=None):
multiple of the simulation timestep.
"""
if variables is None: # reset the list of things to record
# note that if record(None) is called on a view of a population
# recording will be reset for the entire population, not just the view
# note that if record(None) is called on a view of a population
# recording will be reset for the entire population, not just the view
self.recorder.reset()
else:
logger.debug("%s.record('%s')", self.label, variables)
Expand Down Expand Up @@ -1144,7 +1144,7 @@ def __getitem__(self, index):
pindex = boundaries[1:].searchsorted(index, side='right')
return self.populations[pindex][index - boundaries[pindex]]
elif isinstance(index, (slice, tuple, list, numpy.ndarray)):
if isinstance(index, slice):
if isinstance(index, slice) or index.dtype == bool:
indices = numpy.arange(self.size)[index]
else:
indices = numpy.array(index)
Expand Down

0 comments on commit 1f98a6d

Please sign in to comment.