Skip to content

Commit 1b0f1ef

Browse files
authored
Merge pull request #1416 from h-mayorquin/fix_intan_dtype_in_get_analog_signal_chunk
IntanRawIO: type casting bug in `_get_analogsignal_chunk`
2 parents 170b4fe + ffaf32b commit 1b0f1ef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

neo/rawio/intanrawio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea
187187
channel_indexes = slice(None)
188188
channel_ids = signal_channels["id"][channel_indexes]
189189

190-
shape = self._raw_data[channel_ids[0]].shape
190+
channel_id_0 = channel_ids[0]
191+
shape = self._raw_data[channel_id_0].shape
191192

192193
# some channel (temperature) have 1D field so shape 1D
193194
# because 1 sample per block
@@ -200,7 +201,9 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea
200201
sl0 = i_start % block_size
201202
sl1 = sl0 + (i_stop - i_start)
202203

203-
sigs_chunk = np.zeros((i_stop - i_start, len(channel_ids)), dtype="uint16")
204+
# Create an array to store the requested chunk
205+
dtype = self._raw_data[channel_id_0].dtype
206+
sigs_chunk = np.zeros((i_stop - i_start, len(channel_ids)), dtype=dtype)
204207
for channel_index, channel_id in enumerate(channel_ids):
205208
# Memmap fields are the channel_ids for unique channels
206209
data_chan = self._raw_data[channel_id]

0 commit comments

Comments
 (0)