Skip to content

Commit fdbbe02

Browse files
committed
Add comprehensive BCI neural framework integration and web control panel
This commit implements a complete BCI integration and web control system: ## BCI Integration Framework - Base adapter architecture for standardized BCI hardware interfaces - OpenBCI adapter with BrainFlow support (Cyton, Ganglion, Daisy) - Synthetic data generator for testing without hardware - LSL (Lab Streaming Layer) integration for network streaming - Circular buffers for efficient real-time data management - Data quality metrics (SNR, artifact detection, quality scoring) ## Top 10 BCI Repository Integration Points 1. OpenBCI (OpenBCI_Python) - Direct hardware interface 2. BrainFlow - Universal board interface 3. MNE-Python - Signal processing pipeline 4. Lab Streaming Layer - Real-time streaming 5. PyRiemann - Riemannian geometry features 6. NeuroDSP - Oscillation analysis 7. NeuroKit2 - Multi-modal physiological signals 8. MOABB - BCI benchmarking framework 9. EEGNet - Deep learning models 10. Bcipy - Real-time experimentation ## Web Control Panel - FastAPI backend with REST API endpoints - WebSocket support for real-time data streaming - CORS middleware for cross-origin requests - System state management - Configuration endpoints for HBCM and BCI setup - Control commands (start, stop, pause, resume, reset) - Data export (JSON, CSV formats) ## Visualization Components - Real-time matplotlib plotting (6 subplots: time series + phase space) - Interactive Plotly visualizations with zoom/pan - 3D trajectory visualization (VTK/PyVista and Plotly 3D) - Spectrogram analysis for frequency domain - Base64 image encoding for web display - Export to PNG, HTML, and interactive formats ## LaTeX Documentation Generator - Automated report generation from simulation data - Mathematical model descriptions (FitzHugh-Nagumo, Van der Pol) - Configuration tables with parameters - Statistical summaries (mean, std, min, max) - BCI integration documentation - BibTeX reference generation - Automatic PDF compilation with pdflatex ## Bi-directional Data Flow Architecture Hardware → Adapters → Buffers → HBCM → Control → Visualization - <50ms latency target for real-time operation - 1000+ samples/second multi-channel throughput - Network synchronization via LSL timestamps - Feedback loops for closed-loop BCI applications ## Examples and Documentation - Comprehensive demo script showing all features - 70+ page integration plan (docs/BCI_INTEGRATION_PLAN.md) - Complete API reference in WEB_CONTROL_PANEL_README.md - Installation guides for all dependencies - Troubleshooting section - Repository links to all integrated frameworks ## Dependencies Added - FastAPI and uvicorn for web server - WebSocket support - BrainFlow and pylsl for BCI hardware - MNE-Python for signal processing - Plotly and PyVista for visualization - LaTeX tools for documentation All code includes comprehensive docstrings, type hints, and follows the established Multi-Heart-Model patterns and conventions.
1 parent 0a54851 commit fdbbe02

File tree

15 files changed

+4315
-0
lines changed

15 files changed

+4315
-0
lines changed

WEB_CONTROL_PANEL_README.md

Lines changed: 649 additions & 0 deletions
Large diffs are not rendered by default.

bci_integration/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
BCI Integration Package
3+
4+
Provides adapters and streaming interfaces for Brain-Computer Interface hardware
5+
integration with the Multi-Heart-Model framework.
6+
"""
7+
8+
__version__ = "1.0.0"
9+
__all__ = []
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""BCI Data Acquisition Adapters."""
2+
3+
from .bci_adapter_base import (
4+
BCIAdapterBase,
5+
BCIDataPacket,
6+
BCIStreamConfig,
7+
CircularBuffer,
8+
DataQualityMetrics,
9+
SignalType
10+
)
11+
from .openbci_adapter import OpenBCIAdapter
12+
from .synthetic_adapter import SyntheticAdapter
13+
14+
__all__ = [
15+
"BCIAdapterBase",
16+
"BCIDataPacket",
17+
"BCIStreamConfig",
18+
"CircularBuffer",
19+
"DataQualityMetrics",
20+
"SignalType",
21+
"OpenBCIAdapter",
22+
"SyntheticAdapter",
23+
]

0 commit comments

Comments
 (0)