code: def compute_accuracy(true_positives, n_ref, n_est):
      
      true_positive_sum = float(true_positives.sum())
  
      n_est_sum = n_est.sum()
      if n_est_sum > 0:
          precision = true_positive_sum/n_est.sum()
      else:
          warnings.warn("Estimate frequencies are all empty.")
          precision = 0.0
  
      n_ref_sum = n_ref.sum()
      if n_ref_sum > 0:
          recall = true_positive_sum/n_ref.sum()
      else:
          warnings.warn("Reference frequencies are all empty.")
          recall = 0.0
  
      acc_denom = (n_est + n_ref - true_positives).sum()
      if acc_denom > 0:
          acc = true_positive_sum/acc_denom
      else:
          acc = 0.0
  
      return precision, recall, acc
docs: Compute accuracy metrics.
  
      Parameters
      ----------
      true_positives : np.ndarray
          Array containing the number of true positives at each time point.
      n_ref : np.ndarray
          Array containing the number of reference frequencies at each time
          point.
      n_est : np.ndarray
          Array containing the number of estimate frequencies at each time point.
  
      Returns
      -------
      precision : float
          ``sum(true_positives)/sum(n_est)``
      recall : float
          ``sum(true_positives)/sum(n_ref)``
      acc : float
          ``sum(true_positives)/sum(n_est + n_ref - true_positives)``