Table Of Contents

Threshold 1D Array (G Dataflow)

Version:
    Last Modified: March 15, 2017

    Interpolates points in a 1D array that represents a 2D non-descending graph. This node compares a threshold to the values in an array, starting at a specified index, until it finds a pair of consecutive elements such that the threshold is greater than the value of the first element and less than or equal to the value of the second element.

    connector_pane_image
    datatype_icon

    array of numbers or points

    An array of numbers or an array of points where each point is a cluster of x- and y-coordinates.

    If this input is an array of numbers, this node assumes the x-coordinates are the same as the indexes of the array itself.

    If this input is an array of points, this node uses the second elements in the clusters, or the y-coordinates, to obtain a fractional index that it then uses to interpolate the corresponding x value.

    datatype_icon

    threshold y

    The threshold value for the node. If threshold y is less than or equal to the array value at start index, the node returns start index for fractional index or x. If threshold y is greater than every value in the array, the node returns the index of the last value. If the array is empty, the node returns NaN.

    datatype_icon

    start index

    The index to start interpolation.

    Default: 0—The node returns the result calculated from the entire array rather than a specified section of the array.

    datatype_icon

    fractional index or x

    The interpolated result calculated for the array of numbers or points 1D input array.

    If array of numbers or points is an array of points where each point is a cluster of x- and y-coordinates, fractional index or x is the interpolated x value corresponding to the interpolated position of threshold y among the y-coordinates, rather than the fractional index of the array. fractional index or x returns the interpolated x value associated with the given y value if you graphed the points.

    Method for Calculating Fractional Index

    This node calculates the fractional distance between the first value and threshold y and returns the fractional index at which threshold y would be placed within array of numbers or points using linear interpolation.

    Use Threshold 1D Array Only with Non-Descending Arrays

    This node only returns a reliable fractional index or x result for non-descending arrays. This node might return unexpected data for the following reasons:

    • This node does not recognize the index of a negative slope crossing.
    • This node does not return multiple fractional index or x results if the input array crosses threshold y at multiple points.
    • This node returns the start index value if threshold y is less than the value at start index.

    Use Threshold Detector for more advanced analysis of arrays.

    array of numbers or points start index threshold y fractional index or x comments
    [4, 5, 5, 6] 0 5 1 The output is 1, corresponding to the index of the first value of 5 the node finds.
    [2.3, 5.2, 7.8, 7.9, 10.0] 0 6.5 1.5 The output is 1.5 because 6.5 is halfway between 5.2 (index 1) and 7.8 (index 2).
    [0, 1, 2, 3, 4, 9.1, 10.3, 12.9, 15.5] 5 14.2 7.5 threshold y falls between elements 7 and 8 because 14.2 is midway between 12.9 and 15.5. Therefore, the output is 7.5, halfway between 7 and 8.
    Array of points

    [(1,1), (2,2), (3,3), (4,4), (-2.5,5), (0,6)

    0 5.5 -1.25 The output is not an index value of 4.5 as it would be for a numeric array, but rather an x value of -1.25, which is the interpolated x value associated with the given y value if you graphed the points.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics