code: def f_measure(reference_beats,
                estimated_beats,
                f_measure_threshold=0.07):
      
      validate(reference_beats, estimated_beats)
      # When estimated beats are empty, no beats are correct; metric is 0
      if estimated_beats.size == 0 or reference_beats.size == 0:
          return 0.
      # Compute the best-case matching between reference and estimated locations
      matching = util.match_events(reference_beats,
                                   estimated_beats,
                                   f_measure_threshold)
  
      precision = float(len(matching))/len(estimated_beats)
      recall = float(len(matching))/len(reference_beats)
      return util.f_measure(precision, recall)
docs: Compute the F-measure of correct vs incorrectly predicted beats.
      "Correctness" is determined over a small window.
  
      Examples
      --------
      >>> reference_beats = mir_eval.io.load_events('reference.txt')
      >>> reference_beats = mir_eval.beat.trim_beats(reference_beats)
      >>> estimated_beats = mir_eval.io.load_events('estimated.txt')
      >>> estimated_beats = mir_eval.beat.trim_beats(estimated_beats)
      >>> f_measure = mir_eval.beat.f_measure(reference_beats,
                                              estimated_beats)
  
      Parameters
      ----------
      reference_beats : np.ndarray
          reference beat times, in seconds
      estimated_beats : np.ndarray
          estimated beat times, in seconds
      f_measure_threshold : float
          Window size, in seconds
          (Default value = 0.07)
  
      Returns
      -------
      f_score : float
          The computed F-measure score