Skip to main content

Python SDK for NeuroFlow — the hardware-agnostic neural data platform. Connect to EEG/BCI devices, stream real-time data, and extract features with zero neuro-expertise required.

Project description

NeuroFlow SDK for Python

Version Python License

Build brain-computer interfaces in Python. Connect to 20+ EEG/BCI devices, stream real-time neural data, extract features, and run ML predictions — with zero neuroscience expertise required.

from neuroflow import Client

client = Client(base_url="http://localhost:8000", api_key="your-key")

# Discover and connect
devices = client.discover_devices()
device = client.connect(devices[0].id)

# Stream with real-time features
session = device.start_session()
for packet in session.stream():
    print(f"Focus: {packet.features.focus_score:.2f}")
    print(f"Alpha: {packet.features.band_powers['alpha']:.2f}")

session.stop()

Installation

pip install neuroflow

For local device access (no server needed):

pip install "neuroflow[local]"

Quick Start

Remote Mode (via API server)

from neuroflow import Client

client = Client(base_url="http://localhost:8000", api_key="your-key")

# List available devices
devices = client.discover_devices()

# Connect and start session
device = client.connect(devices[0].id)
session = device.start_session()

# Get features
features = session.get_features()
print(f"Band powers: {features.band_powers}")
print(f"Focus score: {features.focus_score}")

session.stop()
device.disconnect()

Local Mode (direct device access, no server)

from neuroflow import LocalClient

# Connect to synthetic board for development
client = LocalClient(board_id=-1)
client.connect()

# Start streaming
client.start_stream()
data = client.get_data(num_samples=512)

# Extract features locally
features = client.get_features()
print(f"Alpha power: {features.band_powers['alpha']:.4f}")

client.stop_stream()
client.disconnect()

Async Streaming

import asyncio
from neuroflow import AsyncClient

async def main():
    client = AsyncClient(base_url="http://localhost:8000", api_key="your-key")

    devices = await client.discover_devices()
    device = await client.connect(devices[0].id)
    session = await device.start_session()

    async for packet in session.stream():
        print(f"Focus: {packet.features.focus_score:.2f}")
        if packet.features.focus_score > 0.8:
            print("High focus detected!")
            break

    await session.stop()

asyncio.run(main())

Features

  • 20+ Device Support — Muse, OpenBCI, Emotiv, BrainBit, g.tec, and more via BrainFlow
  • Real-Time Processing — Sub-millisecond Rust-accelerated DSP pipeline (0.18ms P95)
  • Feature Extraction — Band powers, spectral entropy, Hjorth parameters, connectivity metrics
  • ML Inference — ONNX model deployment for focus detection, relaxation, and custom classifiers
  • Dual Mode — Remote (API server) or Local (direct device access)
  • Type-Safe — Full Pydantic models with type hints throughout
  • Async Support — Native async/await with AsyncClient

Supported Devices

Device Board ID Protocol
Synthetic (dev) -1 Simulated
Muse 2 22 Bluetooth
Muse S 21 Bluetooth
OpenBCI Cyton 0 Serial
OpenBCI Ganglion 1 Serial/BLE
Emotiv Insight 25 Bluetooth
BrainBit 7 Bluetooth
... and 20+ more

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuroflow_sdk-0.1.0.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuroflow_sdk-0.1.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file neuroflow_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: neuroflow_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for neuroflow_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f135f2ce6ee625282ae39f0d0be623eed15188657ccd1bc74e4e8a4a4523905a
MD5 73187a647eb41623594306604a4bb715
BLAKE2b-256 b5d3bda040469f3910563250755c0b20d0c15425d70374097532a022ec9a3bc0

See more details on using hashes here.

File details

Details for the file neuroflow_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: neuroflow_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for neuroflow_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18f7054a29a02ba4a26c13c5429deb50f9fb4d3d309869f4e29e327a202fccca
MD5 9a2a7aa5526226d07bf61f9f41db6cce
BLAKE2b-256 fd2d3341f973b7a6611747cb2fbbff099616852aafc7f72c365858273aa8854d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page