(vals, rng)
return vals
Extract values within selected range

    Parameters
    ----------
    vals : array

    rng : Two-element sequence containing floats in range of [0,100], optional
        Percentiles over which to compute the range. Each must be
        between 0 and 100, inclusive. The order of the elements is not important.
    Returns
    -------
    array
        limited array
Extract values within selected range
Extract values within selected range
def limit_range(vals, rng):
    """
    Extract values within selected range

    Parameters
    ----------
    vals : array

    rng : Two-element sequence containing floats in range of [0,100], optional
        Percentiles over which to compute the range. Each must be
        between 0 and 100, inclusive. The order of the elements is not important.
    Returns
    -------
    array
        limited array
    """
    vals = np.asarray(vals)
    if len(vals) > 2:
        rng = sorted(rng)
        if np.isnan(vals).any():
            lower = np.nanpercentile(vals, rng[0], interpolation="nearest")
            higher = np.nanpercentile(vals, rng[1], interpolation="nearest")
        else:
            lower = np.percentile(vals, rng[0], interpolation="nearest")
            higher = np.percentile(vals, rng[1], interpolation="nearest")
        return vals[(lower <= vals) & (vals <= higher)]
    return vals
def limit_range ( vals , rng ) : vals = np . asarray ( vals ) if len ( vals ) > 2 : rng = sorted ( rng ) if np . isnan ( vals ) . any ( ) : lower = np . nanpercentile ( vals , rng [ 0 ] , interpolation = "nearest" ) higher = np . nanpercentile ( vals , rng [ 1 ] , interpolation = "nearest" ) else : lower = np . percentile ( vals , rng [ 0 ] , interpolation = "nearest" ) higher = np . percentile ( vals , rng [ 1 ] , interpolation = "nearest" ) return vals [ ( lower <= vals ) & ( vals <= higher ) ] return vals