Skip to content

← programming package

TakeNested

Take a nested field and/or item from specified object and apply it to another object.

The nested field is identified by a path, analogous to a file path (or a chain of ".field[10]['key'].something.else" syntax in some programming languages). The path is specified using a syntax that can be selected using the 'syntax' parameter. This generally leaves both input objects unchanged, and instead returns a potentially updated target. If the field is not found, this node can either raise an error, or an alternative default value can be taken. Typically, the error message will also indicate the available fields on the object. If the target or path are is None, the output will be None. Using this node requires some knowledge of the structure of the incoming data packet. For example, to extract a list of names from a feature axis for a stream (chunk) called "eeg" (as a list), one would set the "path" property to: :chunks|eeg|:block|:axes|:feature|:names. To extract the last item along the Feature axis (as a string), the syntax would be: :chunks|eeg|:block|:axes|:feature|:names|-1. To extract the list of markers from a stream named markers (as a list), the syntax would be: :chunks|markers|:block|:axes|:instance|:data|Marker. You can view the structure of your packet using InspectPacket or Print nodes. Version 1.0.0

Ports/Properties

source

Source object.

  • verbose name: Source
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: IN

target

Target object.

  • verbose name: Target
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: IN

result

Updated target.

  • verbose name: Result
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: OUT

path

Path to field/item. See syntax option for details.

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

syntax

Syntax of the path. The pipe syntax looks as in " :field | 10 | 'quoted string key' | unquoted string key | 15 | :other_field | 5" where item may be a single-, double-, or unquoted string, a number, or one of the special symbols True/False/None. In practice, quoted strings are only rarely needed, namely to write strings that would otherwise parse as a different type (number, True/False/None, :field) or lose any intended leading/trailing whitespace. However, for procedurally generated (string-concatenated) paths, strings should always be quoted. The lazy syntax is a more permissive version of the pipe syntax, where the : is optional; this can be ambiguous in the rare case that an object both has a field named :field and an item named field. The python syntax is the index syntax known from Python, which looks as in .field[10]['quoted string key']['unquoted string key'][15]. However, note that, at present, method calls like .first() are not permitted.

  • verbose name: Syntax
  • default value: pipe
  • port type: EnumPort
  • value type: str (can be None)

debug

Enable debugging of nested assignments. This allows an attached Python debugger (e.g., PyCharm) to stop in the utility routine where the error actually happens, as opposed to a location inside this node.

  • verbose name: Debug
  • 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)