Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Parfenov <[email protected]>
  • Loading branch information
Andrey1994 committed May 12, 2024
1 parent ea23a6f commit cf90732
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 38 deletions.
5 changes: 5 additions & 0 deletions docs/BuildBrainFlow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ Rust
cd brainflow
cargo build --features generate_binding

Swift
-------

You can build Swift binding for BrainFlow using xcode. Before that you need to compile C/C++ code :ref:`compilation-label` and ensure that native libraries are properly placed. Keep in mind that currently it supports only MacOS.

Docker Image
--------------

Expand Down
63 changes: 63 additions & 0 deletions docs/Examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,69 @@ Typescript ICA
.. literalinclude:: ../nodejs_package/tests/ica.ts
:language: javascript

Swift
------------

Swift Get Data from a Board
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/brainflow_get_data/brainflow_get_data.swift
:language: swift

Swift Markers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/markers/markers.swift
:language: swift

Swift Read Write File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/read_write_file/read_write_file.swift
:language: swift

Swift Downsample Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/downsampling/downsampling.swift
:language: swift

Swift Transforms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/transforms/transforms.swift
:language: swift

Swift Signal Filtering
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/signal_filtering/signal_filtering.swift
:language: swift

Swift Denoising
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/denoising/denoising.swift
:language: swift

Swift Band Power
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/band_power/band_power.swift
:language: swift

Swift EEG Metrics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/eeg_metrics/eeg_metrics.swift
:language: swift

Swift ICA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ../swift_package/examples/tests/ica/ica.swift
:language: swift

Notebooks
------------
.. toctree::
Expand Down
10 changes: 10 additions & 0 deletions docs/UserAPI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,13 @@ Example:

.. literalinclude:: ../nodejs_package/tests/brainflow_get_data.ts
:language: javascript

Swift
------

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

Example:

.. literalinclude:: ../swift_package/examples/tests/brainflow_get_data/brainflow_get_data.swift
:language: swift
9 changes: 4 additions & 5 deletions python_package/brainflow/board_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import pkg_resources
from brainflow.exit_codes import BrainFlowExitCodes, BrainFlowError
from brainflow.utils import LogLevels
from nptyping import NDArray, Float64, Shape
from numpy.ctypeslib import ndpointer


Expand Down Expand Up @@ -777,7 +776,7 @@ def get_board_presets(cls, board_id: int) -> List[str]:
:type board_id: int
:return: presets for this board id
:rtype: List[str]
:raises BrainFlowError
:raises BrainFlowError: In case of internal error or invalid args
"""

num_presets = numpy.zeros(1).astype(numpy.int32)
Expand All @@ -795,7 +794,7 @@ def get_version(cls) -> str:
:return: version
:rtype: str
:raises BrainFlowError
:raises BrainFlowError: In case of internal error or invalid args
"""
string = numpy.zeros(64).astype(numpy.ubyte)
string_len = numpy.zeros(1).astype(numpy.int32)
Expand Down Expand Up @@ -1266,7 +1265,7 @@ def release_session(self) -> None:
if res != BrainFlowExitCodes.STATUS_OK.value:
raise BrainFlowError('unable to release streaming session', res)

def get_current_board_data(self, num_samples: int, preset: int = BrainFlowPresets.DEFAULT_PRESET) -> NDArray[Shape["*, *"], Float64]:
def get_current_board_data(self, num_samples: int, preset: int = BrainFlowPresets.DEFAULT_PRESET):
"""Get specified amount of data or less if there is not enough data, doesnt remove data from ringbuffer
:param num_samples: max number of samples
Expand Down Expand Up @@ -1345,7 +1344,7 @@ def is_prepared(self) -> bool:
raise BrainFlowError('unable to check session status', res)
return bool(prepared[0])

def get_board_data(self, num_samples=None, preset: int = BrainFlowPresets.DEFAULT_PRESET) -> NDArray[Shape["*, *"], Float64]:
def get_board_data(self, num_samples=None, preset: int = BrainFlowPresets.DEFAULT_PRESET):
"""Get board data and remove data from ringbuffer
:param num_samples: number of packages to get
Expand Down
Loading

0 comments on commit cf90732

Please sign in to comment.