Skip to content

← elementwise_math package

Discretize

Discretize the input data (continuous) through a multi-level threshold function.

Input values that are below a threshold are mapped to a specifiable constant value (usually 0.0), and values that are above the threshold are mapped to another constant value (usually 1.0). This can be extended to an unlimited number of threshold levels. The new mapped values just need to contain 1 more value than the given number of threshold levels. If you do not specify new values, then 0-based integer values will be used. Version 1.1.0

Ports/Properties

data

Data to process.

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

threshold_cutoffs

List of threshold values in sequential order. Can be any length.

  • verbose name: Threshold Cutoff Values
  • default value: [0.5]
  • port type: ListPort
  • value type: list (can be None)

newvals

Optional list of of mapped-to values. Values that are smaller than a given threshold will be mapped to the first constant, and values that are larger than or equal to the next threshold will be mapped to the next constant. If given, this list needs to be exactly 1 value longer than the list of threshold cutoff values. If not given, then 0-based integer values will be used. Example: threshold cutoff values = [5, 10]; new values = [0, 1, 2]. All data below 5 will now be 0, data between 5 and 10 will now be 1, data greater than 10 will now be 2.

  • verbose name: New Values
  • default value: None
  • port type: ListPort
  • value type: list (can be None)

preserve_dtype

If True, the output data will have the same value type as the input data, i.e ., floats. Note that this may not what you want if you try to map to integer values.

  • verbose name: Preserve Dtype
  • default value: True
  • 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)