Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using numpy type aliases that were deprecated in 1.20 and later removed #81

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions klusta/traces/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ def __init__(self, probe_adjacency_list=None, join_size=None,
self._channels_per_group = channels_per_group

def __call__(self, weak_crossings=None, strong_crossings=None):
weak_crossings = np.asarray(weak_crossings, np.bool)
strong_crossings = np.asarray(strong_crossings, np.bool)
weak_crossings = np.asarray(weak_crossings, np.bool_)
strong_crossings = np.asarray(strong_crossings, np.bool_)
all_channels = sorted([item for sublist
in self._channels_per_group.values()
for item in sublist])
Expand Down
8 changes: 4 additions & 4 deletions klusta/traces/spikedetekt.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _split_spikes(groups, idx=None, **arrs):
}
groups = np.asarray(groups)
if idx is not None:
assert idx.dtype == np.bool
assert idx.dtype in (bool, np.bool_)
n_spikes_chunk = np.sum(idx)
# First, remove the overlapping bands.
groups = groups[idx]
Expand All @@ -69,7 +69,7 @@ def _split_spikes(groups, idx=None, **arrs):


def _array_list(arrs):
out = np.empty((len(arrs),), dtype=np.object)
out = np.empty((len(arrs),), dtype=object)
out[:] = arrs
return out

Expand Down Expand Up @@ -385,10 +385,10 @@ def extract_spikes(self, components, traces_f,
# groups).
waveforms = _array_list(waveforms)
assert waveforms.shape == (n_spikes,)
assert waveforms.dtype == np.object
assert waveforms.dtype == object

masks = _array_list(masks)
assert masks.dtype == np.object
assert masks.dtype == object
assert masks.shape == (n_spikes,)

# Reorder the spikes.
Expand Down
2 changes: 1 addition & 1 deletion klusta/traces/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def store(self, data=None, **kwargs):
dtype = data.dtype
if not data.size:
return
assert dtype != np.object
assert dtype != object
np.save(path, data)
# debug("Store {}.".format(path))

Expand Down
4 changes: 2 additions & 2 deletions klusta/traces/tests/test_spikedetekt.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def test_relative_channels():


def test_split_spikes():
groups = np.zeros(10, dtype=np.int)
groups = np.zeros(10, dtype=int)
groups[1::2] = 1

idx = np.ones(10, dtype=np.bool)
idx = np.ones(10, dtype=np.bool_)
idx[0] = False
idx[-1] = False

Expand Down
2 changes: 1 addition & 1 deletion klusta/traces/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def masks(self, data_t, wave, comp):
s_min = comp.s_min

# Binary mask. shape: (nc,)
masks_bin = np.zeros(nc, dtype=np.bool)
masks_bin = np.zeros(nc, dtype=np.bool_)
masks_bin[np.unique(comp_ch)] = 1

# Find the peaks (relative to the start of the chunk). shape: (nc,)
Expand Down
2 changes: 1 addition & 1 deletion klusta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _index_of(arr, lookup):
# values
lookup = np.asarray(lookup, dtype=np.int32)
m = (lookup.max() if len(lookup) else 0) + 1
tmp = np.zeros(m + 1, dtype=np.int)
tmp = np.zeros(m + 1, dtype=int)
# Ensure that -1 values are kept.
tmp[-1] = -1
if len(lookup):
Expand Down