code: def testConstantInput(self):
      dur = 5
      size = int(dur * sr)
      times, rate = OnsetRate()(ones(size))
      # a constant input signal should return no onsets, however as
      # the last frame contains less samples (although it is zeropadded)
      # therefore in a constant input signal it will always detect an onset
      # on the last frame. Maybe last frame should be skipped in the
      # algorithm?
      # TODO why not having an onset in the first frame? it seems logical
      # to have it there for non-zero constant signals
      firstFrame = 1 * frameTime
      lastFrame = (int(size / hopSize) - 1) * frameTime
      self.assertAlmostEqualVector(times, [firstFrame, lastFrame])
      self.assertAlmostEqual(rate, 2.0 / dur)
  
file_path: essentia/test/src/unittests/rhythm/test_onsetrate.py
imports: from essentia_test import *
  from numpy import random
label_desc: Use image node_id 3 for calling the TestOnsetRate obj's underlying member method code with example usage: obj.testConstantInput() without return types