Skip to content

← signal_processing package

SignalWhitening

Perform a whitening (sphering) transform of the signal.

This can yield better data alignment across subjects and studies. If this filter is used on streaming data and has not yet been calibrated, then it will first buffer n seconds of calibration data to determine some statistics, before any output is produced. Version 1.2.0

Ports/Properties

data

Data to process.

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

regularization

Shrinkage regularization strength. Larger values yield more conservative (but less adapted) whitening transforms. Typically only a very small value (e.g., 0.001) is necessary to avoid degenerate solutions.

verbose name
Regularization Strength
default value
0
port type
FloatPort
value type
float (can be None)

robust

Perform robust estimation.

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

init_on

Time range to calibrate (initialize) the filter on. This parameter can take a single number or two numbers. In case of streaming data, this should always be a single number, representing the number of seconds to buffer from the start of the data, for calibration. In case of offline (recorded) data, this can either be a single number, in which case it represents the window of time in seconds from the beginning of the recording to be used; or, it can be a list of two numbers, in which case this refers to a range of data in seconds, relative to the start of the data, to be used for calibration. The latter allows you to calibrate on data other than the first segment of the data (i.e., if known to be bad), or to avoid running the (fairly expensive) filter on a very long file or on each fold of a cross-validation. Note that a value of 0 here will in the case of offline data be interpreted as the entire file, and in the case of streaming data will raise an error.

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

calib_seconds

Amount of data, in seconds, to buffer for calibration on streaming data. For offline (non-streaming) data use the "calibration range" (init_on) parameter instead.

verbose name
Calib Seconds
default value
54
port type
IntPort
value type
int (can be None)

emit_calib_data

Emit the data buffer that was used for calibration, after calibration is complete, in a single chunk. If False, this filter will discard the calibration data. Since this chunk can be quite long, it is often preferable to discard it in a real-time pipeline, but if subsequent nodes need to see the processed calibration data to calibrate themselves (quite likely the case), it needs to be emitted.

verbose name
Emit Calibration Data
default value
True
port type
BoolPort
value type
bool (can be None)

subtract_mean

Subtract the mean from the data.

verbose name
Subtract Mean
default value
True
port type
BoolPort
value type
bool (can be None)

riemannian

Perform Riemannian average. This will take a riemannian average over successive covariance matrix estimates.

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

block_size

Block size. Used for the riemannian method, as well as the robust method. For riemannian, this should be at least on the order of the number of channels, and the lower it is, the more regularization is needed.

verbose name
Block Size
default value
10
port type
IntPort
value type
int (can be None)

use_pseudoinverse

Use pseudoinverse method. This will work if data is rank-deficient even when the regularization parameter is set to 0.

verbose name
Use Pseudoinverse
default value
True
port type
BoolPort
value type
bool (can be None)

store_matrices

Store transform matrices in packet properties.

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

apply_model_to_all_streams

If a loaded whitening model contains exactly one stream, apply that model to other stream names as well when no stream-specific model is available. This only affects model application and does not rename or duplicate the stored model entries.

verbose name
Apply Model To All Streams
default value
False
port type
BoolPort
value type
bool (can be None)

offline_use_all

If init_on is specified and processing offline data, then setting this True will use all data to calculate the whitening transform. The data will be processed chunk-by-chunk with chunk size and the first chunk determined by init_on.

verbose name
Adapt On All Data If Non-Streaming
default value
False
port type
BoolPort
value type
bool (can be None)

offline_cores

Number of cores to use to calculation covariance matrices of chunked input, when offline_use_all is set. Set to 0 or 1 to disable multiprocessing, set to a larger integer to use that many, or set to -1 to use all available CPUs.

verbose name
Num_cores (If Non-Streaming)
default value
1
port type
IntPort
value type
int (can be None)

segsize

Set the total number of samples (space x time) per segment of the output signal on which the spatial filter is applied. 0 (default) will use all samples, but this may run out of memory for long signals. Any other positive value will be rounded up to the next factor of the time axis length. Set to -1 to skip applying the spatial filter altogether, useful if all that is desired is the sphering and covariance matrices.

verbose name
Segsize
default value
0
port type
IntPort
value type
int (can be None)

constrain

Constrain whitening. This is currently mostly to mimic other forms of scale standardization for comparison purposes. none applies no constraints and results in full (regular) whitening. diag constrains the covariance matrix to a diagonal matrix and results in per-channel scaling. Univariate additionally locks all channels to receive the same scale, and is thus equivalent to multiplying by a scalar.

verbose name
Constrain
default value
none
port type
EnumPort
value type
str (can be None)

ignore_resets

Ignore state resets.

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

initialize_once

Initialize (adapt state parameters) only once. If False, this node will recalibrate itself on any qualifying chunk (based on the setting of adapt on streaming chunks).

verbose name
Adapt Only Once
default value
False
port type
BoolPort
value type
bool (can be None)

use_caching

Enable caching.

verbose name
Use Caching
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)