Skip to content

← diagnostics package

GateCheck

Check that the data packet meets certain criteria before allowing it to pass through.

For example, that the required streams and markers are present, that the data is of a minimum (or maximum) length along a certain axis (time, space), that certain axes are present or absent, and that the data contains no NaNs. If the data passes the gate check, the packet is passed through unchanged, otherwise, None is passed (or optionally an exception is raised to terminate the pipeline). When the check fails with on_fail set to 'error' or 'raise', the failure message can be retrieved from a running NeuroPype server via the /errors API endpoint. Version 2.0.0

Ports/Properties

data

Data

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

signal_streams

Names of the signal streams to check. Wildcards are supported (only * and ? pattern matching, not regular expressions), e.g., eeg* to match all streams whose name begins with eeg. If empty, the first signal stream found will be checked. When more than one stream matches, all matching streams must satisfy the signal criteria.

  • verbose name: Signal Streams
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

marker_streams

Names of the marker streams to check for markers (used together with required_markers, and as a presence criterion). Wildcards are supported (* and ?); use * to require that a marker stream of any name is present. If specified, each pattern must match at least one stream in the packet, otherwise the check fails. If empty, the first marker stream found is used (for required_markers) and no presence check is performed.

  • verbose name: Marker Streams
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

axis

The axis along which to check that the minimum/maximum threshold of elements exist.

  • verbose name: Axis
  • default value: time
  • port type: ComboPort
  • value type: str (can be None)

required_streams

List of stream names which must be present in the data packet.

  • verbose name: Required Streams
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

require_data

If True, check that the signal stream is not empty (contains at least one data element).

  • verbose name: Require Data
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

min_length

Minimum number of elements which must appear in the selected axis (i.e ., samples if time, channels if space). If set to None or 0, this check is skipped.

  • verbose name: Min Length
  • default value: None
  • port type: IntPort
  • value type: int (can be None)

max_length

Maximum number of elements which may appear in the selected axis. Useful to catch very large data that could otherwise cause a memory error. If set to None or 0, this check is skipped.

  • verbose name: Max Length
  • default value: None
  • port type: IntPort
  • value type: int (can be None)

unit

Unit in which the minimum/maximum length is specified. For most axes, 'elements' is the right choice and would count the number of elements, or items, along that axis (i.e., the number of channels in the space axis, or frequencies in the frequency axis, samples in the time axis). For the time axis, 'seconds' is provided to allow you to specify the length in seconds rather than in samples.

  • verbose name: Length Unit
  • default value: seconds
  • port type: EnumPort
  • value type: str (can be None)

required_axes

List of axes which must be present in the checked signal stream(s). Leave empty to skip this check.

  • verbose name: Required Axes
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

excluded_axes

List of axes which must NOT be present in the checked signal stream(s). Leave empty to skip this check.

  • verbose name: Excluded Axes
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

no_nans

If True, check that the data packet contains no NaNs.

  • verbose name: No Nans
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

required_markers

List of markers which must each appear at least once in the selected marker stream/s. Wildcards are supported (* and ?, case-sensitive); use * to require that at least one marker (of any name) is present. Leave empty to skip this check.

  • verbose name: Required Markers
  • default value: []
  • port type: ListPort
  • value type: list (can be None)

on_fail

What to do when one or more checks fail. In all cases except 'raise', None is passed through in place of the data so that downstream nodes can skip it. 'ignore' passes None silently; 'warn' logs a warning; 'error' logs an error; 'raise' raises an exception and terminates the pipeline. When set to 'error' or 'raise', the failure message (listing the failed criteria) is also retrievable from a running NeuroPype server via the /executions/<id>/errors API endpoint, so a controlling application can find out why the pipeline failed.

  • verbose name: On Fail
  • default value: warn
  • port type: EnumPort
  • value type: str (can be None)

signal_stream

  • verbose name: Signal Stream
  • default value: None
  • port type: AliasPort
  • value type: list (can be None)

marker_stream

  • verbose name: Marker Stream
  • default value: None
  • port type: AliasPort
  • value type: list (can be None)

check_no_nans

  • verbose name: Check No Nans
  • default value: None
  • port type: AliasPort
  • value type: bool (can be None)

raise_on_fail

  • verbose name: Raise On Fail
  • default value: None
  • port type: AliasPort
  • value type: str (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)