Data Structures: Arrays, Units and Timestamps
Everything g.Pype hands you, in a scope, a file or a Result, has the same shape, the same precision and the same meaning of time. This page states them once; the pages it links say why.
Shape and precision
What |
How it is |
|---|---|
A frame, a block, a result |
|
Epochs |
|
dtype |
|
A frame’s length |
About 16 ms by default: 4 samples at 250 Hz, 16 at 1000 Hz. A GDS
amplifier delivers what its driver chooses; |
Channels
What |
How it is |
|---|---|
Order |
The EEG channels first, in the order of the montage; then what
the device adds, where enabled: a Unicorn’s accelerometer,
gyroscope and auxiliary channels, a g.Nautilus’s digital input and
extras in its driver’s order, a g.USBamp’s trigger input. A
device’s own counter and validity flag carry the |
Label |
The electrode name, from the montage you pass or the device’s
default; |
Role |
|
Unit |
|
The arrival stamp |
Every live source appends one channel carrying the host instant
each block was seen. It is found by its |
Timestamps
Every stamp g.Pype takes is read from time.perf_counter(), the host’s
monotonic clock, at the instant a block was first seen on the host. That
is a delivery instant, not an acquisition instant: the device’s own
latency is not subtracted. Time and Synchronisation says how samples and events are placed on one
timeline; this table says what time means in each place you read it.
Where |
What the time means |
|---|---|
|
Seconds from the first sample of the result, |
|
The absolute time of the first sample, where the source recorded
one; |
|
Markers as sample positions relative to the first sample. |
A |
A |
A |
A time row in seconds from the first sample, first in the
dataset; |
An |
The rate from the header and markers as EDF+ annotations; the header’s start time is the moment the file was opened, and the reader does not publish it. |
An LSL outlet |
Each chunk is pushed with the pipeline timeline’s host time at the moment of the push, in seconds of the host’s monotonic clock, consistent with every other stamp in the pipeline: the last sample’s own time when the stream is the master’s and nothing upstream holds frames back. Before the timeline has a relation, LSL stamps at push time. |
Samples are timed by arrival on this host, not by the stream’s own stamps. |
|
A |
The arrival instant of every block, kept so a replay places the same samples at the same positions. |
Events
An event, a key, a marker or a datagram, carries the host instant it was first seen and is placed on the sample whose period contains that instant. Placing nodes hold every frame back by a 40 ms margin so that a late event still finds its sample, 0 ms when OSCAR runs; the measured placements are in Benchmarks.
Buffering
A source emits a frame once it is full; nothing is buffered beyond that except where a node says so: a MovingAverage holds its window, a Trigger its pre-stimulus span, a placing node its margin. A Collector in a realtime pipeline keeps every frame it receives and grows for as long as the run lasts. A pipeline that cannot keep up does not buffer without bound: the backlog is reported, and the run is stopped, as Season 6, Episode 3 shows.