class_docstr: State space for beat tracking with a HMM.
  
  Parameters
  ----------
  min_interval : float
      Minimum interval to model.
  max_interval : float
      Maximum interval to model.
  num_intervals : int, optional
      Number of intervals to model; if set, limit the number of intervals
      and use a log spacing instead of the default linear spacing.
  
  Attributes
  ----------
  num_states : int
      Number of states.
  intervals : numpy array
      Modeled intervals.
  num_intervals : int
      Number of intervals.
  state_positions : numpy array
      Positions of the states (i.e. 0...1).
  state_intervals : numpy array
      Intervals of the states (i.e. 1 / tempo).
  first_states : numpy array
      First state of each interval.
  last_states : numpy array
      Last state of each interval.
  
  References
  ----------
  .. [1] Florian Krebs, Sebastian Böck and Gerhard Widmer,
         "An Efficient State Space Model for Joint Tempo and Meter Tracking",
         Proceedings of the 16th International Society for Music Information
         Retrieval Conference (ISMIR), 2015.
class_docstr_tok: ["State","space","for","beat","tracking","with","a","HMM",".","Parameters","--","--","--","--","--","min_interval",":","float","Minimum","interval","to","model",".","max_interval",":","float","Maximum","interval","to","model",".","num_intervals",":","int",",","optional","Number","of","intervals","to","model",";","if","set",",","limit","the","number","of","intervals","and","use","a","log","spacing","instead","of","the","default","linear","spacing",".","Attributes","--","--","--","--","--","num_states",":","int","Number","of","states",".","intervals",":","numpy","array","Modeled","intervals",".","num_intervals",":","int","Number","of","intervals",".","state_positions",":","numpy","array","Positions","of","the","states","(","i.e",".","0","...","1",")",".","state_intervals",":","numpy","array","Intervals","of","the","states","(","i.e",".","1","\/","tempo",")",".","first_states",":","numpy","array","First","state","of","each","interval",".","last_states",":","numpy","array","Last","state","of","each","interval",".","References","--","--","--","--","--","..","[","1","]","Florian","Krebs",",","Sebastian","B\u00f6ck","and","Gerhard","Widmer",",","``","An","Efficient","State","Space","Model","for","Joint","Tempo","and","Meter","Tracking","''",",","Proceedings","of","the","16th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2015","."]
code: def __init__(self, min_interval, max_interval, num_intervals=None):
      # per default, use a linear spacing of the tempi
      intervals = np.arange(
          np.round(min_interval), np.round(max_interval) + 1
      )
      # if num_intervals is given (and smaller than the length of the linear
      # spacing of the intervals) use a log spacing and limit the number of
      # intervals to the given value
      if num_intervals is not None and num_intervals < len(intervals):
          # we must approach the number of intervals iteratively
          num_log_intervals = num_intervals
          intervals = []
          while len(intervals) < num_intervals:
              intervals = np.logspace(
                  np.log2(min_interval),
                  np.log2(max_interval),
                  num_log_intervals,
                  base=2,
              )
              # quantize to integer intervals
              intervals = np.unique(np.round(intervals))
              num_log_intervals += 1
      # save the intervals
      self.intervals = np.ascontiguousarray(intervals, dtype=int)
      # number of states and intervals
      self.num_states = int(np.sum(intervals))
      self.num_intervals = len(intervals)
      # define first and last states
      first_states = np.cumsum(np.r_[0, self.intervals[:-1]])
      self.first_states = first_states.astype(int)
      self.last_states = np.cumsum(self.intervals) - 1
      # define the positions and intervals of the states
      self.state_positions = np.empty(self.num_states)
      self.state_intervals = np.empty(self.num_states, dtype=int)
      # Note: having an index counter is faster than ndenumerate
      idx = 0
      for i in self.intervals:
          self.state_positions[idx : idx + i] = np.linspace(
              0, 1, i, endpoint=False
          )
          self.state_intervals[idx : idx + i] = i
          idx += i
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from madmom.ml.hmm import ObservationModel, TransitionModel
label_desc: Use image node_id 1 to create a new BeatStateSpace object from inherited base classes: object with example: obj = BeatStateSpace(min_interval, max_interval, num_intervals)