Skip to content

Commit d189489

Browse files
committed
fix one-file-per-channel + better size
1 parent 98ffe9f commit d189489

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

neo/rawio/intanrawio.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _get_signal_size(self, block_index, seg_index, stream_index):
250250
if self.file_format == "header-attached":
251251
size = self._raw_data[channel_id_0].size
252252
elif self.file_format == 'one-file-per-signal':
253-
size = self._raw_data[stream_index][:,0].size
253+
size = self._raw_data[stream_index].shape[0]
254254
else:
255255
size = self._raw_data[stream_index][0].size
256256

@@ -280,7 +280,7 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea
280280
if self.file_format == 'header-attached':
281281
shape = self._raw_data[channel_ids[0]].shape
282282
elif self.file_format == 'one-file-per-signal':
283-
shape = self._raw_data[stream_index][:, 0].shape
283+
shape = self._raw_data[stream_index].shape
284284
else:
285285
if channel_indexes_are_none:
286286
shape = self._raw_data[stream_index][0].shape
@@ -670,8 +670,10 @@ def read_rhd(filename, file_format: str):
670670
ordered_channels.append(chan_info)
671671
if file_format == "header-attached":
672672
data_dtype += [(name, "uint16", BLOCK_SIZE)]
673-
else:
673+
elif file_format == 'one-file-per-signal':
674674
data_dtype[0] = "int16"
675+
else:
676+
data_dtype[0] += ['int16']
675677

676678
# 1: RHD2000 auxiliary input channel
677679
for chan_info in channels_by_type[1]:
@@ -683,8 +685,11 @@ def read_rhd(filename, file_format: str):
683685
ordered_channels.append(chan_info)
684686
if file_format == "header-attached":
685687
data_dtype += [(name, "uint16", BLOCK_SIZE // 4)]
686-
else:
688+
elif file_format == 'one-file-per-signal':
687689
data_dtype[1] = "uint16"
690+
else:
691+
data_dtype[1] += ["uint16"]
692+
688693

689694

690695
# 2: RHD2000 supply voltage channel
@@ -697,8 +702,10 @@ def read_rhd(filename, file_format: str):
697702
ordered_channels.append(chan_info)
698703
if file_format == "header-attached":
699704
data_dtype += [(name, "uint16")]
705+
elif file_format == 'one-file-per-signal':
706+
data_dtype[2] = "uint16"
700707
else:
701-
data_dtype[1] = "uint16"
708+
data_dtype[2] += ["uint16"]
702709

703710

704711
# temperature is not an official channel in the header
@@ -729,8 +736,10 @@ def read_rhd(filename, file_format: str):
729736
ordered_channels.append(chan_info)
730737
if file_format == "header-attached":
731738
data_dtype += [(name, "uint16", BLOCK_SIZE)]
732-
else:
739+
elif file_format == 'one-file-per-signal':
733740
data_dtype[3] = "uint16"
741+
else:
742+
data_dtype[3] += ["uint16"]
734743

735744

736745
# 4: USB board digital input channel
@@ -753,8 +762,10 @@ def read_rhd(filename, file_format: str):
753762
ordered_channels.append(chan_info)
754763
if file_format == "header-attached":
755764
data_dtype += [(name, "uint16", BLOCK_SIZE)]
756-
else:
765+
elif file_format == 'one-file-per-signal':
757766
data_dtype[sig_type] = "uint16"
767+
else:
768+
data_dtype[sig_type] += ["uint16"]
758769

759770
if global_info["notch_filter_mode"] == 2 and version >= V("3.0"):
760771
global_info["notch_filter"] = '60Hz'

0 commit comments

Comments
 (0)