def minima_phases(max_min_dictionary):
    """
    Find the phases of minima.

    Minima are found by finding the minimum value between sets of two peaks.
    The phase of the minimum relative to the two peaks is then returned.
    i.e the fraction of time elapsed between the two peaks when the minimum
    occurs is returned.

    It is very important to make sure the correct delta is specified for
    peak discrimination, otherwise unexpected results may be returned.

    :param max_min_dictionary: max_min_dictionary

    :return: phase of minimum relative to peaks.

    """
    minima_num = max_min_dictionary['minima_number']
    maxima_num = max_min_dictionary['maxima_number']
    maxima_times = max_min_dictionary['maxima_times']
    minima_times = max_min_dictionary['minima_times']
    minima_phases = []
    for i in range(min(minima_num, maxima_num - 1)):
        maximum_0_t = maxima_times[i]
        maximum_1_t = maxima_times[i + 1]
        minimum_time = minima_times[i]
        phase = (minimum_time - maximum_0_t) / (maximum_1_t - maximum_0_t)
        minima_phases.append(phase)
    phase_list = [minima_times, minima_phases]
    return phase_list
