Skip to content

Add Python DataFilter.rereference_channels for EEG/EXG - #870

Open
OgarkovAnton wants to merge 2 commits into
brainflow-dev:masterfrom
OgarkovAnton:feature/python-rereference-channels
Open

OgarkovAnton wants to merge 2 commits into
brainflow-dev:masterfrom
OgarkovAnton:feature/python-rereference-channels

Conversation

@OgarkovAnton

Copy link
Copy Markdown

Implements #619 with a Python-only helper that subtracts the mean of selected reference channels from non-excluded channels, plus unit tests and CI coverage.

Implements brainflow-dev#619 with a Python-only helper that subtracts the mean of
selected reference channels from non-excluded channels, plus unit tests
and CI coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Andrey1994
Andrey1994 self-requested a review November 2, 2026 23:05

@Andrey1994 Andrey1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hi and thanks!

https://brainflow.readthedocs.io/en/stable/BrainFlowDev.html should be a good starting point about how c++ methods are called from other languages in brainflow, this should follow the same pattern instead of implementing it in python directly

Comment thread python_package/brainflow/data_filter.py Outdated
:type excluded_channels: list or tuple or ndarray or None
:return: new 2d array with the same shape as ``data``
:rtype: NDArray[Shape["*, *"], Float64]
:raises ValueError: if ``data`` is not a non-empty 2d array, ``reference`` is empty,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of implementing it in the python layer directly it should follow the workflow as for other methods(should be done in c++ and other languages should call it from there)

Move channel re-referencing from a Python-only helper into the native
DataHandler C API with an in-place channels/reference_channels API, then
expose it through C++ and the other language bindings per review on brainflow-dev#619.

Co-authored-by: Cursor <cursoragent@cursor.com>

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