code: def continuity(
      detections,
      annotations,
      phase_tolerance=CONTINUITY_PHASE_TOLERANCE,
      tempo_tolerance=CONTINUITY_TEMPO_TOLERANCE,
      offbeat=True,
      double=True,
      triple=True,
  ):
      """
      Calculate the cmlc, cmlt, amlc and amlt scores for the given detections and
      annotations.
  
      Parameters
      ----------
      detections : list or numpy array
          Detected beats.
      annotations : list or numpy array
          Annotated beats.
      phase_tolerance : float, optional
          Allowed phase tolerance.
      tempo_tolerance : float, optional
          Allowed tempo tolerance.
      offbeat : bool, optional
          Include offbeat variation.
      double  : bool, optional
          Include double and half tempo variations (and offbeat thereof).
      triple  : bool, optional
          Include triple and third tempo variations (and offbeats thereof).
  
      Returns
      -------
      cmlc : float
          Tracking accuracy, continuity at the correct metrical level required.
      cmlt : float
          Same as cmlc, continuity at the correct metrical level not required.
      amlc : float
          Same as cmlc, alternate metrical levels allowed.
      amlt : float
          Same as cmlt, alternate metrical levels allowed.
  
      See Also
      --------
      :func:`cml`
  
      """
      # neither detections nor annotations are given
      if len(detections) == 0 and len(annotations) == 0:
          return 1.0, 1.0, 1.0, 1.0
      # either a single beat detections or annotations given, score 0
      if len(detections) <= 1 or len(annotations) <= 1:
          return 0.0, 0.0, 0.0, 0.0
      # evaluate the correct tempo
      cmlc, cmlt = cml(
          detections, annotations, tempo_tolerance, phase_tolerance
      )
      amlc = cmlc
      amlt = cmlt
      # speed up calculation by skipping other metrical levels if the score is
      # higher than 0.5 already. We must have tested the correct metrical level
      # already, otherwise the cmlc score would be lower.
      if cmlc > 0.5:
          return cmlc, cmlt, amlc, amlt
      # create different variants of the annotations:
      # Note: double also includes half as does triple third, respectively
      sequences = variations(
          annotations,
          offbeat=offbeat,
          double=double,
          half=double,
          triple=triple,
          third=triple,
      )
      # evaluate these metrical variants
      for sequence in sequences:
          # if other metrical levels achieve higher accuracies, take these values
          try:
              # Note: catch the IntervalError here, because the beat variants
              #       could be too short for valid interval calculation;
              #       ok, since we already have valid values for amlc & amlt
              c, t = cml(
                  detections, sequence, tempo_tolerance, phase_tolerance
              )
          except BeatIntervalError:
              c, t = np.nan, np.nan
          amlc = max(amlc, c)
          amlt = max(amlt, t)
      # return a tuple
      return cmlc, cmlt, amlc, amlt
  
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 12 for calling a global function with example usage: continuity(detections, annotations, phase_tolerance, tempo_tolerance, offbeat, double, triple) and returns: cmlc,  cmlt,  amlc,  amlt, int,  int,  int,  int, int,  int,  int,  int, cmlc,  cmlt,  amlc,  amlt