def partition(seq, n_bins):
    """
    This function takes an input sequence and bins it into discrete points.

    Parameters
    ----------
    seq : list/tuple of float
        Collection of floats.
    n_bins : int
        Number of bins/paritions to create.

    Returns
    -------
    list
        Collection of integers. Contains unique integers from 1 to n_bins.

    """
    assert (
        isinstance(n_bins, int) and n_bins > 1
    ), "ERROR: Number of bins should be a positive integer"

    # Get smallest value
    a = min(seq)

    # Compute reciprocal of peak-to-peak per bin
    delta_inv = n_bins / (max(seq) - a + 1e-6)

    # Transform each element and return
    return [1 + int((elem - a) * delta_inv) for elem in seq]