Skip to content

Commit cf90732

Browse files
committed
Fix docs
Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent ea23a6f commit cf90732

7 files changed

Lines changed: 111 additions & 38 deletions

File tree

docs/BuildBrainFlow.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ Rust
149149
cd brainflow
150150
cargo build --features generate_binding
151151

152+
Swift
153+
-------
154+
155+
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.
156+
152157
Docker Image
153158
--------------
154159

docs/Examples.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,69 @@ Typescript ICA
602602
.. literalinclude:: ../nodejs_package/tests/ica.ts
603603
:language: javascript
604604

605+
Swift
606+
------------
607+
608+
Swift Get Data from a Board
609+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
610+
611+
.. literalinclude:: ../swift_package/examples/tests/brainflow_get_data/brainflow_get_data.swift
612+
:language: swift
613+
614+
Swift Markers
615+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
616+
617+
.. literalinclude:: ../swift_package/examples/tests/markers/markers.swift
618+
:language: swift
619+
620+
Swift Read Write File
621+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
622+
623+
.. literalinclude:: ../swift_package/examples/tests/read_write_file/read_write_file.swift
624+
:language: swift
625+
626+
Swift Downsample Data
627+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
628+
629+
.. literalinclude:: ../swift_package/examples/tests/downsampling/downsampling.swift
630+
:language: swift
631+
632+
Swift Transforms
633+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
634+
635+
.. literalinclude:: ../swift_package/examples/tests/transforms/transforms.swift
636+
:language: swift
637+
638+
Swift Signal Filtering
639+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
640+
641+
.. literalinclude:: ../swift_package/examples/tests/signal_filtering/signal_filtering.swift
642+
:language: swift
643+
644+
Swift Denoising
645+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646+
647+
.. literalinclude:: ../swift_package/examples/tests/denoising/denoising.swift
648+
:language: swift
649+
650+
Swift Band Power
651+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
652+
653+
.. literalinclude:: ../swift_package/examples/tests/band_power/band_power.swift
654+
:language: swift
655+
656+
Swift EEG Metrics
657+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
658+
659+
.. literalinclude:: ../swift_package/examples/tests/eeg_metrics/eeg_metrics.swift
660+
:language: swift
661+
662+
Swift ICA
663+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
664+
665+
.. literalinclude:: ../swift_package/examples/tests/ica/ica.swift
666+
:language: swift
667+
605668
Notebooks
606669
------------
607670
.. toctree::

docs/UserAPI.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,13 @@ Example:
163163

164164
.. literalinclude:: ../nodejs_package/tests/brainflow_get_data.ts
165165
:language: javascript
166+
167+
Swift
168+
------
169+
170+
Swift binding calls C/C++ code as any other binding. Use Swift examples and API reference for other languaes as a starting point.
171+
172+
Example:
173+
174+
.. literalinclude:: ../swift_package/examples/tests/brainflow_get_data/brainflow_get_data.swift
175+
:language: swift

python_package/brainflow/board_shim.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import pkg_resources
1111
from brainflow.exit_codes import BrainFlowExitCodes, BrainFlowError
1212
from brainflow.utils import LogLevels
13-
from nptyping import NDArray, Float64, Shape
1413
from numpy.ctypeslib import ndpointer
1514

1615

@@ -777,7 +776,7 @@ def get_board_presets(cls, board_id: int) -> List[str]:
777776
:type board_id: int
778777
:return: presets for this board id
779778
:rtype: List[str]
780-
:raises BrainFlowError
779+
:raises BrainFlowError: In case of internal error or invalid args
781780
"""
782781

783782
num_presets = numpy.zeros(1).astype(numpy.int32)
@@ -795,7 +794,7 @@ def get_version(cls) -> str:
795794
796795
:return: version
797796
:rtype: str
798-
:raises BrainFlowError
797+
:raises BrainFlowError: In case of internal error or invalid args
799798
"""
800799
string = numpy.zeros(64).astype(numpy.ubyte)
801800
string_len = numpy.zeros(1).astype(numpy.int32)
@@ -1266,7 +1265,7 @@ def release_session(self) -> None:
12661265
if res != BrainFlowExitCodes.STATUS_OK.value:
12671266
raise BrainFlowError('unable to release streaming session', res)
12681267

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

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

0 commit comments

Comments
 (0)