code: def f_measure(reference_onsets, estimated_onsets, window=.05):
      
      validate(reference_onsets, estimated_onsets)
      # If either list is empty, return 0s
      if reference_onsets.size == 0 or estimated_onsets.size == 0:
          return 0., 0., 0.
      # Compute the best-case matching between reference and estimated onset
      # locations
      matching = util.match_events(reference_onsets, estimated_onsets, window)
  
      precision = float(len(matching))/len(estimated_onsets)
      recall = float(len(matching))/len(reference_onsets)
      # Compute F-measure and return all statistics
      return util.f_measure(precision, recall), precision, recall
docs: Compute the F-measure of correct vs incorrectly predicted onsets.
      "Corectness" is determined over a small window.
  
      Examples
      --------
      >>> reference_onsets = mir_eval.io.load_events('reference.txt')
      >>> estimated_onsets = mir_eval.io.load_events('estimated.txt')
      >>> F, P, R = mir_eval.onset.f_measure(reference_onsets,
      ...                                    estimated_onsets)
  
      Parameters
      ----------
      reference_onsets : np.ndarray
          reference onset locations, in seconds
      estimated_onsets : np.ndarray
          estimated onset locations, in seconds
      window : float
          Window size, in seconds
          (Default value = .05)
  
      Returns
      -------
      f_measure : float
          2*precision*recall/(precision + recall)
      precision : float
          (# true positives)/(# true positives + # false positives)
      recall : float
          (# true positives)/(# true positives + # false negatives)