code: def _error_histogram(detections, annotations, histogram_bins):
      """
      Helper function to calculate the relative errors of the given detections
      and annotations and map them to an histogram with the given bins edges.
  
      Parameters
      ----------
      detections : list or numpy array
          Detected beats.
      annotations : list or numpy array
          Annotated beats.
      histogram_bins : numpy array
          Beat error histogram bin edges.
  
      Returns
      -------
      error_histogram : numpy array
          Beat error histogram.
  
      Notes
      -----
      The returned error histogram is circular, i.e. it contains 1 bin less than
      a histogram built normally with the given histogram bin edges. The values
      of the last and first bin are summed and mapped to the first bin.
  
      """
      # get the relative errors of the detections to the annotations
      errors = calc_relative_errors(detections, annotations)
      # map the relative beat errors to the range of -0.5..0.5
      errors = np.mod(errors + 0.5, -1) + 0.5
      # get bin counts for the given errors over the distribution
      histogram = np.histogram(errors, histogram_bins)[0].astype(float)
      # make the histogram circular by adding the last bin to the first one
      histogram[0] += histogram[-1]
      # return the histogram without the last bin
      return histogram[:-1]
  
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 14 for calling a global function with example usage: _error_histogram(detections, annotations, histogram_bins) and returns: histogram