Skip to content

← programming package

ConstantArray

Create an array that can be wired into another node.

This node is analogous to Constant list, but returns an array instead. The node can take a single string or numeric value (float, int) and convert it into an array located on the desired numeric backend. Or, if parse_string is True, it will attempt to convert a string with comma separated values (i.e., "one, two"), into a list and will return an error if unsuccessful (i.e., the string is a malformed list). Note that in the rare case that you wish to enter a non-numeric (i.e., string-valued) single-element array, you cannot use the freestyle (unquoted) syntax and must instead enter it in in strict Python syntax, such as either ['mystring'] or 'mystring', where the former is a 1-dimensional, 1-element array and the latter is a 0-dimensional 1-element array, also known as a 'scalar' array. Version 1.1.0

Ports/Properties

data

Value to emit.

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

value

Constant value. Typically in the same format as in the Constant List node.

  • verbose name: Value
  • default value: []
  • port type: Port
  • value type: object (can be None)

parse_string

Attempt to parse free-form string values into a multi-element array. This will accept entries such as 0 1 as a 2-element array.

  • verbose name: Parse Free-Style String
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

backend

Optional compute backend to use. Keep is the current default, which resolves to that of the template array if one is provided and otherwise numpy unless overridden. Numpy is the standard CPU backend that underpins most of NeuroPype's operations. The others require one or more GPUs to be present on the system, except for torch-cpu. For best performance, keep all arrays that interact with each other (via processing nodes) on the same backend.

  • verbose name: Backend
  • default value: keep
  • port type: EnumPort
  • value type: str (can be None)

precision

Numeric precision to use. Keep resolves to the precision of the template array if one is provided, and otherwise to the current default (usually 64-bit). Can be reduced to save memory (e.g. if running on GPU).

  • verbose name: Precision
  • default value: keep
  • 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)