Skip to content

← nirs package

BadChannelRemovalNIRSSCI

Remove channels with low scalp coupling correlation from NIRS signals.

This node uses between-channel correlations to identify bad channels. This method uses optical densities as inputs and this requires exactly 2 wavelengths per channel to calculate the correlation coefficient between the two. If there are any channels with unmatched wavelength pairs, those channels will be assigned a correlation coefficient of 0, in which case they will be removed (or marked NaN) from the output data. Before computing SCI (correlation coefficients) the optical densities, this node first applies a band-pass filter (FIR) to avoid systematic factors such as cardiac and Mayer waves. Changing the filter settings may greatly impact the resulting correlations. This node can also output the computed SCI values for each channel, as a signal quality diagnostic. The SCI metric is based on Pollonini et. al. 2016. More Info... Version 0.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

diagnostics

Diagnostic information indicating the per-channel error measure.

verbose name
Diagnostics
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
OUT

threshold

Minimum scalp coupling index threshold per channel. This is a value between 0 and 1 (correlation coefficient). Both channels wavelengths in which the optodes are below threshold are removed.

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

action

Action to perform on bad channels. Remove means the channels will be dropped form the data, and mark_nan means that the data of bad channels will be replaced with NaN values (indicating missing data to downstream nodes that can handle it).

verbose name
Action
default value
remove
port type
EnumPort
value type
str (can be None)

axis

Axis along which to filter. Rarely anything other than 'time' is used here.

verbose name
Filter Along Axis
default value
time
port type
ComboPort
value type
str (can be None)

order

Filter order. If unspecified, this will be auto-determined based on the tightness of the transition bands and the desired stopband attenuation (using the Kaiser window rule). Note that high orders (e.g., 1000 or greater) will be fairly heavy on the CPU, especially with many channels.

verbose name
Filter Order
default value
None
port type
IntPort
value type
int (can be None)

frequencies

Transition frequencies. For a lowpass/highpass filter, you can either give the cutoff frequency, or two frequencies to determine the rolloff curve. For a bandpass/bandstop filter, you can give two cutoff frequencies, or 4 frequencies to determine the rolloff curve. The syntax for 'freeform' filters is [(frequency1, gain1), (frequency2, gain2), ...], and you can use the special frequency value -1 as a stand-in for the highest frequency at which a filter can be designed for the given sampling rate (the signal's Nyquist frequency).

verbose name
Frequencies
default value
[0.4, 0.7, 1.5, 1.8]
port type
ListPort
value type
list (can be None)

mode

Filter mode. Low/highpass lets low/high frequencies through, bandpass lets frequencies in a limited band through, and bandstop (a.k.a. notch) removes frequency in a limited band. The freeform mode (rarely used) can design arbitrary filters by specifying frequencies in the spectrum and corresponding desired gain factors.

verbose name
Filter Mode
default value
bandpass
port type
EnumPort
value type
str (can be None)

minimum_phase

Design minimum-phase filter. If enabled, a filter with minimum signal delay will be designed, which will distort the signal phases, especially in the transition region. If disabled, a linear-phase filter will be designed, which will not distort the signal at all, but which incurs a delay of half the filter order in samples.

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

antisymmetric

Design antisymmetric filter. This designs rarely-used / special-purpose filters for signal differentiation or 90 degree phase shifting. Make sure you specify the order explicitly and choose and odd number if you use this.

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

stop_atten

Minimum attenuation in stopband. This is the minimum acceptable attenuation, in dB, in the stopband, which is ideally infinitely suppressed, but in practice 30-80 dB are enough, depending on the amplitudes of the signals to attenuate.

verbose name
Min Stopband Attenuation
default value
45.0
port type
FloatPort
value type
float (can be None)

convolution_method

FIRFilter coefficients can be convolved with the input signal using multiple methods. The standard method performs time-domain convolution. For long signals (>214 samples) using filters with a modest number of coefficients (>24), it can be faster to do the convolution in the frequency domain using the overlap-add method.

verbose name
Method Of Convolution
default value
standard
port type
EnumPort
value type
str (can be None)

cut_preringing

Cut off the pre-ringing portion generated by the filter. This is currently only supported in linear-phase mode and offline.

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

direction

Filtering direction. This describes how information is propagated during the filter process. Forward means that an event (e.g., a spike) will result in a ripple that follows the event. Forward-backward means that the ripple will propagate in both directions, and will be symmetric around the event, but this results in effects preceding their causes, which can be problematic when performing causality analysis and is not replicable in real time. Gap-aware filtering additionally respects data boundaries (e.g., where bad time windows have been cut out) and does not propagate information across them.

verbose name
Filtering Direction
default value
forward
port type
EnumPort
value type
str (can be None)

verbose

Print progress including list of channels removed.

verbose name
Verbose
default value
True
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)