Module: utilities

Utility nodes and miscellanea.

Includes a variety of nodes that do not fall into any of the other categories, such as nodes that fulfill certain special roles in data-flow pipelines, such as editing the meta-data, or maintaining real-time update rates.

AlignInstances

Line up streams with instance axes such that their instances and their order match.

This node will delete and sort instances in multiple streams (for example, collections of segments from different parts of a trial), so that the instance meta-data in one or more desired fields matches at every index for all streams. For example, if in one stream some instances are missing and in another stream some others are missing, this node will delete those instances to make sure there's a 1:1 correspondence between the two streams. Note that currently the node will always sort by the given fields, so if order matters, you may include some trial counter.

Version 0.7.0

Ports/Properties

  • 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)
  • data1
    Data to process 1.

    • verbose name: Data1
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data2
    Data to process 2.

    • verbose name: Data2
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data3
    Data to process 3.

    • verbose name: Data3
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data4
    Data to process 4.

    • verbose name: Data4
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data5
    Data to process 5.

    • verbose name: Data5
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data6
    Data to process 6.

    • verbose name: Data6
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data7
    Data to process 7.

    • verbose name: Data7
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data8
    Data to process 8.

    • verbose name: Data8
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data9
    Data to process 9.

    • verbose name: Data9
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • data10
    Data to process 10.

    • verbose name: Data10
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • matched_fields
    Instances that have the same combination of values for these fields are considered matched. In the result, instance k of each stream will have the same combination of values across all streams (note that the values in each field can be, and likely are, different).

    • verbose name: Matched Fields
    • default value: ['Marker']
    • port type: ListPort
    • value type: list (can be None)
  • handle_duplicates
    How to handle duplicate instances (with same value in the matched fields) in some stream. In 'take-first' mode, the first of the duplicated instances is taken from each stream, so that each unique combination occurs only once per stream. In the 'repeat-others' mode, if a stream has duplicate instances, and all other streams have each either at most one matched instance, or the same number of instances, then those instances are repeated where necessary.

    • verbose name: Handle Duplicates
    • default value: take-first
    • port type: EnumPort
    • value type: object (can be None)
  • skip_marker_streams
    Whether to skip processing marker streams.

    • verbose name: Skip Marker Streams
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • sort_by
    Sort instances by this key.

    • verbose name: Sort By
    • default value: matched-fields
    • port type: EnumPort
    • value type: object (can be None)

ApproximateChunkRate

Approximate a particular rate of chunks per second in the output.

This node can be used to reduce the effective update rate of a streaming pipeline, for example to 5 Hz. As a result, the node will only output new data 5 times a second. However, since the input to this node comes in at a certain update rate, if the two rates are not divisors of each other, the output will not be exactly 5 Hz (e.g., every 3 cycles, the data may be empty). To get a more regular chunk rate, the node Regulate Chunk Sizes can be used after this node.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • desired_rate
    Number of chunks per second. This node will output approximately this many chunks per second.

    • verbose name: Chunks Per Second
    • default value: 1
    • port type: FloatPort
    • value type: float (can be None)

AssignStandardChannelNames

Assigns channel names to incoming channels based on known montages of specific EEG devices, which can be selected from a list.

This acts on all streams in the data packet. If the selected device is 'none', data will pass through unchanged.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • device
    Select the device to use as the channel name template. The number of incoming channels must match the number shown in the device name. Set to none to skip this node.

    • verbose name: Device
    • default value: none
    • port type: EnumPort
    • value type: object (can be None)

ConcatSuccessivePackets

Concatenate successive packets along some axis.

This node will buffer and concatenate any successive packets, until a None packet arrives. At that point, the concatenated data will be released into the output.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • axis
    Axis along which to concatenate data.

    • verbose name: Concatenate Along Axis
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)
  • create_new
    Whether to create a new axis. If enabled, a new axis of the desired type will be inserted and data will be concatenated along that axis.

    • verbose name: Append New Axis
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • new_axis_label
    Label for the new axis along which to concatenate. Only applies if append new axis is set.

    • verbose name: New Axis Label
    • default value: concatenated
    • port type: StringPort
    • value type: str (can be None)
  • properties
    Values for the primary property of the new axis, if any. For instance, this would be a list of channel names if the axis is 'space'. If not given and a new axis is inserted, successive integers starting from 0 will be used as the values (so if this is e.g., a frequency axis, then the frequencies will be 0, 1, 2, and so on up to the number of packets that are concatenated.

    • verbose name: Values For New Axis
    • default value: None
    • port type: ListPort
    • value type: list (can be None)
  • padding_value
    Value to use for padding, optional. If tensors are concatenated that differ in shape, then the concatation may not be applicable, unless each tensor is padded as necessary for to make the dimensions compatible. If this is set to 'raise', then incompatibly-sized tensors will raise an error in this node. If set to 'invalid', the data will be filled with invalid data (not a number). If set to 'zero', the fill value will be zeroes.

    • verbose name: Padding Value
    • default value: raise
    • port type: EnumPort
    • value type: object (can be None)
  • nominal_gap
    If axis is 'time', number of seconds to use as a gap between concatenated packets. This allows for algorithms such as filtering to be aware of a discontinuity in the time series.

    • verbose name: Nominal Gap
    • default value: 0.5
    • port type: FloatPort
    • value type: float (can be None)
  • handle_markers
    If axis is 'time' and markers chunks are found with no 'time' axis but with 'instance' axis, then concatenate along the markers' chunks 'instance' axis.

    • verbose name: Handle Markers
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

CountAlongAxis

Returns the number of items contained in an axis.

Can be used, for example, to return the number of trials or time points in the data.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • axis
    Axis along which to count. Select the space axis for channels, instance axis for trials or segments, time for the number of time points, feature for the number of features in the stream, etc.

    • verbose name: Axis
    • default value: instance
    • port type: EnumPort
    • value type: object (can be None)
  • num_items
    Number of items in the given axis

    • verbose name: Num Items
    • default value: None
    • port type: DataPort
    • value type: int (can be None)
    • data direction: OUT

DejitterTimestamps

De-jitter the time-stamps of the given data.

This can be useful (or necessary) when working with streams whose time stamps are jittered (e.g., because they were not time-stamped by the hardware but stamps were read off the computer clock at receive time, in which case they are subject to jitter from the operating system and driver stack). This is particularly important when multiple streams need to be time-synchronized, such as event markers versus data, e.g., when you use the Segmentation filter. Note that this filter should be used before removal of bad time windows from the data instead of after, since otherwise you will get skewed time stamps.

More Info...

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • forget_halftime
    Exponential forget factor. This is the time, in seconds, until a past measurement will be weighted by 1/2. This value ideally roughly corresponds to the rate at which the sampling rate changes due to things like room temperature fluctuations, but excessively large values can cause numeric problems.

    • verbose name: Forget Factor (Halftime)
    • default value: 90
    • port type: FloatPort
    • value type: float (can be None)
  • force_monotonic
    Enforce monotonic timestamps. This is needed for certain subsequent filters that assume that time-stamps are monotonically increasing (you will see warnings in subsequent filters when data does not satisfy this requirement).

    • verbose name: Enforce Monotonic Timestamps
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • max_updaterate
    Max internal update rate in Hz. If the signal's sampling rate is higher than this, updates will only be performed on every k'th sample (k being an integer). If this is set very high and a very high rate signal is dejittered (e.g., audio), this node can consume a significant amount of CPU.

    • verbose name: Max Internal Update Rate
    • default value: 500
    • port type: IntPort
    • value type: int (can be None)
  • warmup_samples
    Number of warmup samples. The number of samples for which we warm up the timing statistics. The first few samples will be updated in a blockwise manner, because there will be significant uncertainty in the first few samples, followed by regular sample-wise updates once statistics have settled. If set to -1, this will equal the forget_halftime in samples.

    • verbose name: Number Of Warmup Samples
    • default value: -1
    • port type: IntPort
    • value type: int (can be None)

DiscardInvalidData

Remove slices of the incoming packets that contain invalid data.

This node can use various criteria to determine whether some data in a chunk is invalid (e.g., contains any infinite values or NaN values). However, since the data is a multi-dimensional array, one cannot just cut out a single number -- instead, a whole slice needs to be removed, and you can select whether you want to remove the affected channel(s), time range, instances, and so on, by selecting the desired axis along which to prune. It is important to note that this node will not remove a different set of e.g., channels on each successive chunk that it is getting (this would break subsequent processing). Instead, this node determines what to remove when it receives a non-streaming chunk ( e.g., an imported recording or some calibration data), and then carries that removal mask over unchanged to any subsequent streaming chunk. Note that these are some relatively basic criteria to identify completely invalid data. This node does not do the kind of sophisticated statistical analysis that dedicated bad-channel removal or bad-time window removal nodes perform.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: Port
    • value type: Packet (can be None)
  • axis
    Axis along which to remove data. For instance, if this is set to space, then channels with invalid data will be removed.

    • verbose name: Prune Along Axis
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • criteria
    Pruning criteria. This is a list of multiple possible criteria, formatted as in: ['has-inf', 'has-nan', 'all-nan', 'all-zero'].

    • verbose name: Criteria To Use
    • default value: ['has-inf', 'has-nan', 'all-nan', 'all-zero']
    • port type: ListPort
    • value type: list (can be None)

DiscardLongChunks

Drop chunks whose length exceeds a threshold.

This can be useful to drop excessively long chunks that may cause a hitch if they enter a slow processing function. Such chunks can occur, for instance, after a node spent a long time calibrating itself.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • threshold
    Threshold in seconds. Chunks that are longer than this will be dropped.

    • verbose name: Threshold
    • default value: 10
    • port type: FloatPort
    • value type: float (can be None)
  • entire_packet
    Discard whole packet instead of individual chunks.

    • verbose name: Entire Packet
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

DiscardNaNChunks

Drop chunks that contain NaNs from the data.

This is for streaming processing.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • entire_packet
    Discard whole packet instead of individual chunks.

    • verbose name: Entire Packet
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

ExtractChannels

Extract a list of the channel names from a data stream.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • channel_names
    Channel Names

    • verbose name: Channel Names
    • default value: None
    • port type: DataPort
    • value type: list (can be None)
    • data direction: OUT
  • stream
    Name of stream from which to extract the channel names. If blank will extract from the first stream.

    • verbose name: Stream
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • verbose
    Verbose output.

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

ExtractChunkProperty

Extract a given property from one of the chunks of the given input data packet.

In NeuroPype, data packets have one or more chunks, and each of those chunks has meta-data properties (for example, file path from which the data was originally imported, whether the data is streaming or not, and so on). This node can extract a desired property from the data packet.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Input packet.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • property
    Extracted property.

    • verbose name: Property
    • default value: None
    • port type: DataPort
    • value type: object (can be None)
    • data direction: OUT
  • chunk_name_prefix
    Chunk name prefix (optional).

    • verbose name: Chunk Name Prefix
    • default value: None
    • port type: StringPort
    • value type: str (can be None)
  • property_name
    Chunk property to extract.

    • verbose name: Property Name
    • default value: source_url
    • port type: StringPort
    • value type: str (can be None)

HoldLastPacket

Holds the most recently received packet.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

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

OverrideAxisLabel

Override the axis label of a given axis.

In NeuroPype, each axis has a type (for example, space, time, frequency). In addition to that, any axis can be given a "label". Axis labels are most useful to distinguish multiple axes of same type in some data packets, for example estimates of some non-symmmetric quantity between all pairs of channels (e.g., information flow). Such data may have two space axes, and without a label it would not be possible to tell which of them is which (e.g., "from" and "to" channels). While many systems assume a certain fixed order for axes, this is not the case in NeuroPype -- axes can fundamentally come in any order, and some nodes may reorder axes in some non-obvious ways. For this reason, axes are uniquely identifiable by their type, and if needed by their label. Note that this node will override the label of the first axis of the desired type in the data. Use ReorderAxes to make some other axis the first one if needed.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • new_label
    New label to set.

    • verbose name: New Label
    • default value: mylabel
    • port type: StringPort
    • value type: str (can be None)
  • axis_type
    Type of axis to modify.

    • verbose name: Axis Type
    • default value: instance
    • port type: EnumPort
    • value type: object (can be None)

OverrideProperties

Override the meta-data properties of the given data.

In NeuroPype, each data packet has one or more chunks (each corresponding to a "stream", such as EEG or event markers). Each such chunk has a dictionary of meta-data properties, holding information such as the origin of the data (file path that the data was originally loaded from), the delay incurred by the applied filters, and so on. This node allows to selectively override properties of a specific chunk, or (by default) all chunks.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • stream_name
    Name of stream for whom the properties shall be overridden.

    • verbose name: Stream To Override
    • default value: None
    • port type: StringPort
    • value type: str (can be None)
  • properties
    Dictionary of properties to assign.

    • verbose name: Properties
    • default value: {}
    • port type: Port
    • value type: object (can be None)

OverrideSamplingRate

Override the sampling rate in the given data's time axis.

This is useful when you know that the sampling rate is incorrect for some reason.

More Info...

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • sampling_rate
    New sampling rate to set. If None, no change is made.

    • verbose name: New Sampling Rate
    • default value: None
    • port type: FloatPort
    • value type: float (can be None)
  • change_triggers_state_reset
    Changing the rate triggers a reset on subsequent nodes.

    • verbose name: Change Triggers State Reset
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

OverrideTimestamps

Override the timestamps in the given data based on its nominal sampling rate, optionally pegged to the current "wall clock" reading.

If you peg the stamps to the clock, you will get jitters in the time stamps, because the times at which the clock is read out will not be exactly periodic -- however, you can easily dejitter the time stamps by inserting a Dejitter Timestamps node after this node. The main reason to use this node is when you have a data stream that has time stamps that are either garbage due to buggy data acquisition software, or which happen to be read off some other clock that is not synchronous with the current clock (e.g., playback of a previous recording, or data coming from another PC with no clock synchronization or drift compensation). In these cases you can achieve a moderate degree of synchronization using the wallclock (the timing will still be off by the amount of transmission latency, which can be on the order of 10s of miliseconds, but this is still better than nothing).

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • timebase
    Time base to use. The wallclock setting uses the current computer clock, specifically the same clock as used by the Lab Streaming Layer, which allows you to achieve approximate synchronization to other LSL streams within a few 10s of miliseconds. Note that you may need to dejitter the time stamps using the Dejitter Timestamps node. The abstract clock has no jitter, but is not synchronized to anything. Keep retains the current timestamps.

    • verbose name: Time Base
    • default value: wallclock
    • port type: EnumPort
    • value type: object (can be None)

ParseTriggerChannel

Extract event markers from a trigger channel.

The traditional way to mark events in sensor time series is using trigger channels that can take on a number of discrete numeric values (where 0 means "no event"). However, NeuroPype treats event markers as a separate data stream, where each event has a string to identify it and a timestamp of when it happened. This node lets you convert from a trigger channel to the NeuroPype format (markers will be the string versions of the numeric values in the channel). This node does not currently remove the trigger channel itself, so you need to remove it by hand if you are doing machine learning of any kind on the data.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • channel
    Index of the trigger channel, counting from 0. Negative values count from the end, e.g., -1 is the last channel. If this is None, the data is passed through unmodified.

    • verbose name: Trigger Channel Index
    • default value: None
    • port type: IntPort
    • value type: int (can be None)
  • debounce_ttl
    Only mark onset times. If a trigger value is held for multiple successive samples, a marker will only be emitted for the first sample. This is typically what you want, since the hold time on the trigger channel usually has to be multiple samples long to ensure that spike is not missed. Disabling this allows you to generate a marker for every non-zero sample.

    • verbose name: Only Mark Onset Times
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • print_markers
    Print extracted markers. This is for diagnostic and debugging purposes.

    • verbose name: Print Markers
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • previous_markers
    Handling mode for previous marker streams. In replace mode, any previous NeuroPype marker stream (e.g., from LSL) will be removed and replaced by the trigger-based marker stream. In ignore mode, a new marker stream will be added and the old one will be kept. Note that if you do this, some subsequent processing nodes that handle marker streams may be confused and will only pick up one of the streams.

    • verbose name: Previous Marker Stream Handling
    • default value: replace
    • port type: EnumPort
    • value type: object (can be None)

RegulateChunkSizes

Fix up chunk size irregularities in streaming data using a buffer.

This node maintains a running estimate of the average number of samples that it receives on each update (e.g., 135 samples), and adjusts the amount of data that it outputs on each update to be this quantity of samples. The node maintains a buffer of configurable length to be able to absorb "hitches" in the input pipeline. As a result, the node outputs a very regular stream of samples even if the input processing chain has very irregular latency characteristics. One use of this node is to drive smooth-scrolling plots and other visualizations that shall be smoothly updating.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • buffer_length
    Buffer length. This is the length of the buffer to absorb hitches, in seconds.

    • verbose name: Buffer Length (Seconds)
    • default value: 1
    • port type: FloatPort
    • value type: float (can be None)
  • reset_on_gap
    Reset the state if a gap is encountered that is longer than this. In seconds.

    • verbose name: Reset On Gap
    • default value: 5
    • port type: FloatPort
    • value type: float (can be None)
  • also_reset_buffer
    Also reset buffer on gap.

    • verbose name: Also Reset Buffer
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)

RenameChannels

Rename the channels in one or several data streams using a regular expression.

For example, to rename channels in the format 'EEG Xx-LE' to 'Xx', use (EEG )(.[^-LE])(.) as the search expression and (\2) as the replacement expression. (For a regular expression cheatsheet and to easily test regular expressions, see https://pythex.org.).

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • streams
    A list of stream names, for the streams containing channel names to rename (in case of multi-stream data). Leave empty to rename channel names in all streams.

    • verbose name: Streams To Act On
    • default value: []
    • port type: ListPort
    • value type: list (can be None)
  • search_expr
    A regular expression of the string to search for in the channel name. Example: (EEG )(.[^-LE])(.)

    • verbose name: Search Expression
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • replace_expr
    A regular expression of the string to replace in the channel name. Example: \2

    • verbose name: Replacement Expression
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • verbose
    Output a log entry with the results of the change.

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

RepeatAlongAxis

Repeat the data along the given axis.

This node basically repeats n copies of the data along the desired axis. One of the most common use cases is to extend an array to match the size of another array to then perform an elementwise operation between the two, such as addition.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • axis
    Axis along which to repeat. Select the space axis for channels, instance axis for trials or segments, time for the number of time points, feature for the number of features in the stream, etc.

    • verbose name: Axis
    • default value: instance
    • port type: EnumPort
    • value type: object (can be None)
  • create_axis
    Create the axis if it doesn't exist in the data.

    • verbose name: Create Axis
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • num_repeats
    Number of repetitions. The data will be repeated this many times along the given axis.

    • verbose name: Num Repeats
    • default value: 1
    • port type: IntPort
    • value type: int (can be None)

ShiftTimestamps

Shift the timestamps in the given signal by some delta.

This is mostly useful to compensate for shifts in the signal introduced by the data acqusition process, or shifts that were introduced by some preceding filters. In the latter case, the shift is known and can be accounted for by enabling the "compensate for filter lags" flag.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • offset
    Offset to add to time stamps. In seconds. This parameter is mostly useful if your data acquisition process introduces some known consistent shift.

    • verbose name: Time Offset
    • default value: 0
    • port type: FloatPort
    • value type: float (can be None)
  • y_A
    Used for piecewise shifting.

    • verbose name: Y A
    • default value: None
    • port type: DataPort
    • value type: ndarray (can be None)
    • data direction: IN
  • compensate_filter_lag
    Compensate for filter delay. If enabled, this node will in addition compensate for the accumulated logical (signal) delay of the preceding filters. Note that this is unrelated to how long these filters actually take to compute -- it only measures by how much they shift the data content relative to its time axis.

    • verbose name: Compensate For Filter Lags
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • include_markers
    Also shift time stamps of markers. If this is enabled, then this will not apply a relative shift between signal and markers, but apply to all streams in the data in the same way. This can be used to shift one packet vs. other packets.

    • verbose name: Shift Whole Packet
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • beginning_from_zero
    Shift the timestamps such that the first stamp in the signal is 0. Other streams (e.g., markers) will be shifted consistently with it.

    • verbose name: Beginning From Zero
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • offset_triggers_state_reset
    Changing the offset triggers a reset on subsequent nodes.

    • verbose name: Offset Triggers State Reset
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

StripMetadata

Strip all except for a desired subset of meta-data fields from the packet.

This can be used to deidentify data before recording to a file or database.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • retain_properties
    Meta-data properties to retain. All other chunk meta-data will be dropped. An empty list will drop all meta-data. If this is set to None, no meta-data is stripped.

    • verbose name: Retain Properties
    • default value: ['source_id', 'source_url', 'source_paths', 'stream_name', 'subject_id', 'session_id']
    • port type: ListPort
    • value type: list (can be None)