Skip to content

← programming package

GetNested

Access 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. If the field is not found, return the value specified by the 'notfound' port or raise an error (notfound is respected regardless of whether the object has a fixed set of fields or an open-ended set). However, if the key is of the wrong data type (e.g. indexing an array with a string) or is syntactically malformed, an error will be raised even if notfound is not set to '(error)'. The available fields depend on the object being accessed, and can be looked up in the documentation. Typically, the error message will also indicate the available fields. If either the field or the data are none, the output will be None. Using this node requires some knowledge of the structure of the incoming data Packet. Objects use a : prefix (:block). For example, to extract a list of names from a feature axis for a stream (Chunk object) called "eeg", one would set the "path" property to: :chunks|eeg|:block|:axes|:feature|:names. This will return a list. To extract the last item along the Feature axis (a string), the syntax would be: :chunks|eeg|:block|:axes|:feature|:names|-1. To extract the list of event markers from a stream named markers, the syntax would be: :chunks|markers|:block|:axes|:instance|:data|Marker. You can view the structure of your packet using InspectPacket or Print nodes. The Packet class has some special methods you can use in the path, the most useful perhaps is :first(), which returns the first stream (chunk) in the packet. It also accepts additional criteria, i.e., :first(nonempty=True) will return the first nonempty stream. The full list of arguments that can be passed to first() is the same as the enumerate_chunks() Python function (see the documentation for the packet submodule in the developer documentation). Example: :first()|:block|:axes|:instance|:data|Marker. Version 1.2.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)

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 lax 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 in python mode.

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

notfound

Value to return if the field is not found. If set to raise, an error will be raised. Ignore will proceed regardless (a None value will be output). You can also enter a custom value here that will be returned if the field is not found. (Note: The value (error) will also raise an error for backward compatibility.)

verbose name
If Not Found
default value
raise
port type
ComboPort
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)