def time_to_phase(time, period):
    """
    Convert time to phase.

    Parameters
    ----------
    time : ndarray
        An array which represents a time vector.
    period : float
        A value of period which phases the light curve with.

    Returns
    -------
    phase
        A phase vector.
    """
    time_min = time.min()
    time = time - time_min
    phase = time / period - time // period
    return phase
