Signal Pipeline Architecture
This document describes the internal data flow of the Synaptiq decode engine, from raw EEG electrode voltages to motor-imagery class labels. Understanding this architecture helps you tune parameters for your specific electrode configuration and clinical context.
Architecture overview
Data flow: electrode input → device command
Input format
The SDK accepts EEG data as a multi-channel time series. The canonical shape is [n_channels, n_samples] as a float32 array, in microvolts (μV). Channel ordering must match the montage passed at session initialization.
- Epoch length: 2–6 seconds (default: 4.0s = 2000 samples at 500Hz)
- Epoch overlap: configurable 0–50% (default: 25%)
- Required channels: C3, Cz, C4 at minimum; full perimotor montage preferred (FC3, FCz, FC4, C3, Cz, C4, CP3, CPz, CP4)
- Amplitude range: ±500μV (beyond this triggers artifact flag)
Preprocessing parameters
Preprocessing is configurable via session.set_preprocess_config(). Defaults are optimized for 16-channel gel-cap recordings at 500Hz.
session.set_preprocess_config({
"bandpass_low_hz": 8.0, # mu band low cutoff
"bandpass_high_hz": 30.0, # beta band high cutoff
"filter_order": 4, # Butterworth filter order
"artifact_threshold_uv": 150, # peak-to-peak artifact reject
"eog_channels": ["Fp1", "Fp2"], # set None to disable EOG rejection
"csp_n_filters": 2, # CSP filter pairs per frequency band
"reference": "car" # 'car' | 'linked-mastoid' | 'none'
})
Feature extraction
After spatial filtering by the CSP bank, the SDK computes the sample covariance matrix of each epoch's filtered data. For a 4-second epoch at 500Hz, this yields a 16×16 SPD matrix per filter pair. Euclidean alignment (EA) is then applied: the session's mean covariance is computed and each epoch's matrix is divided by the square root of the mean — re-centering the distribution to the identity matrix neighborhood.
Classifier architecture
The minimum distance to Riemannian mean (MDM) classifier:
- During calibration, compute the Riemannian mean of each class's covariance matrices.
- At decode time, compute the Riemannian distance from the test epoch's covariance to each class mean.
- Assign the epoch to the nearest class. Confidence is derived from the normalized distance ratio.
Command output format
Each decode event produces a Command object:
{
"label": "left_hand", # class label string
"class_id": 0, # zero-indexed class integer
"confidence": 0.91, # 0.0–1.0, use >0.7 for device output
"latency_ms": 72.3, # EEG sample → command dispatch latency
"epoch_onset_ts": 1741852928.44, # Unix timestamp
"artifact_flagged": false # true if epoch had artifact (still decoded)
}