1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
Description: fix test failures with numpy 1.24.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1028812
Forwarded: no
Last-Update: 2023-01-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- pynn.orig/pyNN/common/populations.py
+++ pynn/pyNN/common/populations.py
@@ -261,7 +261,7 @@
assert isinstance(n, int)
if not rng:
rng = random.NumpyRNG()
- indices = rng.permutation(np.arange(len(self), dtype=np.int))[0:n]
+ indices = rng.permutation(np.arange(len(self), dtype=int))[0:n]
logger.debug("The %d cells selected have indices %s" % (n, indices))
logger.debug("%s.sample(%s)", self.label, n)
return self._get_view(indices)
@@ -658,7 +658,7 @@
else:
raise Exception(
"A maximum of 3 dimensions is allowed. What do you think this is, string theory?")
- # NEST doesn't like np.int, so to be safe we cast to Python int
+ # NEST doesn't like int, so to be safe we cast to Python int
size = int(reduce(operator.mul, size))
self.size = size
self.label = label or 'population%d' % Population._nPop
@@ -718,7 +718,7 @@
if (self.first_id > id.min()) or (self.last_id < id.max()):
raise ValueError("ids should be in the range [%d,%d], actually [%d, %d]" % (
self.first_id, self.last_id, id.min(), id.max()))
- return (id - self.first_id).astype(np.int) # this assumes ids are consecutive
+ return (id - self.first_id).astype(int) # this assumes ids are consecutive
def id_to_local_index(self, id):
"""
@@ -906,7 +906,7 @@
if self._is_sorted:
return np.searchsorted(self.all_cells, id)
else:
- result = np.array([], dtype=np.int)
+ result = np.array([], dtype=int)
for item in id:
data = np.where(self.all_cells == item)[0]
if len(data) == 0:
@@ -1159,7 +1159,7 @@
if self._is_sorted:
return np.searchsorted(all_cells, id)
else:
- result = np.array([], dtype=np.int)
+ result = np.array([], dtype=int)
for item in id:
data = np.where(all_cells == item)[0]
if len(data) == 0:
@@ -1261,7 +1261,7 @@
assert isinstance(n, int)
if not rng:
rng = random.NumpyRNG()
- indices = rng.permutation(np.arange(len(self), dtype=np.int))[0:n]
+ indices = rng.permutation(np.arange(len(self), dtype=int))[0:n]
logger.debug("The %d cells recorded have indices %s" % (n, indices))
logger.debug("%s.sample(%s)", self.label, n)
return self[indices]
--- pynn.orig/pyNN/random.py
+++ pynn/pyNN/random.py
@@ -136,11 +136,11 @@
elif n > 0:
if mask is not None:
assert isinstance(mask, np.ndarray)
- if mask.dtype == np.bool:
+ if mask.dtype == bool:
if mask.size != n:
raise ValueError("boolean mask size must equal n")
if not self.parallel_safe:
- if mask.dtype == np.bool:
+ if mask.dtype == bool:
n = mask.sum()
elif mask.dtype == np.integer:
n = mask.size
|