Skip to content

DECIMATE_VECTOR

Download Flojoy Studio to try this app
The DECIMATE_VECTOR node returns the input vector by reducing the number of points by given factor Inputs ------ default : Vector The input vector Params: factor : int Decimate factor which determines how many elements will be skipped between each selected element in the output vector Returns: out : Vector Decimated vector
Python Code
from flojoy import flojoy, Vector


@flojoy
def DECIMATE_VECTOR(
    default: Vector,
    factor: int = 1,
) -> Vector:
    """The DECIMATE_VECTOR node returns the input vector by reducing the
    number of points by given factor

    Inputs
    ------
    default : Vector
        The input vector

    Parameters
    ----------
    factor : int
        Decimate factor which determines how many elements will be skipped
        between each selected element in the output vector

    Returns
    -------
    Vector
        Decimated vector
    """

    return Vector(v=default.v[::factor])

Find this Flojoy Block on GitHub

Example App

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example, we generate a vector type data using LINSPACE node.

Using DECIMATE_VECTOR node, we generate a new decimated vector and plot it in SCATTER node.