Skip to content

← tensor_math package

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.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

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: ComboPort
  • value type: str (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: ComboPort
  • value type: str (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)

instance_type

When folding an instance axis into another axis, specify the source data to use for generating labels.

  • verbose name: Instance-Axis Source Data
  • default value: auto
  • port type: EnumPort
  • 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)