Skip to content

← tensor_math package

OperateAxis

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.

(Optionally, can output only the newly computed data and drop the original data.) Also creates a marker or 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 (i.e., 'left+right'). Version 1.0.0

Ports/Properties

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 representing the operation to be performed on data of the two elements.

  • verbose name: Operator
  • default value: subtract
  • port type: EnumPort
  • value type: str (can be None)

operate_axis

Axis containing the data set to be operated on. 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: str (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 (with operator set to 'subtract'). 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)

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)