Unicorn Hybrid Black

class gpype.backend.sources.hybrid_black.HybridBlack[source]

Bases: AmplifierSource

g.tec Unicorn Hybrid Black amplifier source for EEG acquisition.

Interface to g.tec Unicorn Hybrid Black wireless EEG amplifier using Bluetooth. Supports 8-channel EEG acquisition at 250 Hz, plus optional accelerometer, gyroscope, battery, counter, and validation channels.

SAMPLING_RATE = 250

Fixed sampling rate for Unicorn Hybrid Black amplifier in Hz

NUM_EEG_CHANNELS = 8

Number of EEG channels

NUM_ACCEL_CHANNELS = 3

Number of accelerometer channels (X, Y, Z)

NUM_GYRO_CHANNELS = 3

Number of gyroscope channels (X, Y, Z)

TOTAL_ACQUIRED_CHANNELS = 17

Total number of acquired channels (EEG + Accel + Gyro + Battery + Counter + Validation)

DEVICE_DELAY_MS = 40

Hardware delay compensation in milliseconds (Bluetooth latency)

NUM_UNDERRUNS_ALLOWED = 5

Maximum allowed consecutive buffer underruns before warning

WAIT_BEHIND_S = 0.003

Wait interval when behind (GetData < 1ms), in seconds

WAIT_ON_TIME_S = 0.0039

Wait interval when on time (GetData >= 1ms), in seconds

BEHIND_THRESHOLD_S = 0.001

Threshold for determining if we’re behind (GetData blocking time)

class Configuration[source]

Bases: Configuration

Configuration class for Unicorn Hybrid Black specific parameters.

class Keys[source]

Bases: Keys

Configuration keys for Unicorn Hybrid Black settings.

INCLUDE_ACCEL = 'include_accel'
INCLUDE_GYRO = 'include_gyro'
INCLUDE_AUX = 'include_aux'
TEST_SIGNAL = 'test_signal'
__init__(serial=None, channel_count=None, frame_size=None, include_accel=None, include_gyro=None, include_aux=None, test_signal=None, **kwargs)[source]

Initialize Unicorn Hybrid Black amplifier source.

Parameters:
  • serial (Optional[str]) – Serial number of target device. Uses first discovered if None.

  • channel_count (Optional[int]) – Number of EEG channels (1-8). Defaults to 8.

  • frame_size (Optional[int]) – Samples per processing frame.

  • include_accel (Optional[bool]) – Include accelerometer channels (3 channels).

  • include_gyro (Optional[bool]) – Include gyroscope channels (3 channels).

  • include_aux (Optional[bool]) – Include auxiliary channels (battery, counter, validation).

  • test_signal (Optional[bool]) – Enable test signal mode instead of live data.

  • **kwargs – Additional arguments for parent AmplifierSource.

Raises:

NotImplementedError – If not running on Windows.

start()[source]

Start Unicorn Hybrid Black amplifier and begin data acquisition.

Establishes Bluetooth connection and starts background thread that acquires data and drives the pipeline via cycle().

Raises:
Return type:

None

setup(data, port_context_in)[source]

Setup output port contexts for Unicorn Hybrid Black data streams.

Parameters:
  • data (dict[str, ndarray]) – Input data arrays (empty for source nodes).

  • port_context_in (dict[str, dict]) – Input port contexts (empty for source nodes).

Return type:

dict[str, dict]

Returns:

Dictionary of output port contexts with 250 Hz sampling rate.

stop()[source]

Stop Unicorn Hybrid Black amplifier and clean up resources.

Stops data acquisition, terminates background thread, and disconnects from amplifier hardware.

step(data)[source]

Retrieve processed data frames from the amplifier.

Returns data frames when decimation step is active.

Parameters:

data (dict[str, ndarray]) – Input data dictionary (unused for source nodes).

Return type:

dict[str, ndarray]

Returns:

Dictionary containing EEG data, or None if not a decimation step.

static get_available_devices()[source]

Get list of available Unicorn Hybrid Black devices.

Return type:

list[str]

Returns:

List of device serial numbers that are available for connection. Returns empty list on non-Windows platforms.