Skip to content

Latest commit

 

History

History
165 lines (111 loc) · 4.45 KB

UserAPI.rst

File metadata and controls

165 lines (111 loc) · 4.45 KB

User API

BrainFlow User API has three main modules:

  • BoardShim to read data from a board, it calls methods from underlying BoardController library
  • DataFilter to perform signal processing, it calls methods from underlying DataHandler library
  • MLModel to calculate derivative metrics, it calls methods from underlying MLModule library

These classes are independent, so if you want, you can use BrainFlow API only for data streaming and perform signal processing by yourself and vice versa.

BrainFlow data acqusition API is board agnostic, so to select a specific board you need to pass BrainFlow's board id to BoardShim's constructor and an instance of BrainFlowInputParams structure which should hold information for your specific board, check supported-boards-label. for details. This abstraction allows you to switch boards without any changes in code.

In BoardShim, all board data is returned as a 2d array. Rows in this array may contain timestamps, EEG and EMG data and so on. To see instructions how to query specific kind of data check data-format-label and code-samples-label.

Python API Reference

brainflow.board_shim

brainflow.board_shim

brainflow.exit_codes

brainflow.exit_codes

brainflow.data_filter

brainflow.data_filter

brainflow.ml_model

brainflow.ml_model

C++ API Reference

BoardShim class

BoardShim

DataFilter class

DataFilter

MLModel class

MLModel

BrainFlow constants

../src/utils/inc/brainflow_constants.h

Java API Reference

Content of Brainflow Package:

brainflow

C# API Reference

Content of brainflow namespace:

brainflow

R API Reference

R binding is a wrapper on top of Python binding. It is implemented using reticulate.

Check R samples to see how to use it.

Full code for R binding:

../r_package/brainflow/R/package.R

Matlab API Reference

Matlab binding calls C/C++ code as any other binding, it's not compatible with Octave.

A few general rules to keep in mind:

  • Use char arrays instead strings to work with BrainFlow API, it means 'my_string' instead "my_string", otherwise you will get calllib error
  • Use int32 values intead enums, it means int32 (BoardIDs.SYNTHETIC_BOARD) instead BoardIDs.SYNTHETIC_BOARD, the same is true for all enums in BrainFlow API

Julia API Reference

Julia binding calls C/C++ code as any other binding. Use Julia examples and API reference for other languaes as a starting point.

Since Julia is not Object-Oriented language, there is no DataFilter class. BoardShim class exists but all BoardShim class methods were moved to BrainFlow package and you need to pass BoardShim object to them.

Example:

../julia_package/brainflow/test/serialization.jl

Rust API Reference

Rust binding calls C/C++ code as any other binding. Use Rust examples and API reference for other languaes as a starting point.

Example:

../rust_package/brainflow/examples/get_data.rs

Typescript API Reference

Typescript binding calls C/C++ code as any other binding. Use Typescript examples and API reference for other languaes as a starting point.

Example:

../nodejs_package/tests/brainflow_get_data.ts