Skip to content

← nirs package

BadChannelRemovalNIRSCoV

Remove channels with abnormal data from a continuous NIRS signal.

This node is based on the classic coefficient of variation (CoV) metric, and works well on a wide range of headset types. For certain headsets, the alternative inter-channel correlation-based method, which is implemented in the BadChannelRemovalNIRSCorr node, can give better results, but you will have to try both to see which one works best for your data. Version 1.1.1

Ports/Properties

data

Data to process.

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

cov_threshold

Coefficient of variation threshold. Channels that have higher CoV than this for a sufficiently large fraction of the recording duration will be removed.

verbose name
Coeff Of Var Threshold
default value
30
port type
FloatPort
value type
float (can be None)

quality_metric

Quality metric to use. CoV is the coefficient of variation and CoV@ramp is the coefficient of variation normalized by channel length (the cutoff is the equiv to 1cm, e.g. 7.5). CoV@quad is the coeffient of variation normalized to a quadratic curve (good thresholds are 1-1.5).

verbose name
Quality Metric
default value
CoV@ramp
port type
EnumPort
value type
str (can be None)

window_len

Window length to compute CoV. Ideally this is short enough to isolate periods with transient per-channel artifacts.

verbose name
Sliding Window Length
default value
5
port type
FloatPort
value type
float (can be None)

min_intensity

Minimum average intensity below which a channel is marked as bad.

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

max_broken_time

Maximum duration or fraction of broken data to tolerate. Maximum time, either in seconds or as fraction of the calibration data, if below 1.0, during which a channel may be broken while still considered good (i.e., usable). This value should not be larger than half the duration of the calibration data.

verbose name
Max Allowed Broken Fraction
default value
0.4
port type
FloatPort
value type
float (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
Initialize On This Time Range
default value
[10, 70]
port type
ListPort
value type
list (can be None)

emit_calib

Whether and how to emit the calibration data, if the node is used in a streaming context. If set to dont-emit, then the calibration data will be swallowed by the node. If set to as-nonstreaming the calibration data will be emitted, but will be marked as non-streaming (offline) data, which can trigger special behavior on downstream nodes, e.g., causing them to calibrate themselves on this portion of the data only. If set to as-streaming, then the calibration data will appear like a regular, albeit long, streaming chunk. In this mode the node can be dropped into a stream pipeline with the least disruption, but some subsequent nodes could experience hiccups on the potentially minutes-long chunk.

verbose name
Emit Calib
default value
as-streaming
port type
EnumPort
value type
str (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)

verbose

Print verbose output.

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)