code: def testARProcess(self):
      # This test assess the capability of the algorithm to
      # detect a low frequency humming modeled as an autoregresive
      # process. The idea is that this kind of signal is probably
      # closer to hummings found on real scenarios.
      PI = np.pi
      time = 30.0  # s
      fs = 44100.0  # fs
      freq = 100  # Hz
      nSamples = int(time * fs)
  
      attempts = 3
      for i in range(attempts):
          try:
              noise = np.array(
                  np.random.randn(nSamples), dtype=np.float32
              )
  
              v1 = [1, -1 * np.exp(1j * 2 * PI * freq / fs)]
              v2 = [1, -1 * np.exp(-1j * 2 * PI * freq / fs)]
  
              a = np.array(
                  np.convolve(np.real(v1), np.real(v2)),
                  dtype=np.float32,
              )
              b = 1 - np.sum(abs(a))
  
              hum = IIR(denominator=a, numerator=[1.0])(noise)
              hum /= np.max(hum)
  
              signal = hum + noise
              signal /= np.max(signal)
  
              (
                  _,
                  estimated_freqs,
                  _,
                  _,
                  _,
              ) = HumDetector(
                  detectionThreshold=2.0
              )(signal)
  
              self.assertAlmostEqualVector(
                  [estimated_freqs[0]], [freq], 1e2
              )
          except IndexError:
              if i == attempts - 1:
                  self.assertAlmostEqualVector(
                      [estimated_freqs[0]], [freq], 1e2
                  )
              print(
                  "testARProcess failed. This test is based on random "
                  "signals so it can fail sometimes. {}Attempt {}/{}".format(
                      "It will be repeated. " if i < 2 else "",
                      i + 1,
                      attempts,
                  )
              )
              continue
          if i > 0:
              print(
                  "testARProcess passed on the attempt {}".format(i + 1)
              )
          break
  
file_path: essentia/test/src/unittests/audioproblems/test_humdetector.py
imports: import numpy
  from math import *
  from essentia_test import *
  from essentia import array
label_desc: Use image node_id 5 for calling the TestHumDetector obj's underlying member method code with example usage: obj.testARProcess() without return types