Skip to content

← signal_processing package

Rereferencing

Subtract the average of some reference data.

The two most common use cases of this are a) re-referencing of EEG/EMG, where one or more channels are averaged, and the result is subtracted from all channels, and b) baseline removal, where the average in some baseline time window is taken, and subtracted from the whole time period. The range can be given either as a list of values (e.g., indices or channel names in single quotes), formatted as [value1, value2, ...], or as a range expression of the form start:stop, where all successive indices beginning with start and up to one prior to stop are included. This node also supports robust averaging using the median, which can be useful for robust re-referencing, where one or more channels are particularly noisy. Alternatively, instead of specifying a data range from the current data packet to use as reference, you can use data from another packet fed into this node through the reference_data port. This reference data must have the same shape as the data to be subtracted from except along the axis to be rereferenced. Version 1.1.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

reference_data

Reference data to subtract

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

axis

Axis along which to take the reference or baseline.

verbose name
Select Reference Along Axis
default value
space
port type
ComboPort
value type
str (can be None)

reference_range

Data range to use as reference / baseline. When the space axis is used (standard re-referencing), this is typically a channel range, e.g. ':' or ['TP8', 'TP9'] or 'Chn1':'Chn10', and the reference unit is set to 'names'. When the time axis is used (baseline removal), this is typically the baseline time window in seconds, e.g., -0.2:0.0. If [] (empty list), the data is not rereferenced.

verbose name
Reference Selection
default value
:
port type
Port
value type
object (can be None)

reference_unit

Unit in which the reference range is given. Depending on the axis, different units are applicable, e.g., names for space, seconds for time, indices for any axis.

verbose name
Unit Of Measurement For Selection
default value
auto
port type
EnumPort
value type
str (can be None)

estimator

Estimator to use. Mean is the standard choice, median is a robust alternative (tolerates, e.g., bad channels) and trim_mean is a robust alternative which does not inlcude the outliers in the mean calculation.

verbose name
Use Estimator
default value
mean
port type
EnumPort
value type
str (can be None)

cut_prop

Fraction of the outliers to cut off for trim_mean option.

verbose name
Proportion Cutoff For Trim Mean Option
default value
0.1
port type
FloatPort
value type
float (can be None)

use_separate_reference

If checked, the range property will be ignored and the data in the reference_data port will be used instead. The reference_data tensor must include the axis selected above, and be the same size as the data except along the selected axis.

verbose name
Use Separate Reference
default value
False
port type
BoolPort
value type
bool (can be None)

verbose

Set to false to suppress warnings that rereferencing was not performed (no reference data, data is wrong shape, etc.) .

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

ignore_nans

Ignore nan values in the data.

verbose name
Ignore Nans
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)