Skip to content

Commit

Permalink
Remove more deprecated numpy aliases/functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mstimberg committed Sep 7, 2023
1 parent 717c747 commit 0c37a9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions brian2/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_dtype(obj):
if hasattr(obj, "dtype"):
return obj.dtype
else:
return np.obj2sctype(type(obj))
return np.dtype(type(obj))


def get_dtype_str(val):
Expand Down Expand Up @@ -353,11 +353,11 @@ def __init__(self, name, value, dimensions=DIMENSIONLESS, owner=None):
# Use standard Python types if possible for numpy scalars
if getattr(value, "shape", None) == () and hasattr(value, "dtype"):
numpy_type = value.dtype
if np.can_cast(numpy_type, np.int_):
if np.can_cast(numpy_type, int):
value = int(value)
elif np.can_cast(numpy_type, np.float_):
elif np.can_cast(numpy_type, float):
value = float(value)
elif np.can_cast(numpy_type, np.complex_):
elif np.can_cast(numpy_type, complex):
value = complex(value)
elif value is np.True_:
value = True
Expand Down
2 changes: 1 addition & 1 deletion brian2/groups/neurongroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def __setattr__(self, key, value):
if value.index is not None:
try:
index_array = np.asarray(value.index)
if not np.issubsctype(index_array.dtype, int):
if not np.issubdtype(index_array.dtype, int):
raise TypeError()
except TypeError:
raise TypeError(
Expand Down

0 comments on commit 0c37a9f

Please sign in to comment.