def match_note_offsets(ref_intervals, est_intervals, offset_ratio=0.2,
                       offset_min_tolerance=0.05, strict=False):
    if strict:
        cmp_func = np.less
    else:
        cmp_func = np.less_equal
    offset_distances = np.abs(np.subtract.outer(ref_intervals[:, 1],
                                                est_intervals[:, 1]))
    offset_distances = np.around(offset_distances, decimals=N_DECIMALS)
    ref_durations = util.intervals_to_durations(ref_intervals)
    offset_tolerances = np.maximum(offset_ratio * ref_durations,
                                   offset_min_tolerance)
    offset_hit_matrix = (
        cmp_func(offset_distances, offset_tolerances.reshape(-1, 1)))
    hits = np.where(offset_hit_matrix)
    G = {}
    for ref_i, est_i in zip(*hits):
        if est_i not in G:
            G[est_i] = []
        G[est_i].append(ref_i)
    matching = sorted(util._bipartite_match(G).items())
    return matching