code: def match_note_onsets(ref_intervals, est_intervals, onset_tolerance=0.05,
                        strict=False):
      if strict:
          cmp_func = np.less
      else:
          cmp_func = np.less_equal
      onset_distances = np.abs(np.subtract.outer(ref_intervals[:, 0],
                                                 est_intervals[:, 0]))
      onset_distances = np.around(onset_distances, decimals=N_DECIMALS)
      onset_hit_matrix = cmp_func(onset_distances, onset_tolerance)
      hits = np.where(onset_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