Skip to content

BaseRawIO: fix the has_buffer_description_api() check in get_analogsignal_buffer_description - #1930

Open
cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:fix-has-buffer-description-api
Open

cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:fix-has-buffer-description-api

Conversation

@cboulay

@cboulay cboulay commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

BaseRawIO.get_analogsignal_buffer_description guarded with if not self.has_buffer_description_api:. That is the bound method, which is always truthy, so the guard never raised. A reader without the API went straight to the private _get_analogsignal_buffer_description: readers that do not override it raised NotImplementedError instead of the intended ValueError("This reader do not support buffer_description API"), and a reader that overrides it while its flag is off returned a description with no error.

The fix calls the method: if not self.has_buffer_description_api():.

The new test, test_buffer_description_api_check in test_examplerawio.py, asserts that ExampleRawIO (flag False) raises ValueError. Without the fix it fails with NotImplementedError; with it, it passes. The existing callers (common_rawio_test.py, xarray_utils) check the flag first, so none of them is affected. I also ran the Blackrock, Axon and SpikeGLX rawio tests (29 passed) and black --check.

Found by Colin McNabb while adding buffer descriptions to BlackrockRawIO.

…bject, not the result.

A reader with a false flag went directly to the private method. For a reader with a
method that shouldn't be used (like the Blackrock on PTP files) it returned a wrong
description with no errors. An ExampleRawIO reader, whos flag is False, must raise
ValueError.

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