code: def testRegression(self):
      # build a 60s pulse train at 100bpm starting at 0.3s:
      # (not a rubato region)
      beats = self.PulseTrain(100, 0.3, 60.0)
      start, stop, n = BpmRubato()(beats)
      self.assertEqualVector(start, [])
      self.assertEqualVector(stop, [])
      self.assertEqual(n, 0)
      self.assertTrue(beats[-1] < 60)
  
      # add a 60s pulse train at 140bpm starting 0.6s later:
      # (this is a rubato region)
      phase = beats[-1] + 60 / 100.0
      expectedStart = [beats[-3]]
      newBeats = self.PulseTrain(140, phase, phase + 60.0)
      expectedStop = [newBeats[2]]
      beats += newBeats
      start, stop, n = BpmRubato()(beats)
      self.assertAlmostEqualVector(start, expectedStart, 1e-1)
      self.assertAlmostEqualVector(stop, expectedStop, 1e-1)
      self.assertEqual(n, 1)
      self.assertTrue(beats[-1] < 120)
  
      # add 60s more of a pulse train at 140bpm starting 0.3s later
      # (not a rubato region)
      phase = 0.3 + beats[-1]
      beats += self.PulseTrain(140, phase, phase + 60.0)
      start, stop, n = BpmRubato()(beats)
      self.assertAlmostEqualVector(start, expectedStart, 1e-1)
      self.assertAlmostEqualVector(stop, expectedStop, 1e-1)
      self.assertEqual(n, 1)
      self.assertEqual(True, beats[-1] < 180.6)
  
      # add a 10s pulse train at 100bpm starting 0.3s later:
      # slowing down (this is a rubato region)
      phase = 0.3 + beats[-1]
      newBeats = self.PulseTrain(100, phase, phase + 10.0)
      expectedStart += [beats[-3]]
      expectedStop += [newBeats[2]]
      beats += newBeats
      start, stop, n = BpmRubato()(beats)
      self.assertEqual(len(start), len(stop))
      self.assertAlmostEqualVector(start, expectedStart, 1e-1)
      self.assertAlmostEqualVector(stop, expectedStop, 1e-1)
      self.assertEqual(n, 2)
      self.assertTrue(beats[-1] < 190.6)
  
      # add 10s more of increasing train at 110bpm
      # (this is not a rubato region because of the gradual change)
      phase = 0.3 + beats[-1]
      newBeats = self.IncreasingPulseTrain(110, phase, phase + 10.0)
      beats += newBeats
  
      start, stop, n = BpmRubato()(beats)
  
      self.assertEqual(len(start), len(stop))
      self.assertAlmostEqualVector(start, expectedStart, 1e-1)
      self.assertAlmostEqualVector(stop, expectedStop, 1e-1)
      self.assertEqual(n, 2)
      self.assertTrue(beats[-1] < 200.6)
  
      # add 10s more of decreasing train at 110bpm
      # (this is a rubato region, its gradual like the one before, but I'm
      # not sure why its registered as a rubato region)
      phase = 0.3 + beats[-1]
      newBeats = self.DecreasingPulseTrain(110, phase, phase + 10.0)
      expectedStart += [beats[-3]]
      expectedStop += [newBeats[2]]
  
      beats += newBeats
  
      start, stop, n = BpmRubato()(beats)
  
      self.assertEqual(len(start), len(stop))
      self.assertAlmostEqualVector(start, expectedStart, 1e-1)
      self.assertAlmostEqualVector(stop, expectedStop, 1e-1)
      self.assertEqual(n, 3)
      self.assertTrue(beats[-1] < 210.6)
  
      # add more pulses, but no phase offset:
      # this fails due to beats not being in ascending time
      phase = 0.3
      beats += self.PulseTrain(140, phase, 60.0)
      self.assertComputeFails(BpmRubato(), beats)
  
file_path: essentia/test/src/unittests/rhythm/test_bpmrubato.py
imports: from essentia_test import *
label_desc: Use image node_id 4 for calling the TestBpmRubato obj's underlying member method code with example usage: obj.testRegression() without return types