Skip to content

Return an empty chunk for i_stop=0 in the buffer API - #1985

Open
rmz-oz wants to merge 1 commit into
NeuralEnsemble:masterfrom
rmz-oz:fix-buffer-chunk-istop-zero
Open

rmz-oz wants to merge 1 commit into
NeuralEnsemble:masterfrom
rmz-oz:fix-buffer-chunk-istop-zero

Conversation

@rmz-oz

@rmz-oz rmz-oz commented Dec 4, 2026

Copy link
Copy Markdown

_get_analogsignal_chunk in BaseRawWithBufferApiIO used i_stop or shape, so get_analogsignal_chunk(i_start=0, i_stop=0) returned the whole signal instead of zero samples. The other rawios already check is None, this does the same here. Added a small test with a temporary raw binary file.

@zm711 zm711 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution. I don’t think we need the modification to the tests. This was a good spot, but I would just add a comment to the code above instead.

@@ -1,5 +1,7 @@
import unittest

import numpy as np

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this.

entities_to_test = ["rawbinarysignal/File_rawbinary_10kHz_2channels_16bit.raw"]


def test_get_analogsignal_chunk_empty(tmp_path):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s the value of this test?

Comment thread neo/rawio/baserawio.py
i_stop = i_stop or buffer_desc["shape"][time_axis]
if i_start is None:
i_start = 0
if i_stop is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly prefer just a note here rather than the test. Something like

# see (add link to this PR) or explanation of checking for None.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants