code: def _calc_stats(self):
          
          # Reference annotation indices that were detected
          self.matched_ref_inds = np.where(self.matching_sample_nums != -1)[0]
          # Reference annotation indices that were missed
          self.unmatched_ref_inds = np.where(self.matching_sample_nums == -1)[0]
          # Test annotation indices that were matched to a reference annotation
          self.matched_test_inds = self.matching_sample_nums[
              self.matching_sample_nums != -1]
          # Test annotation indices that were unmatched to a reference annotation
          self.unmatched_test_inds = np.setdiff1d(np.array(range(self.n_test)),
              self.matched_test_inds, assume_unique=True)
  
          # Sample numbers that were matched and unmatched
          self.matched_ref_sample = self.ref_sample[self.matched_ref_inds]
          self.unmatched_ref_sample = self.ref_sample[self.unmatched_ref_inds]
          self.matched_test_sample = self.test_sample[self.matched_test_inds]
          self.unmatched_test_sample = self.test_sample[self.unmatched_test_inds]
  
          # True positives = matched reference samples
          self.tp = len(self.matched_ref_inds)
          # False positives = extra test samples not matched
          self.fp = self.n_test - self.tp
          # False negatives = undetected reference samples
          self.fn = self.n_ref - self.tp
          # No tn attribute
  
          self.specificity = float(self.tp) / self.n_ref
          self.positive_predictivity = float(self.tp) / self.n_test
          self.false_positive_rate = float(self.fp) / self.n_test
docs: Calculate performance statistics after the two sets of annotations
          are compared.
  
          Example:
          -------------------
           ref=500  test=480
          {  30 { 470 } 10  }
          -------------------
  
          tp = 470
          fp = 10
          fn = 30
  
          specificity = 470 / 500
          positive_predictivity = 470 / 480
          false_positive_rate = 10 / 480