Skip to content

Commit fadc9b7

Browse files
committed
np.dtype and shapes must be str and python types
1 parent b9c1e36 commit fadc9b7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/spikeinterface/core/waveform_tools.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def allocate_waveforms_buffers(
170170
Dictionary to "construct" array in workers process (memmap file or sharemem)
171171
"""
172172

173-
nsamples = nbefore + nafter
173+
n_samples = nbefore + nafter
174174

175175
dtype = np.dtype(dtype)
176176
if mode == "shared_memory":
@@ -187,11 +187,11 @@ def allocate_waveforms_buffers(
187187
num_chans = recording.get_num_channels()
188188
else:
189189
num_chans = np.sum(sparsity_mask[unit_ind, :])
190-
shape = (n_spikes, nsamples, num_chans)
190+
shape = (int(n_spikes), int(n_samples), int(num_chans))
191191

192192
if mode == "memmap":
193193
filename = str(folder / f"waveforms_{unit_id}.npy")
194-
arr = np.lib.format.open_memmap(filename, mode="w+", dtype=dtype, shape=shape)
194+
arr = np.lib.format.open_memmap(filename, mode="w+", dtype=dtype.str, shape=shape)
195195
waveforms_by_units[unit_id] = arr
196196
arrays_info[unit_id] = filename
197197
elif mode == "shared_memory":
@@ -475,7 +475,7 @@ def extract_waveforms_to_single_buffer(
475475
Optionally return in case of shared_memory if copy=False.
476476
Dictionary to "construct" array in workers process (memmap file or sharemem info)
477477
"""
478-
nsamples = nbefore + nafter
478+
n_samples = nbefore + nafter
479479

480480
dtype = np.dtype(dtype)
481481
if mode == "shared_memory":
@@ -488,7 +488,7 @@ def extract_waveforms_to_single_buffer(
488488
num_chans = recording.get_num_channels()
489489
else:
490490
num_chans = int(max(np.sum(sparsity_mask, axis=1))) # This is a numpy scalar, so we cast to int
491-
shape = (num_spikes, nsamples, num_chans)
491+
shape = (int(num_spikes), int(n_samples), int(num_chans))
492492

493493
if mode == "memmap":
494494
all_waveforms = np.lib.format.open_memmap(file_path, mode="w+", dtype=dtype, shape=shape)

0 commit comments

Comments
 (0)