Skip to content

Commit 1f7c6a4

Browse files
authored
Merge pull request #51 from cortex-lab/numpy2_fix
numpy2 compatibility
2 parents 7e74d7b + 16ba74a commit 1f7c6a4

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

phylib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
__author__ = 'Cyrille Rossant'
2424
__email__ = 'cyrille.rossant at gmail.com'
25-
__version__ = '2.6.1'
25+
__version__ = '2.6.2'
2626
__version_git__ = __version__ + _git_version()
2727

2828

phylib/io/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ def from_sparse(data, cols, channel_ids):
9191
c = cols.flatten().astype(np.int32)
9292
# Remove columns that do not belong to the specified channels.
9393
c[~np.isin(c, channel_ids)] = -1
94-
assert np.all(np.isin(c, np.r_[channel_ids, -1]))
94+
assert np.all(np.isin(c, np.r_[channel_ids.astype(np.int32), -1]))
9595
# Convert column indices to relative indices given the specified
9696
# channel_ids.
97-
cols_loc = _index_of(c, np.r_[channel_ids, -1]).reshape(cols.shape)
97+
cols_loc = _index_of(c, np.r_[channel_ids.astype(np.int32), -1]).reshape(cols.shape)
9898
assert cols_loc.shape == (n_spikes, n_channels_loc)
9999
n_channels = len(channel_ids)
100100
# Shape of the output array.

phylib/io/traces.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
from pathlib import Path
1717

1818
import numpy as np
19-
from numpy.lib.format import (
20-
_check_version, _write_array_header, dtype_to_descr)
19+
from numpy.lib.format import (write_array_header_1_0, dtype_to_descr)
2120
import mtscomp
2221
from tqdm import tqdm
2322

@@ -554,10 +553,8 @@ def __init__(self, path, shape, dtype, axis=0):
554553
self.shape = shape
555554
self.dtype = np.dtype(dtype)
556555
header = _npy_header(self.shape, self.dtype)
557-
version = None
558-
_check_version(version)
559556
self.fp = open(path, 'wb')
560-
_write_array_header(self.fp, header, version)
557+
write_array_header_1_0(self.fp, header)
561558

562559
def append(self, chunk):
563560
if chunk.ndim == len(self.shape):

0 commit comments

Comments
 (0)