Source code for brainaccess.core.time_sync_info
import ctypes
[docs]
class TimeSyncInfo(ctypes.Structure):
"""Diagnostic; not needed to use annotate.
State of the clock synchronization that
:meth:`~brainaccess.core.eeg_manager.EEGManager.annotate` uses to place
annotations accurately. It needs headset firmware 3.8.0 or newer and is
active while a stream runs. When it is not usable, annotations are placed from
the arrival time of the data packets and can be slightly early. Returned by
:meth:`~brainaccess.core.eeg_manager.EEGManager.get_time_sync_info`.
Attributes
----------
supported : bool
``True`` if the headset took part in the synchronization when the
running (or last) stream started. ``False`` for firmware older than 3.8.0
or before the first stream.
pings : int
Number of synchronization replies received on this connection.
min_rtt_ms : float
Shortest round trip of a synchronization message over the last two
minutes, in ms; 0 without replies.
uplink_envelope_ms : float
Typical extra delay, in ms, of messages sent to the headset over the last
two minutes compared with the fastest ones. This delay is removed when
placing annotations; 0 without replies.
sample_rate_hz : float
The headset's sample rate in Hz, as measured against its own clock. It is
the nominal rate until a second of samples has arrived, and 0 without a
synchronization.
valid : bool
``True`` if annotations are placed with the synchronization right now.
``False`` if packet arrival time is used instead (no stream, impedance
mode, older firmware, or too few or too old replies).
"""
_fields_ = [
("_supported", ctypes.c_uint8),
("pings", ctypes.c_uint32),
("min_rtt_ms", ctypes.c_double),
("uplink_envelope_ms", ctypes.c_double),
("sample_rate_hz", ctypes.c_double),
("_valid", ctypes.c_uint8),
]
@property
[docs]
def supported(self) -> bool:
"""``True`` if the headset took part in the synchronization."""
return bool(self._supported)
@property
[docs]
def valid(self) -> bool:
"""``True`` if annotations are placed with the synchronization right now."""
return bool(self._valid)