Skip to content

Commit 721e119

Browse files
committed
fix for header attached
1 parent a83f73c commit 721e119

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

neo/rawio/intanrawio.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,11 @@ def _get_analogsignal_chunk_header_attached(self, i_start, i_stop, stream_index,
462462
sl1 = sl0 + (i_stop - i_start)
463463

464464
if not stream_is_digital:
465-
# For all streams raw_data is a structured memmap with a field for each channel_id
466-
sigs_chunk = np.zeros((i_stop - i_start, len(channel_ids)), dtype=dtype)
465+
# For all streams raw_data is a structured memmap with a field for each channel_id
466+
sigs_chunk = np.zeros((i_stop - i_start, len(channel_ids)), dtype=dtype)
467467
for chunk_index, channel_id in enumerate(channel_ids):
468468
data_chan = self._raw_data[channel_id]
469-
469+
470470
if multiple_samples_per_block:
471471
sigs_chunk[:, chunk_index] = data_chan[block_start:block_stop].flatten()[sl0:sl1]
472472
else:
@@ -475,8 +475,8 @@ def _get_analogsignal_chunk_header_attached(self, i_start, i_stop, stream_index,
475475
if stream_is_stim:
476476
sigs_chunk = self._decode_current_from_stim_data(sigs_chunk, 0, sigs_chunk.shape[0])
477477

478-
else:
479-
# For digital data the channels come interleaved in a single field so we need to demultiplex
478+
else:
479+
# For digital data the channels come interleaved in a single field so we need to demultiplex
480480
digital_raw_data = self._raw_data[field_name].flatten()
481481
sigs_chunk = self._demultiplex_digital_data(digital_raw_data, channel_ids, i_start, i_stop)
482482
return sigs_chunk
@@ -969,7 +969,9 @@ def read_rhs(filename, file_format: str):
969969
# based on what Heberto and I read in the docs
970970
for chan_info in stream_name_to_channel_info_list["RHS2000 amplifier channel"]:
971971
# we see which stim were activated
972-
if any([chan_info["native_channel_name"] in stim_file.stem for stim_file in raw_file_paths_dict['Stim channel']]):
972+
if file_format == "header-attached" or any(
973+
[chan_info["native_channel_name"] in stim_file.stem for stim_file in raw_file_paths_dict["Stim channel"]]
974+
):
973975
chan_info_stim = dict(chan_info)
974976
name = chan_info["native_channel_name"]
975977
chan_info_stim["native_channel_name"] = name + "_STIM"
@@ -980,9 +982,9 @@ def read_rhs(filename, file_format: str):
980982
chan_info_stim["gain"] = global_info["stim_step_size"]
981983
chan_info_stim["offset"] = 0.0
982984
chan_info_stim["signal_type"] = 11 # put it in another group
983-
chan_info_stim["dtype"] = "int16" # this change is due to bit decoding see note below
985+
chan_info_stim["dtype"] = "int16" # this change is due to bit decoding see note below
984986
ordered_channel_info.append(chan_info_stim)
985-
# Note that the data on disk is uint16 but the data is
987+
# Note that the data on disk is uint16 but the data is
986988
# then decoded as int16 so the chan_info is int16
987989
if file_format == "header-attached":
988990
memmap_data_dtype += [(name + "_STIM", "uint16", BLOCK_SIZE)]
@@ -1453,7 +1455,6 @@ def create_one_file_per_channel_dict_rhd(dirname):
14531455
"USB board ADC output channel": "board-ANALOG-OUT",
14541456
"USB board digital input channel": "board-DIGITAL-IN",
14551457
"USB board digital output channel": "board-DIGITAL-OUT",
1456-
'Stim channel': "stim"
14571458
}
14581459

14591460

0 commit comments

Comments
 (0)