code: def testImpulse(self):
      # Given an impulse should return its position
      n = 10
      detection = zeros(100).reshape(n, n)
      for i in range(len(detection)):
          detection[i, 5] = 1
          detection[i, 4] = 0.2
          detection[i, 6] = 0.3
      weights = ones(n)
      size = 2048
      sr = 44100.0
      while size > 32:
          hopsize = size / 2
          frameTime = (size - hopsize) / sr
          frameRate = 1.0 / frameTime
          if size == 1024 and hopsize == 512:
              onset = Onsets(frameRate=frameRate)(detection, weights)
              self.assertAlmostEqualVector(
                  onset, array([4 * frameTime]), 1e-5
              )
          else:
              # Onsets does not support other framerates than
              # (1024-512)/44100
              # self.assertConfigureFails(Onsets(), { 'frameRate': frameRate })
              pass  # from now on Onset returns a warning instead of exception
          size /= 2
  
file_path: essentia/test/src/unittests/rhythm/test_onsets.py
imports: from essentia_test import *
label_desc: Use image node_id 3 for calling the TestOnsets obj's underlying member method code with example usage: obj.testImpulse() without return types