Skip to content

← programming package

SetNested

Set a nested field or item of a specified object, which is identified by a path, analogous to a file path (or a chain of ".f

ield[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 the original object unchanged, and instead returns a potentially changed object. If the field is not found, this node can either raise an error, or ignore the error and return the original object. Typically, the error message will also indicate the available fields on the object. If the data 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

data

Data to process.

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

path

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

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

value

Value to set. Note if you are setting this to a string, put the string in quotes to prevent it from being interpreted as a value of some other type (e.g., number).

  • verbose name: Value
  • default value: None
  • port type: Port
  • value type: object (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)

notfound

Action to take if the specified field is not found. If 'error', raise an error. If 'ignore', return the original data object.

  • verbose name: If Not Found
  • default value: error
  • 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)