Source code for brainaccess.core.eeg_channel
"""Channel IDs of the values in a data chunk.
A stream delivers its data as one array per channel. Each constant here is a
channel ID. Enable a channel with
:meth:`~brainaccess.core.eeg_manager.EEGManager.set_channel_enabled`, and find
its position in the chunk the callback receives with
:meth:`~brainaccess.core.eeg_manager.EEGManager.get_channel_index`. Channels that
exist once per electrode (or per axis) use consecutive IDs: add the zero-based
electrode (or axis) number to the base ID.
========================= ========================= ========================================
Channel ID Array dtype Unit
========================= ========================= ========================================
``SAMPLE_NUMBER`` ``uint64`` samples
``ELECTRODE_MEASUREMENT`` ``float64`` µV (kOhm in an impedance mode)
``ELECTRODE_CONTACT`` ``uint8`` 0 or 1
``DIGITAL_INPUT`` ``uint8`` 0 or 1
``ACCELEROMETER`` ``float32`` m/s²
``GYROSCOPE`` ``float32`` deg/s
``STREAMING`` ``uint8`` 0 or 1
========================= ========================= ========================================
Use :meth:`~brainaccess.core.eeg_manager.EEGManager.get_stream_channel_data_types`
to read the dtypes of the running stream.
Examples
--------
Find the accelerometer axes and the first electrode in a chunk:
.. code-block:: python
from brainaccess.core import eeg_channel
x = manager.get_channel_index(eeg_channel.ACCELEROMETER + 0)
y = manager.get_channel_index(eeg_channel.ACCELEROMETER + 1)
z = manager.get_channel_index(eeg_channel.ACCELEROMETER + 2)
first_electrode = manager.get_channel_index(eeg_channel.ELECTRODE_MEASUREMENT + 0)
"""
#: Number of each sample, counted from 0 at the start of the stream. In an
#: impedance mode it counts ADC samples, so it advances by a whole sweep of the
#: active electrodes between impedance estimates.
#: Electrode signal in µV, or the electrode impedance in kOhm in an impedance
#: mode. One channel per electrode: ``ELECTRODE_MEASUREMENT + n``.
[docs]
ELECTRODE_MEASUREMENT = 1
#: Contact of the positive (P) contact of a bipolar electrode with the skin.
#: Reserved for bipolar headsets; no current BrainAccess headset provides it.
#: Whether the electrode is in contact with the skin (1 = in contact; for an
#: electrode with P and N contacts, both must touch). Enabling it makes the
#: headset measure the electrode too, since contact can only be detected on a
#: measured electrode. One channel per electrode: ``ELECTRODE_CONTACT + n``.
#: Contact of the negative (N) contact of a bipolar electrode with the skin.
#: Reserved for bipolar headsets; no current BrainAccess headset provides it.
#: Debug feature: standard BrainAccess headsets do not provide a digital input;
#: on them the channel is always 0. Requires headset firmware 3.8.1 or newer.
#: Where available it holds the input level (0 or 1) of each sample, and 0 in rows
#: filled in for lost samples.
#: Gyroscope in deg/s. Three channels, one per axis: ``GYROSCOPE + 0`` to
#: ``GYROSCOPE + 2`` (x, y, z).
#: Accelerometer in m/s². Three channels, one per axis: ``ACCELEROMETER + 0`` to
#: ``ACCELEROMETER + 2`` (x, y, z).
#: 1 for a row that holds a sample received from the headset, 0 for a row the
#: library filled in for a sample that was lost.