code: def cemgil(detections, annotations, sigma=CEMGIL_SIGMA):
      """
      Calculate the Cemgil accuracy for the given detections and annotations.
  
      Parameters
      ----------
      detections : list or numpy array
          Detected beats.
      annotations : list or numpy array
          Annotated beats.
      sigma : float, optional
          Sigma for Gaussian error function.
  
      Returns
      -------
      cemgil : float
          Cemgil beat tracking accuracy.
  
      References
      ----------
      .. [1] A.T. Cemgil, B. Kappen, P. Desain, and H. Honing,
             "On tempo tracking: Tempogram representation and Kalman filtering",
             Journal Of New Music Research, vol. 28, no. 4, 2001.
  
      """
      # sigma must be greater than 0
      if float(sigma) <= 0:
          raise ValueError("`sigma` must be greater than 0.")
      # determine the abs. errors of the detections to the closest annotations
      # Note: the original implementation searches for the closest matches of
      #       detections given the annotations. Since absolute errors > a usual
      #       beat interval produce high errors (and thus in turn add negligible
      #       values to the accuracy), it is safe to swap those two.
      errors = calc_absolute_errors(detections, annotations)
      # apply a Gaussian error function with the given std. dev. on the errors
      acc = np.exp(-(errors**2.0) / (2.0 * (sigma**2.0)))
      # and sum up the accuracy
      acc = np.sum(acc)
      # normalized by the mean of the number of detections and annotations
      acc /= 0.5 * (len(annotations) + len(detections))
      # return accuracy
      return acc
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  from functools import wraps
  import numpy
  from .None import MeanEvaluation, calc_absolute_errors, calc_errors, evaluation_io, find_closest_matches
  from .onsets import OnsetEvaluation
label_desc: Use image node_id 9 for calling a global function with example usage: cemgil(detections, annotations, sigma) and returns: acc