Skip to content

Commit 1f2591d

Browse files
authored
Merge pull request #1944 from fciotti/fix-spike2-unsigned-blocks
Spike2RawIO: read the channel block count as unsigned
2 parents d50b9b9 + 2879679 commit 1f2591d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎neo/rawio/spike2rawio.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def _parse_header(self):
8383
for chan_id in range(info["channels"]):
8484
fid.seek(512 + 140 * chan_id)
8585
chan_info = read_as_dict(fid, channelHeaderDesciption1)
86+
if info["system_id"] >= 9:
87+
# version 9 keeps the high word of the block count in blocks_msw
88+
chan_info["blocks"] = int(chan_info["blocks"]) + 65536 * int(chan_info["blocks_msw"])
8689

8790
if chan_info["kind"] in [1, 6]:
8891
dt = [
@@ -716,10 +719,10 @@ def get_sample_interval(info, chan_info):
716719
("next_del_block", "i4"), # i8
717720
("firstblock", "i4"), # i8
718721
("lastblock", "i4"), # i8
719-
("blocks", "i2"),
722+
("blocks", "u2"), # unsigned: a channel can have more than 32767 blocks
720723
("n_extra", "i2"),
721724
("pre_trig", "i2"),
722-
("free0", "i2"),
725+
("blocks_msw", "i2"), # high word of the block count in version 9, see blocks
723726
("py_sz", "i2"),
724727
("max_data", "i2"),
725728
("comment", "S72"),

0 commit comments

Comments
 (0)