Skip to content

← formatting package

SelectInstances

Select trials (items along the "instance" axis, therefore "instances") based on metadata (i.e

., independant variables), contained in the instance axis data field. This can be used to select trials matching certain criteria, such as subject, session, group, task, conditions, TargetValue (for classification), etc. Criteria can be specified using the selection property, the condition property which accepts a string expression, or by wiring in a predicate operation to the pred port. See SetInstanceDetails to apply metadata extracted from the file path (using PathIterator) to each trial (which can then be used by this node). This node does not act on continuous data; use the Segmentation node before this one to segment continuous data into trials. Version 1.1.3

Ports/Properties

data

Data to process.

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

pred

Optional predicate function.

  • verbose name: Pred
  • default value: None
  • port type: GraphPort
  • value type: Graph

pred__signature

A listing of instance fields that the (optional) predicate will evaluate. You can define a predicate by creating a graph that starts with one or more Placeholder nodes whose slotnames must be set to the listed names here (e.g., "Marker"; note by convention instance fields are capitalized), followed by some computation that yields a true/false value indicating whether the instance in question shall be retained. In graphical UIs this edge will show as dotted to indicate that this is not normal forward data flow but a subgraph (i.e., the predicate function) is being passed to the SelectInstances node. The predicate is evaluated for each instance (element along instance axis) in the data, and the result of the function determines whether the instance will be kept. Note that, if selection and/or condition are also provided, the results are combined using the operator specified in combine_selections; the end result can also be further modified using invert_selection and combine_previous if desired.

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

selection

The instance selection criteria. Several formats are permitted: -> string: e.g. 'Go' - This will be compared against the 'Marker' field. -> dictionary without 'name' field: e.g. {'Marker': 'Go', 'Result': ['Success', 'Unknown']} - The dict keys indicate the name of the instance data fields, and the dict values are used to compare to the values. -> dictionary with 'name' field: e.g. {'name': 'Marker', 'value': 'Go'} 'name': Name of the column in the instance axis data table (IV table). 'operator': (optional) The comparison operator. If not provided then the value in 'default_comparison_operator' will be used. Also see default_comparison_operator for the list of possible operators. 'value': (optional) The value that each IV cell in the column will be compared against. If not provided then None is assumed. -> a list of the aforementioned dictionaries. To select all instances that do not a NaN value in a given instance field, use the following syntax: {'name': <field>}. So for example, to drop all instances that have NaN in the TargetValue field, use {'name': 'TargetValue'}.

  • verbose name: Selection
  • default value: None
  • port type: Port
  • value type: object (can be None)

condition

Condition expression in Python syntax which can be used in place of the selection property. This is a Python expression interpreted in the context of instance fields, e.g., startswith(Marker, 'stimulus') to select all instances where the marker starts with "stimulus", or not isnan('TargetValue') which would drop all instances where the TargetValue is an invalid value (NaN). A subset of python syntax is supported; please search for "Query Grammar" in the Neuropype documentation for details. For more complex selections, additional criteria can be used using selection and associated arguments, and will be combined using the operator specified in combine_selections. The final search result can be inverted (drop vs keep) with the invert_selection property. ,

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

default_comparison_operator

When selection argument does not provide an operator, this operator is used. 'auto' changes depending on provided 'value'. If 'value' is None or nan, then 'auto' will behave like 'not_equal'. Otherwise ('value' is valid), 'auto' will behave like 'equal'. If 'value' is a string (or list of strings), then some comparison operators will be remapped: greater or greater_equal -> startswith; less or less_equal -> endswith; equal -> fnmatch(test, pattern) not_equal -> not isin

  • verbose name: Default Comparison Operator
  • default value: auto
  • port type: EnumPort
  • value type: str (can be None)

combine_selections

Logical operator to use to combine evaluations specified in selection argument.

  • verbose name: Combine Selections
  • default value: and
  • port type: EnumPort
  • value type: str (can be None)

invert_selection

If set then the resulting of the selection comparison check will be inverted before logical combination with previous IsGood values.

  • verbose name: Invert Selection
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

combine_previous

Logical operator to use to combine overall selection result with previous IsGood values. Use 'override' to ignore previous values.

  • verbose name: Combine Previous
  • default value: override
  • port type: EnumPort
  • value type: str (can be None)

drop_immediately

Can drop !IsGood rows immediately. Otherwise merge this output with other packets then use DropBadTrials node.

  • verbose name: Drop Immediately
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

assign_target_value

For instances matching the selection criteria, set their TargetValue field to this value. Note that when this value is not None, only the TargetValue is updated and the IsGood field is not updated. A consequence is that calling SelectInstances again on the same packet using combine_previous will give unexpected behaviour.

  • verbose name: Assign Target Value
  • default value: None
  • port type: FloatPort
  • value type: float (can be None)

verbose

If set, print verbose information.

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