Skip to content

← neural package

RemoveBadTimeWindows

This function cuts segments from the data which contain high/low-amplitude artifacts.

Specifically, any windows with more than a certain fraction of "bad" channels are removed, where a channel is bad in a given window if its amplitude in the window is above or below a given upper/lower threshold (in standard deviations from a robust estimate of the EEG amplitude distribution for the channel). This node only operates on non-streaming 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

diagnostic

Diagnostic information indicating the time windows with clean data.

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

kept_samples

dict with chunk names for keys and time-axis selector as values. This output is useful to slice another parallel chunk to keep it the same size, even though its channels should not be used to determine bad time windows.

  • verbose name: Kept Samples
  • default value: None
  • port type: DataPort
  • value type: dict (can be None)
  • data direction: INOUT

zscore_thresholds

Minimum and maximum of clean signal range, in multiples of standard deviation. The minimum and maximum standard deviations within which the power of a channel must lie (relative to a robust estimate of the clean EEG power distribution in the channel) for it to be considered not bad.

  • verbose name: Clean Signal Range
  • default value: [-4, 6]
  • port type: ListPort
  • value type: list (can be None)

max_bad_channels

Maximum fraction of bad channels allowed . The maximum fraction of bad channels that a retained window may still contain (more than this and it is removed). Reasonable range is 0.05 (very clean output) to 0.3 (very lax cleaning of only coarse artifacts).

  • verbose name: Maximum Fraction Of Bad Channels
  • default value: 0.2
  • port type: FloatPort
  • value type: float (can be None)

window_len

Length of sliding window. This is the window length used to check the data for artifact content, in seconds. This is ideally as long as the expected time scale of the artifacts but short enough to allow for several 1000 windows to compute statistics over.

  • verbose name: Window Length
  • default value: 0.5
  • port type: FloatPort
  • value type: float (can be None)

window_overlap

Window overlap fraction. The fraction of two successive windows that overlaps. Higher overlap ensures that fewer artifact portions are going to be missed, in expense of being slower.

  • verbose name: Window Overlap Fraction
  • default value: 0.66
  • port type: FloatPort
  • value type: float (can be None)

max_dropout_fraction

Maximum fraction of windows with signal dropouts. This is the maximum fraction of time windows that may have arbitrarily low amplitude (e.g., due to the sensors being unplugged). This parameter is used in generalized Gaussian distribution fitting.

  • verbose name: Maximum Fraction Of Dropout Windows
  • default value: 0.1
  • port type: FloatPort
  • value type: float (can be None)

min_clean_fraction

Minimum fraction of clean windows. This is the minimum fraction of time windows that need to contain uncontaminated EEG.This parameter is used in generalized Gaussian distribution fitting.

  • verbose name: Minimum Fraction Of Clean Windows
  • default value: 0.25
  • port type: FloatPort
  • value type: float (can be None)

truncate_quantile

Truncated Gaussian quantile. Upper and lower quantile range of the truncated Gaussian distribution that shall be fit to the EEG contents. This parameter is used in generalized Gaussian distribution fitting.

  • verbose name: Truncated Gaussian Quantile
  • default value: [0.022, 0.6]
  • port type: ListPort
  • value type: list (can be None)

step_sizes

Grid search stepping. Step size of the grid search. the first value is the stepping of the lower bound (which essentially steps over any dropout samples), and the second value is the stepping over possible scales (i.e., clean-data quantiles). This parameter is used in generalized Gaussian distribution fitting.

  • verbose name: Grid Search Step Size
  • default value: [0.01, 0.01]
  • port type: ListPort
  • value type: list (can be None)

shape_range

Shape parameter range. Search Range for the clean EEG distribution's shape parameter beta. This parameter is used in generalized Gaussian distribution fitting.

  • verbose name: Range For Shape Parameter
  • default value: [np.float64(1.7), np.float64(1.8499999999999999), np.float64(1.9999999999999998), np.float64(2.1499999999999995), np.float64(2.3), np.float64(2.4499999999999993), np.float64(2.5999999999999996), np.float64(2.749999999999999), np.float64(2.8999999999999995), np.float64(3.049999999999999), np.float64(3.1999999999999993), np.float64(3.3499999999999988), np.float64(3.499999999999999)]
  • port type: ListPort
  • value type: list (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)