Skip to content

← diagnostics package

EstimateTimeshift

Estimate the time shift between two streams in the given data, in seconds.

This quantifies by how much (in s) the second stream is delayed relative to the first stream. This uses a correlation-based method which therefore requires that the two streams contain one or more signal components that can be linearly transformed into each other. Note that this node requires some carefully prepared input data, which should have at least the following processing steps applied to it: resampling to same nominal sampling rate, removal of irrelevant channels (e.g., trigger channels etc), possible reduction to a moderate channel count (max 64 per stream), zero-median re-referencing, replacement of non-finite data points, band-pass filter to frequency band of interest, trimming of all streams to same time range, and interpolation onto the same time base using eg nearest-neighbor method. Version 0.9.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
IN

shift

Estimated time-shift.

verbose name
Shift
default value
None
port type
DataPort
value type
float (can be None)
data direction
OUT

corr

Maximum correlation value.

verbose name
Corr
default value
None
port type
DataPort
value type
float (can be None)
data direction
OUT

streams

List of stream names to compare. If not given, the data must have exactly two non-empty signal streams.

verbose name
Streams
default value
[]
port type
ListPort
value type
list (can be None)

method

Method to use for the estimation: 'cca' for canonical correlation analysis (which can handle multi-channel data but is slower), and 'corr' is the regular single-channel correlation (requires each stream to have only one channel).

verbose name
Method
default value
cca
port type
EnumPort
value type
str (can be None)

max_delay

Maximum delay that will be considered, in seconds.

verbose name
Max Delay
default value
0.5
port type
FloatPort
value type
float (can be None)

max_iter

Maximum number of iterations for the estimation.

verbose name
Max Iter
default value
10
port type
IntPort
value type
int (can be None)

blocksize

Block size in seconds for robust estimation. If one of the modalities is not very robust (e.g., can drop out), this can be used to estimate the delay over smaller stretches of data, and then take a robust mean of the maximum correlation values. The length of these stretches (the block size) should be chosen to roughly reflect the duration over which a modality may be stable, but should not be too short, especially not if the streams have more than a few channels due to ambiguity.

verbose name
Blocksize
default value
None
port type
FloatPort
value type
float (can be None)

trim_proportion

Proportion of the data to trim when using robust estimation (via the blocksize). This represents the fraction of the time that a modality may be unreliable.

verbose name
Trim Proportion
default value
0.25
port type
FloatPort
value type
float (can be None)

verbose

Display lag in console with every tick.

verbose name
Verbose
default value
False
port type
BoolPort
value type
bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)