code: def run_pitch(self, p, input_vec, freq):
      pitches, errors = [], []
      input_blocks = input_vec.reshape((-1, p.hop_size))
      for new_block in input_blocks:
          pitch = p(new_block)[0]
          pitches.append(pitch)
          errors.append(1.0 - freqtomidi(pitch) / freqtomidi(freq))
      assert_equal(len(input_blocks), len(pitches))
      assert_equal(isnan(pitches), False)
      # cut the first candidates
      # cut = ( p.buf_size - p.hop_size ) / p.hop_size
      pitches = pitches[2:]
      errors = errors[2:]
      # check that the mean of all relative errors is less than 10%
      # assert abs (mean(errors) ) < 0.1, pitches
      assert abs(median(errors)) < 0.06, (
          "median of relative errors is bigger than 0.06 (%f)\n found %s\n errors %s"
          % (mean(errors), pitches, errors)
      )
  
file_path: aubio/python/tests/test_pitch.py
imports: from numpy.testing import TestCase, assert_equal
  from numpy import sin, arange, mean, median, isnan, pi
  from aubio import fvec, pitch, freqtomidi, float_type
label_desc: Use image node_id 3 for calling the aubio_pitch_Sinusoid obj's underlying member method code with example usage: obj.run_pitch(p, input_vec, freq) without return types