Skip to content

Commit

Permalink
test that all rawios accept slice(None)
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 committed Aug 28, 2024
1 parent 40b07ed commit ea7d84f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion neo/test/rawiotest/rawio_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def read_analogsignals(reader):
channel_names = signal_channels["name"][mask]
channel_ids = signal_channels["id"][mask]

# acces by channel inde/ids/names should give the same chunk
# acces by channel index/ids/names should give the same chunk
channel_indexes2 = channel_indexes[::2]
channel_names2 = channel_names[::2]
channel_ids2 = channel_ids[::2]
Expand Down Expand Up @@ -214,6 +214,29 @@ def read_analogsignals(reader):
)
np.testing.assert_array_equal(raw_chunk0, raw_chunk1)

# test slice(None). This should return the same array as giving
# all channel indexes or using None as an argument in `get_analogsignal_chunk`
# see https://github.com/NeuralEnsemble/python-neo/issues/1533

raw_chunk_slice_none = reader.get_analogsignal_chunk(
block_index=block_index,
seg_index=seg_index,
i_start=i_start,
i_stop=i_stop,
stream_index=stream_index,
channel_indexes=slice(None)
)
raw_chunk_channel_indexes = reader.get_analogsignal_chunk(
block_index=block_index,
seg_index=seg_index,
i_start=i_start,
i_stop=i_stop,
stream_index=stream_index,
channel_indexes=channel_indexes
)

np.testing.assert_array_equal(raw_chunk_slice_none, raw_chunk_channel_indexes)

# test prefer_slice=True/False
if nb_chan >= 3:
for prefer_slice in (True, False):
Expand Down

0 comments on commit ea7d84f

Please sign in to comment.