Skip to content

← tensor_math package

SelectRange

Select a subset (slice) of the data along any axis, such as space (channels), time (seconds), frequency (Hz), instance (segments or trials), feature (names), etc.

This node will take any nonempty chunk that has the specified axis, and then extract the desired selection range along that axis (retaining all the other axes, or dimensions of the data for that slice). The range can be given in a variety of formats and units (see the selection and unit property help). Note that the Instance axis (typically used for trials in a signal stream and event markers in a marker stream), has a special structure, so to select along that axis other than by index, use the SelectInstances node instead of this one. Version 1.6.0

Ports/Properties

data

Data to process.

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

axis

Axis along which to select data. Use the space axis when you want to select channels, the instance axis to select trials or segments, the feature axis when the data happens to contain features (e.g., after feature extraction), or time and frequency axes. If there are multiple axes of the same type in the data, you can specify the axis label (which can be set with SetAxisLabel node), using the following syntax: axis.label (i.e., space.mylabel). If the order of the axes is fixed, you can also specify the axis by its position, i.e., 0 for the first axis, 1 for the second axis, and -1 for the last axis (0-base indexing). However, it is recommended to use the axis label instead, as the order of the axes may be changed by other nodes in the pipeline. When applied to arrays or lists, any named axis will be treated as the first axis of the data.

  • verbose name: Select Along Axis
  • default value: time
  • port type: ComboPort
  • value type: str (can be None)

selection

The range of data to select along the desired axis. The simplest form is a list of indices (with unit set to indices) such as [0,1,2,5,6] (indices always count from 0), or a list of values (i.e., channel names) with unit set to default, e.g., ['C3','C4','Cz'], though you may also omit the brackets and quotes, as in C3,C4,Cz. If you want to select a range of indices or values (i.e., frequencies or timestamps), you can specify this in the form of an inclusive range, i.e., 10...20, where the last index or value will be included. In this example, if unit is default` orHz, and axis isfrequency, all data with frequencies between 10Hz up to and including 20Hz will be selected. Another allowed format is a "slice" (in python), in the form10:20, where the last value is not included. So withaxisasfrequencyandunitasdefault, this would select all frequencies from 10Hz up to but not including 20Hz. Note that, for continuous data (e.g., frequencies) these two modes may be equivalent since the final value may not occur in the data. The slice syntax can be more useful when selecting multiple adjacent intervals (e.g., frequency bands), and you do not want to double count the boundary values into multiple intervals. With the slice syntax, the value before or after the:can be omitted, which is then assumed to stand for the first or last element. So3:withindiceswill select all items starting with the 4th one (the first item has an index of 0), and:10will select the first 10 items, and:will select all items. And30:with axis astimeand unit asdefault(orseconds) will select all data starting at 30 seconds and up to the end, or:60with axis asfrequenciesand unit asdefault(orHz) will select all frequencies up (but not including) to 60Hz. Negative numbers are allowed. If the unit isindices, negative numbers count from the end of the list, so-1is the last item,-2the second to last, etc. For example,-10:-1will select the last 9 items (the last item is not included since a slice is not inclusive), whereas-10...-1will select the last 10 items, and is equivalent to-10:. If the unit is something other thanindices, (i.e.,default,seconds,Hz, etc.), negative numbers are interpreted as numeric values of that unit, so-5...10withaxisastimeandunitasdefault(orseconds), will select all samples with a timestamp between -5 and 10 seconds (including 10), and30:on data where the timestamps start at 0, will select all data except the first 30 seconds. (In most cases, if you don't want to select by index number, you should set the unit todefault. See theunit`` property for more information.) A selection range can also be an array of values or (when using the 'indices' unit) of indices or a boolean mask, but it must be a vector (1D array, meaning that at most one dimension can be greater than 1). When your data is a packet, you can also specify a selection range for each chunk in the packet by providing the selection as either a packet or a dictionary of selections, where the keys are the chunk names.

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

invert_selection

If True, the selection is inverted; that is, all items except those listed in selection_range are selected. Note that presently this feature only supports the case where selection_range is a list of indices or values, not a range (using : or ...).

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

unit

Unit in which the selection is given. These can be indices (starting with 0 as the first item), or, more typically, a different unit is used for each type of axis. For instance, for the time axis, you generally want to set the unit to seconds; in which case, the selection range 10:50 is interpreted as "all the data starting at 10 seconds and up to (but not including) 50 seconds". For the frequency axis, the most useful unit would be Hz. For the space axis, it is common to specify a list of channel names in selection range, e.g., ['C3','C4','Cz'] or 'A1':'A32', in which case the unit should be set to names. If set to default, the most commonly used unit for the axis other than indices will be automatically used (that is, names for space, seconds for time, Hz for frequency, names for feature, parameter_types for for statistic). So most of the time, you will either want to set this to indices or default. (The auto option is deprecated. Use default to auto-select the correct unit for the axis, or indices if you want to select by index number.)

  • verbose name: Unit Of Measurement For Selection
  • default value: indices
  • port type: ComboPort
  • value type: str (can be None)

drop_if_nonrange

Whether to drop the selection axis of the selection is not a range (list, array, slice, etc) but a single index or value. Legacy retains previous behavior, which kept the axis if the data was a block, chunk or packet, and otherwise dropped it. This default will be changed in an upcoming release.

  • verbose name: Drop Axis If Selection Is A Scalar
  • default value: legacy
  • port type: EnumPort
  • value type: str (can be None)

apply_time_selection_to_markers

Apply the time axis selection to the instance axis of any accompanying marker streams.

  • verbose name: Apply Time Selection To Markers
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

apply_multiple_axes

Apply the select range to all occurrences of the axis in the data. Deprecated: Simply type the axis property as *myaxis (i.e., *space) to have it apply to all occurrences of myaxis.

  • verbose name: Apply To All Occurrences Of Axis
  • 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)