def load_tempo(filename, delimiter=r'\s+'):
    r"""Load tempo estimates from an annotation file in MIREX format.
    The file should consist of three numeric columns: the first two
    correspond to tempo estimates (in beats-per-minute), and the third
    denotes the relative confidence of the first value compared to the
    second (in the range [0, 1]). The file should contain only one row.

    Parameters
    ----------
    filename : str
        Path to the annotation file
    delimiter : str
        Separator regular expression.
        By default, lines will be split by any amount of whitespace.

    Returns
    -------
    tempi : np.ndarray, non-negative
        The two tempo estimates

    weight : float [0, 1]
        The relative importance of ``tempi[0]`` compared to ``tempi[1]``
    """
    # Use our universal function to load the key and mode strings
    t1, t2, weight = load_delimited(filename, [float, float, float], delimiter)

    weight = weight[0]
    tempi = np.concatenate([t1, t2])

    if len(t1) != 1:
        raise ValueError('Tempo file should contain only one line.')

    # Validate them, but throw a warning in place of an error
    try:
        tempo.validate_tempi(tempi)
    except ValueError as error:
        warnings.warn(error.args[0])

    if not 0 <= weight <= 1:
        raise ValueError('Invalid weight: {}'.format(weight))

    return tempi, weight
def load_tempo ( filename , delimiter = r'\s+' ) : t1 , t2 , weight = load_delimited ( filename , [ float , float , float ] , delimiter ) weight = weight [ 0 ] tempi = np . concatenate ( [ t1 , t2 ] ) if len ( t1 ) != 1 : raise ValueError ( 'Tempo file should contain only one line.' ) try : tempo . validate_tempi ( tempi ) except ValueError as error : warnings . warn ( error . args [ 0 ] ) if not 0 <= weight <= 1 : raise ValueError ( 'Invalid weight: {}' . format ( weight ) ) return tempi , weight
r"""Load tempo estimates from an annotation file in MIREX format.
    The file should consist of three numeric columns: the first two
    correspond to tempo estimates (in beats-per-minute), and the third
    denotes the relative confidence of the first value compared to the
    second (in the range [0, 1]). The file should contain only one row.

    Parameters
    ----------
    filename : str
        Path to the annotation file
    delimiter : str
        Separator regular expression.
        By default, lines will be split by any amount of whitespace.

    Returns
    -------
    tempi : np.ndarray, non-negative
        The two tempo estimates

    weight : float [0, 1]
        The relative importance of ``tempi[0]`` compared to ``tempi[1]``