Module: tensor_math

Tensor math operations.

These nodes implement mathematical operations that can be applied to any kind of data tensor (n-way array). These nodes make no domain-specific assumptions (unlike, e.g., signal processing nodes in the filters module), and therefore it is usually necessary to set the axis that they should act on properly. Also the unit of measurement, if applicable, will usually be by default the most generic unit (such as indices on an array), and for certain axes you may need to set it to a domain-specific value to be useful (e.g., Hz for the frequency axis).

AppendAxis

Append a new one-element axis to 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
  • new_axis
    New axis type to use. This is the type of axis that should replace the previous one.

    • verbose name: New Axis To Insert
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • init_data
    Optional index value for the new axis. For instance, when you create a frequency axis, you can give the frequency value to use here. Likewise, for the space axis, you can give the channel name, for a feature axis the feature name, for a time axis the time stamp, for a lag axis the lag offset value (in samples), and for an instance axis the payload value per instance (as instance time stamps some dummy values are generally used).

    • verbose name: Index Value For New Axis
    • default value: None
    • port type: StringPort
    • value type: str (can be None)

ConcatInputs

Concatenate the given input packets along a new or existing axis.

It is assumed that all data ports are either None or carry packets with the same number and type of chunks, and the chunks to be concatenated have the same number of elements along all axes except for the one along which they are concatenated. Note that the meta-data is copied from the packet on the first input port. For this reason, at least the first input port must be connected. One of the inputs MUST be wired into the data1 port.

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

    • verbose name: Data1
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data2
    Input data 2.

    • verbose name: Data2
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data3
    Input data 3.

    • verbose name: Data3
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data4
    Input data 4.

    • verbose name: Data4
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data5
    Input data 5.

    • verbose name: Data5
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data6
    Input data 6.

    • verbose name: Data6
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data7
    Input data 7.

    • verbose name: Data7
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data8
    Input data 8.

    • verbose name: Data8
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data9
    Input data 9.

    • verbose name: Data9
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • data10
    Input data 10.

    • verbose name: Data10
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • outdata
    Data to process.

    • verbose name: Outdata
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: OUT
  • 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)
  • 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)
  • correct_order
    Correct axis order. If this is enabled, then axes will be re-ordered to match the axis order in the first data port. This only works if axes do not occur more than once in each block.

    • verbose name: Correct Order
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • allow_markers
    Enable to allow concatenation of streams with markers.

    • verbose name: Allow Markers
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • required_inputs
    Required number of inputs. If data is not received in at least this many inputs, None will be output for this tick.

    • verbose name: Required Inputs
    • default value: 0
    • port type: IntPort
    • value type: int (can be None)

FiniteDifferences

Calculate the discrete n'th derivative of the given data along a chosen axis using finite differences.

This node will calculate the difference between each value and the next (if order=1). For higher orders it will apply the procedure multiple times, which yields the discrete derivative of order n. This node can be used to compute, for instance, the velocity and acceleration from a time series of positions.

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
  • axis
    Axis along which to compute the finite difference. The resulting axis will have Order elements less than the original (i.e., 3 less if Order was 3).

    • verbose name: Compute Differences Along Axis
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)
  • order
    Differencing order. If this is 3, the 3rd discrete derivative will be computed.

    • verbose name: Differencing Order
    • default value: 1
    • port type: IntPort
    • value type: int (can be None)
  • keep_shape
    If True then the output shape will be the same as the input shape. If data have not been seen then this is accomplished by prepending by zeros. For axes with timestamps only, if data have been seen then old data are held in a buffer. This option should only be used with axes with times (time, instance) so the buffer will be overwritten with real data. Otherwise the first order diffs will always be diff'd against zero and will never make sense.

    • verbose name: Keep Shape
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • scale_by_timestep
    If True then differences along an axis with times attribute will be scaled by the difference in times. This is important for calculating velocity and acceleration in units of x/sec and /sec^2, or when samples are irregular.

    • verbose name: Scale By Timestep
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

FiniteDifferencesCentral

Calculate the discrete n'th derivative of the given data along a chosen axis using central finite differences.

This node will calculate the difference between next and previous (if order=1). For higher orders it will apply the procedure multiple times, which yields the discrete derivative of order n. This node can be used to compute, for instance, the velocity and acceleration from a time series of positions. It has a smoothing effect compare to the regular finite difference.

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
  • axis
    Axis along which to compute the finite difference. The resulting axis will have Order elements less than the original (i.e., 3 less if Order was 3).

    • verbose name: Compute Differences Along Axis
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)
  • order
    Differencing order. If this is 3, the 3rd discrete derivative will be computed.

    • verbose name: Differencing Order
    • default value: 1
    • port type: IntPort
    • value type: int (can be None)
  • keep_shape
    If True then the output shape will be the same as the input shape. If data have not been seen then this is accomplished by prepending by zeros. For axes with timestamps only, if data have been seen then old data are held in a buffer. This option should only be used with axes with times (time, instance) so the buffer will be overwritten with real data. Otherwise the first order diffs will always be diff'd against zero and will never make sense.

    • verbose name: Keep Shape
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • scale_by_timestep
    If True then differences along an axis with times attribute will be scaled by the difference in times. This is important for calculating velocity and acceleration in units of x/sec and /sec^2, or when samples are irregular.

    • verbose name: Scale By Timestep
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)

FoldIntoAxis

Fold an axis into another axis.

For instance, if you have a data array with 3 axes, e.g., space, feature, and time, and you fold the feature axis into the space axis, you end up with data that has only space and time. The number of elements in the destination axis (space) will be the product of the previous number of elements in that axis and the number of elements in the source axis (feature). This node currently assumes that the destination axis is indexed with names (e.g., space axis and feature axis). After folding, that axis will have new names of the form A-B where A are the previous names of the destination axis, and B are the names (or stringified values) of the source axis (all combinations of A's and B's are generated, like in a Cartesian product). Tip: if you have two occurrences of the same axis type (e.g., space, and space), and you merge one into the other, then the first occurrence of the space axis will be the destination axis (and therefore its channel labels will appear before the separator character), and the second occurrence will be the source axis (and thus its labels will come after the separator char). If your data is not symmetric (e.g., weights on a directed graph), and one axis is the 'from' space axis and the other is the 'to' space axis, you need to make sure that they occur in the expected order in the incoming data packet (to first), which you can ensure using the MoveAxisFirst 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
  • src_axis
    Axis to fold. This is the type of the axis that shall be folded into another axis. This axis will drop out of the data.

    • verbose name: Source Axis
    • default value: lag
    • port type: EnumPort
    • value type: object (can be None)
  • instance_type
    Specify what instance type the src_axis is.

    • verbose name: Source Instant Type
    • default value: auto
    • port type: EnumPort
    • value type: object (can be None)
  • dst_axis
    Axis to fold into. This is the axis into which the other one shall be folded. This axis will remain in the data but will have correspondingly more entries to hold all the data.

    • verbose name: Destination Axis
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • round_digits
    Number of digits after the comma. This is only used when numbers are being stringified (e.g., when folding a time or frequency axis into a space or feature axis.

    • verbose name: Round Digits
    • default value: 3
    • port type: IntPort
    • value type: int (can be None)
  • separator
    Separator character between destination and source axis entry name. For example, setting this to : will create new channels of the form Fp1:C4, and so on.

    • verbose name: Separator
    • default value: -
    • port type: StringPort
    • value type: str (can be None)

LogSpacing

Keep elements along an axis with logarithmic spacing.

This node will select a subset of elements along the chosen axis, which can, e.g., be used to reduce the amount of data (i.e., dimensionality reduction). This node will pick elements not with equidistant spacing, but with a spacing that increases in an exponential fashion (so in other words the spacing would be equidistant after the logarithm has been taken). This is most useful when applied along the frequency axis.

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 elements shall be selected.

    • verbose name: Select Elements Along Axis
    • default value: frequency
    • port type: EnumPort
    • value type: object (can be None)
  • points
    Number of sampling points to keep. This many data points will be kept.

    • verbose name: Number Of Points To Keep
    • default value: 30
    • port type: IntPort
    • value type: int (can be None)

MoveAxisFirst

Move the given axis to the beginning of the list of axes.

Generally, data in NeuroPype is stored in multi-dimensional arrays (a.k.a. tensors), and these arrays have axes, such as space, time, frequency, instance, feature, and so on. These axes can generally be in any order, and nodes usually are robust to axis reorderings. However, some use cases may require some nodes to be reordered (see also ReorderAxes). The main use case for this node is when data has multiple axes of the same type, and a subsequent node shall be applied to a specific axis (e.g., one that is labelled with a particular custom label). Typically in such cases a node will simply act on the first axis of a given type (e.g., SelectRange), and by prepending this node prior to that operation, it is possible to pick a specific axis based on some criteria (currently involving the custom label), and make it the one that the next operation will act on.

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 type to select.

    • verbose name: Axis Type
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)
  • label
    Axis label. Optionally the label of the axis to move first.

    • verbose name: Axis Label
    • default value: None
    • port type: StringPort
    • value type: str (can be None)
  • memory_layout
    Optionally the new memory layout of the data. The default keep will keep the original layout, which never incurs any copying and this is fastest. The 'linear' option will reorder the data into the best-fitting linear (contiguous) order (which may be either C or FORTRAN). The C option reorders the memory such that the elements in the last given axis lie closest to each other ('vary fastest' when stepping through memory) and the elements in the first axis are the farthest apart. The FOTRAN option is the opposite of the C option. Such reordering can improve the speed of the subsequent processing node(s), traded off by the cost of copying the data in this node.

    • verbose name: Memory Layout
    • default value: keep
    • port type: EnumPort
    • value type: object (can be None)

Operate

Perform an operation (subtract, add, multiply, divide) on the data values between pairs of elements in an axis (instance, feature, space), and expand the data tensor along that axis to add the result.

Also creates a marker/name for each new data element (in instance.data[] if the instance axis, or feature.names or space.names if the feature or space axis), in the form of 'a$b', where a and b are the names of the elements (operands) and $ is the operator.

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
  • operator
    The operator to be performed on data of the two elements.

    • verbose name: Operator
    • default value: subtract
    • port type: EnumPort
    • value type: object (can be None)
  • operate_axis
    Axis containing the data sets to be differenced. Supports the instance, feature and space axes. If there is more than one axis of the same type, the first axis will be selected.

    • verbose name: Operate Axis
    • default value: instance
    • port type: EnumPort
    • value type: object (can be None)
  • operate_field
    When operating on the instance axis, the name of the .d ata field to be updated with the name of the result of the operation (i.e, 'target-control'), such as Marker, Group, Session, etc. If you specify the operands by name, this is the field that will be searched to find the instances to operate on. This field is ignored when operating on an axis other than the instance axis.

    • verbose name: Operate Field
    • default value: Marker
    • port type: StringPort
    • value type: str (can be None)
  • operands
    The element pairs for which data is to be operated on, and their order in the operation. Using subtract as an example: [0, 1] will subtract data of the second element from the first element (element0 - element1). If the axis has more than two elements, you can select which ones should be subtracted. Optionally, you can specify the names of markers (instance axis), feature names (feature axis), or channels (space axis) instead of element index numbers. I.e., ['left', 'right'] will perform a left-right subtraction. Several pairs of can be computed on by specifying a list of lists: [[5, 8],['left', 'right']]. Tip: write [0, -1] to operate on first and last elements.

    • verbose name: Operands
    • default value: [0, 1]
    • port type: ListPort
    • value type: list (can be None)
  • output_operated_only
    Only the newly computed data will be output, not the original data.

    • verbose name: Output Operated Only
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • verbose
    Print to console the axis element names/markers after operation.

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

OverrideAxis

Override a specific axis in the data by a new axis.

This allows you to effectively 'relabel' an axis, for instance from frequency to time, or from space (=channels) to features. The main use case is when you have processing nodes that expect a particular axis type to be present in the data, but your data has axes of a different type. The new axis will have the same number of elements than the old axis. Since most axes can store per-element information, for instance the channel labels, it is possible to give a list of initialization values for the new axis type.

Version 1.0.2

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
  • old_axis
    Axis to replace. This is the type of the axis in the current data that you want to replace by a new axis.

    • verbose name: Old Axis To Override
    • default value: feature
    • port type: EnumPort
    • value type: object (can be None)
  • new_axis
    New axis type to use. This is the type of axis that should replace the previous one.

    • verbose name: New Axis To Insert
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • init_data
    Optional index values for the new axis. For instance, when you create a frequency axis, you can list the frequency values to use here. Likewise, for the space axis, you can give the channel names, for a feature axis the feature names, for a time axis the time stamps, for a lag axis the lag offset values (in samples), and for an instance axis the payload values per instance (as instance time stamps some dummy values are generally used). If omitted, some dummy values will be made up for the field in question.

    • verbose name: Index Values For New Axis
    • default value: None
    • port type: ListPort
    • value type: list (can be None)
  • axis_occurrence
    Index of the occurrence of the axis of desired type. (0 is the first axis of the desired type, 1 is the second, -1 is the last, -2 is the second-to-last, and so on).

    • verbose name: Axis Occurrence
    • default value: 0
    • port type: IntPort
    • value type: int (can be None)
  • carry_over_names
    Carry over names in previous axis, if present.

    • verbose name: Carry Over Names
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • carry_over_numbers
    Carry over numbers of previous axis, if present. This can be used to force the numerical axis data of the old axis into the new axis (e.g., time vs. frequency).

    • verbose name: Carry Over Numbers
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • only_signals
    If set to true, only axes on signal chunks will be overridden.

    • verbose name: Only Signals
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • custom_label
    Custom label to be given to the new axis; if None, the custom_label from the old axis will be copied (if any).

    • verbose name: Custom Label
    • default value: None
    • port type: StringPort
    • value type: str (can be None)

RandomSubset

Select a random subset of instances in the given 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
  • subset_axis
    Axis along which to subset the data.

    • verbose name: Subset Axis
    • default value: instance
    • port type: EnumPort
    • value type: object (can be None)
  • count
    Number of items to retain.

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

ReorderAxes

Reorder the axes in the given data.

Generally, data in NeuroPype is stored in multi-dimensional arrays (a.k.a. tensors), and these arrays have axes, such as space, time, frequency, instance, feature, and so on. These axes can generally be in any order, and nodes usually are robust to axis reorderings. However, in some rare cases a node might expect axes in a particular order (e.g., custom code).

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
  • order
    New axis order. Can be formatted as in "0,1,2,3", or "space, time, frequency". For the latter, also the special symbols : (one axis of any type) and ... (zero or more axes of arbitrary types) are allowed, as in ":, time, ...". WARNING: This parameter is not safe to expose on the network.

    • verbose name: New Order
    • default value: ...
    • port type: StringPort
    • value type: str (can be None)
  • memory_layout
    Optionally the new memory layout of the data. The default keep will keep the original layout, which never incurs any copying and this is fastest. The 'linear' option will reorder the data into the best-fitting linear (contiguous) order (which may be either C or FORTRAN). The C option reorders the memory such that the elements in the last given axis lie closest to each other ('vary fastest' when stepping through memory) and the elements in the first axis are the farthest apart. The FOTRAN option is the opposite of the C option. Such reordering can improve the speed of the subsequent processing node(s), traded off by the cost of copying the data in this node.

    • verbose name: Memory Layout
    • default value: keep
    • port type: EnumPort
    • value type: object (can be None)

SelectRange

Select a subset of the given data along any axis, such as space (channels), time, frequency, instances (segments), or features.

This node will take any nonempty chunk that has the desired axis, and then extract the desired selection range. The range can be given in a variety of formats and units.

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 select. Use the space axis when you want to select channels, the instance axis to select trials or segments, the feature axis when the data happens to contain features (e.g., after feature extraction), or time and frequency axes. Note that in many cases you will want to use a different unit of measurement than the default indices. Select instance-fields to drop columns from the instance data recarray.

    • verbose name: Select Along Axis
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)
  • selection
    The range of data to select along the desired axis. The simplest form is a list of indices (with unit set to indices), which must be formatted as in [0,1,2,5,6] (indices count from 0). Another option is to use an inclusive range of the form 3...4 (inclusive means that both 3 and 4 are included in the range). And finally, you can also generally use Python's "slice" syntax, as in 0: 3 -- but this is more error prone as the range is half-open, that is, it does not include the last value of the slice (so the previous slice gives the same result as using the indices [0,1,2]). In slices, you can also use negative numbers, which count from the end, or you can omit the value before or after the :, which is then assumed to stand for the first element (if the value before the colon is omitted) or the last element (if the value after the colon is omitted). For instance, -3: retains the last 3 items along te axis. You can also give these values in units other than array indices, such as in seconds, Hz, channel names, and so on. See Unit for the most common examples.

    • verbose name: Selection Range
    • default value: :
    • port type: Port
    • value type: object (can be None)
  • unit
    Unit in which the selection is given. Depending on the axis, different units are applicable. For axes such as time, frequency, or space, you usually want to use not array indices but other units of measurement: for instance, for the time axis, you generally want to set the unit to 'seconds' -- then, a range like 10:50 is interpreted as "all the data starting at 10 seconds and up to (but not including) 50 seconds". For the frequency axis, the most useful unit would be 'Hz'. For channels, it is often desirable to be able to give channel names, e.g., ['C3','C4',CZ'], or 'A1':'A32' -- all you need to do for this is set the unit to 'names'.

    • verbose name: Unit Of Measurement For Selection
    • default value: indices
    • port type: EnumPort
    • value type: object (can be None)
  • apply_multiple_axes
    Apply the select range to all occurences of the axis in the data.

    • verbose name: Apply To All Occurrences Of Axis
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)

SqueezeAxes

Strip all axes with len == 1.

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

StripSingletonAxis

Strip the given singleton axis from the data.

This node processes data where the extent along a given is one element. The node will then remove the axis from the data. The node can be used where data has an necessary axis of some type after an operation, and it needs to be removed for a successive operation to work as expected. This is often helpful since many nodes in NeuroPype will not handle data that have more axes than expected.

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
    Type of axis to remove.

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

UpperTriangular

Extract the upper triangular part of a symmetric matrix.

This also works with data that is a multi-way array but which has two dimensions of same length, such that the slices along these two dimensions can be interpreted as matrices. This node allows to specify the axes that constitute the edges of the matrix, and will replace these two axes by a new axis of type feature that has only the upper-triangular elements, vectorized. A common use case is when one calculates a value between all pairs of channels, but only wants to retain half of the values due to symmetry. In this case, one would specify both axes as space.

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
  • axis1
    First axis of matrix. This is the first axis type that runs along the matrix from which we want select the upper triangular part.

    • verbose name: First Axis
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • axis2
    Second axis of matrix. This is the second axis type that runs along the matrix from which we want select the upper triangular part.

    • verbose name: Second Axis
    • default value: space
    • port type: EnumPort
    • value type: object (can be None)
  • use_lower
    Use lower triangular matrix instead. If selected, the lower triangular part is taken instead.

    • verbose name: Use Lower Triangular Instead
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • diagonal_offset
    Diagonal offset. Allows to shift the diagonal up (positive values) or down (negative values). 0 is the regular diagonal.

    • verbose name: Diagonal Offset
    • default value: 0
    • port type: IntPort
    • value type: int (can be None)

VectorLength

Compute length of the vector represented by the given axis.

This node interprets all values along the given axis as a vector, and returns its length. If the data has more axes, e.g., channels, then the vector length is taken separately for each channel/etc of these axes. The chosen axis will drop out of the data and be replaced by a one-element feature axis.

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 take the vector length. This axis will drop out of the data and be replaced by a one-element feature axis.

    • verbose name: Interpret Axis As Vector
    • default value: time
    • port type: EnumPort
    • value type: object (can be None)