diff --git a/klusta/traces/detect.py b/klusta/traces/detect.py index 11fe93d..5425820 100644 --- a/klusta/traces/detect.py +++ b/klusta/traces/detect.py @@ -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]) diff --git a/klusta/traces/spikedetekt.py b/klusta/traces/spikedetekt.py index 829da1b..9d87f6f 100644 --- a/klusta/traces/spikedetekt.py +++ b/klusta/traces/spikedetekt.py @@ -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] @@ -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 @@ -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. diff --git a/klusta/traces/store.py b/klusta/traces/store.py index 985907f..81e2488 100644 --- a/klusta/traces/store.py +++ b/klusta/traces/store.py @@ -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)) diff --git a/klusta/traces/tests/test_spikedetekt.py b/klusta/traces/tests/test_spikedetekt.py index 140e53f..e6633e8 100644 --- a/klusta/traces/tests/test_spikedetekt.py +++ b/klusta/traces/tests/test_spikedetekt.py @@ -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 diff --git a/klusta/traces/waveform.py b/klusta/traces/waveform.py index 1ddb7b4..17b1027 100644 --- a/klusta/traces/waveform.py +++ b/klusta/traces/waveform.py @@ -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,) diff --git a/klusta/utils.py b/klusta/utils.py index a21bfad..d81ce2c 100644 --- a/klusta/utils.py +++ b/klusta/utils.py @@ -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):