Skip to content

Commit 35cbce7

Browse files
authored
Merge pull request #1886 from stanbot8/fix/reshape-numpy-arrays
fix: create signal and waveform views with reshape
2 parents f2c26fb + 90bda1f commit 35cbce7

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

neo/core/analogsignal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def __new__(
211211
obj = pq.Quantity(signal, units=units, dtype=dtype).view(cls)
212212

213213
if obj.ndim == 1:
214-
obj.shape = (-1, 1)
214+
obj = obj.reshape(-1, 1)
215215

216216
if t_start is None:
217217
raise ValueError("`t_start` cannot be None")

neo/rawio/alphaomegarawio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,7 @@ def _get_spike_raw_waveforms(self, block_index, seg_index, spike_channel_index,
911911
offset=file_position,
912912
)
913913
i += 1
914-
waveforms.shape = nb_spikes, 1, spike_length
915-
return waveforms
914+
return waveforms.reshape(nb_spikes, 1, spike_length)
916915

917916
def _event_count(self, block_index, seg_index, event_channel_index):
918917
event_id = int(self.header["event_channels"]["id"][event_channel_index])

0 commit comments

Comments
 (0)