def cdf_distribution(a_cdf, a_partitions):
    """
    ARGS
       a_cdf               vector         a vectors of values/observations
       a_partitions        int            the number of partitions

    DESC
        This function returns the indices of a passed cdf such that the
        the range of values across the indices is uniform across the
        number of partitions.

        Imagine you have a range of observations/values, and you'd
        like to partition the observations over 3 ranges. If you simply
        partition the range of values into three evenly spaced groups
        across the domain, you will most likely find all the dynamic range
        of values in each partition is non-uniform.

        By partitioning the cdf, however, the range of values in each
        partition is uniform. The "size" of each partition, however,
        is not.
    """
    f_range = a_cdf[-1] - a_cdf[0]
    f_rangePart = f_range / a_partitions
    lowerBound = a_cdf[0]
    vl = []
    for part in arange(0, a_partitions):
        # Due to possible cumulative rounding errors, relax the tolerance
        # on the final partition:
        if part == a_partitions - 1:
            subset = (a_cdf > lowerBound)
        else:
            subset = (a_cdf > lowerBound) & (a_cdf <= lowerBound + f_rangePart)
        indices = where(subset, 1, 0)
        v = where(indices == 1)
        vl.append(v)
        lowerBound += f_rangePart
    return vl
ARGS
       a_cdf               vector         a vectors of values/observations
       a_partitions        int            the number of partitions

    DESC
        This function returns the indices of a passed cdf such that the
        the range of values across the indices is uniform across the
        number of partitions.

        Imagine you have a range of observations/values, and you'd
        like to partition the observations over 3 ranges. If you simply
        partition the range of values into three evenly spaced groups
        across the domain, you will most likely find all the dynamic range
        of values in each partition is non-uniform.

        By partitioning the cdf, however, the range of values in each
        partition is uniform. The "size" of each partition, however,
        is not.