code: def add_parser(parser):
      """
      Add a beat evaluation sub-parser to an existing parser.
  
      Parameters
      ----------
      parser : argparse parser instance
          Existing argparse parser object.
  
      Returns
      -------
      sub_parser : argparse sub-parser instance
          Beat evaluation sub-parser.
      parser_group : argparse argument group
          Beat evaluation argument group.
  
      """
      import argparse
  
      # add beat evaluation sub-parser to the existing parser
      p = parser.add_parser(
          "beats",
          help="beat evaluation",
          formatter_class=argparse.RawDescriptionHelpFormatter,
          description="""
      This program evaluates pairs of files containing the beat annotations and
      detections. Suffixes can be given to filter them from the list of files.
  
      Each line represents a beat and must have the following format with values
      being separated by whitespace [brackets indicate optional values]:
      `beat_time [beat_inside_bar]`
  
      Lines starting with # are treated as comments and are ignored.
  
      To maintain compatibility with the original Matlab implementation, use the
      arguments '--skip 5 --no_triple'. Please note, that the results can still
      differ, because of the different implementation approach.
  
      """,
      )
      # set defaults
      p.set_defaults(
          eval=BeatEvaluation,
          sum_eval=None,
          mean_eval=BeatMeanEvaluation,
          load_fn=np.loadtxt,
      )
      # file I/O
      evaluation_io(p, ann_suffix=".beats", det_suffix=".beats.txt")
      # parameters for sequence variants
      s = p.add_argument_group("sequence manipulation arguments")
      s.add_argument(
          "--no_offbeat",
          dest="offbeat",
          action="store_false",
          help="do not include offbeat evaluation",
      )
      s.add_argument(
          "--no_double",
          dest="double",
          action="store_false",
          help="do not include double/half tempo evaluation",
      )
      s.add_argument(
          "--no_triple",
          dest="triple",
          action="store_false",
          help="do not include triple/third tempo evaluation",
      )
      s.add_argument(
          "--skip",
          action="store",
          type=float,
          default=0,
          help="skip first N seconds for evaluation "
          "[default=%(default).3f]",
      )
      s.add_argument(
          "--downbeats",
          action="store_true",
          help="evaluate only downbeats",
      )
      # evaluation parameters
      g = p.add_argument_group("beat evaluation arguments")
      g.add_argument(
          "--window",
          dest="fmeasure_window",
          action="store",
          type=float,
          default=FMEASURE_WINDOW,
          help="evaluation window for F-measure "
          "[seconds, default=%(default).3f]",
      )
      g.add_argument(
          "--tolerance",
          dest="pscore_tolerance",
          action="store",
          type=float,
          default=PSCORE_TOLERANCE,
          help="evaluation tolerance for P-score "
          "[default=%(default).3f]",
      )
      g.add_argument(
          "--sigma",
          dest="cemgil_sigma",
          action="store",
          type=float,
          default=CEMGIL_SIGMA,
          help="sigma for Cemgil accuracy [default=%(default).3f]",
      )
      g.add_argument(
          "--goto_threshold",
          action="store",
          type=float,
          default=GOTO_THRESHOLD,
          help="threshold for Goto error [default=%(default).3f]",
      )
      g.add_argument(
          "--goto_sigma",
          action="store",
          type=float,
          default=GOTO_SIGMA,
          help="sigma for Goto error [default=%(default).3f]",
      )
      g.add_argument(
          "--goto_mu",
          action="store",
          type=float,
          default=GOTO_MU,
          help="µ for Goto error [default=%(default).3f]",
      )
      g.add_argument(
          "--phase_tolerance",
          dest="continuity_phase_tolerance",
          action="store",
          type=float,
          default=CONTINUITY_PHASE_TOLERANCE,
          help="phase tolerance window for continuity accuracies "
          "[default=%(default).3f]",
      )
      g.add_argument(
          "--tempo_tolerance",
          dest="continuity_tempo_tolerance",
          action="store",
          type=float,
          default=CONTINUITY_TEMPO_TOLERANCE,
          help="tempo tolerance window for continuity accuracies "
          "[default=%(default).3f]",
      )
      g.add_argument(
          "--bins",
          dest="information_gain_bins",
          action="store",
          type=int,
          default=INFORMATION_GAIN_BINS,
          help="number of histogram bins for information gain "
          "[default=%(default)i]",
      )
      # return the sub-parser and evaluation argument group
      return p, g
  
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 19 for calling a global function with example usage: add_parser(parser) and returns: p,  g