Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ and may not be the current affiliation of a contributor.
* Axel Coiffard-Donaty
* Anthony Mercer
* Aaron Kanzer [53]
* Eva B (evadiva3 on GitHub)

1. Centre de Recherche en Neuroscience de Lyon, CNRS UMR5292 - INSERM U1028 - Université Claude Bernard Lyon 1
2. Unité de Neuroscience, Information et Complexité, CNRS UPR 3293, Gif-sur-Yvette, France
Expand Down
4 changes: 3 additions & 1 deletion neo/rawio/plexonrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop, strea
# right border
# be careful that bl could be both bl0 and bl1!!
border = data.size - (i_stop - data_blocks[bl]["cumsum"])
data = data[:-border]
# Avoid an empty slice when the chunk ends at the block boundary.
if border > 0:
data = data[:-border]
if bl == bl0:
# left border
border = i_start - data_blocks[bl]["cumsum"]
Expand Down
15 changes: 15 additions & 0 deletions neo/test/rawiotest/test_plexonrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ class TestPlexonRawIO(
"plexon/plx/timestamp_clock/one_megahertz_forty_bit_timestamps/sorted_spikes_and_strobed_events.plx",
]

def test_chunk_stopping_at_the_end_of_the_last_block(self):
"""Keep the final block when the right border is zero."""
reader = PlexonRawIO(filename=self.get_local_path("plexon/File_plexon_3.plx"), progress_bar=False)
reader.parse_header()
last = reader._data_blocks[5][0][-1]
samples = np.frombuffer(reader._memmap, dtype="int16", count=last["size"] // 2, offset=last["pos"])
# Use the parsed start to test trimming independently of the block-offset fix in #1980.
start = int(last["cumsum"])
stop = start + samples.size
for offset in (0, 10):
chunk = reader.get_analogsignal_chunk(i_start=start + offset, i_stop=stop)
np.testing.assert_array_equal(chunk[:, 0], samples[offset:])
chunk = reader.get_analogsignal_chunk(i_start=start, i_stop=stop - 1)
np.testing.assert_array_equal(chunk[:, 0], samples[:-1])

def test_timestamps_with_lower_word_above_two_to_the_31(self):
"""The lower 32 bits of the 40-bit block timestamp must be read unsigned.

Expand Down