code: def test_centroid(self):
      o = specdesc("centroid")
      c = cvec()
      # make sure centroid of zeros is zero
      assert_equal(0.0, o(c))
      a = arange(c.length, dtype=float_type)
      c.norm = a
      centroid = sum(a * a) / sum(a)
      assert_almost_equal(centroid, o(c), decimal=2)
  
      c.norm = a * 0.5
      assert_almost_equal(centroid, o(c), decimal=2)
  
imports: from numpy.testing import TestCase, assert_equal, assert_almost_equal
  from numpy import random, arange, log, zeros
  from aubio import specdesc, cvec, float_type
label_desc: Use image node_id 9 for calling the aubio_specdesc obj's underlying member method code with example usage: obj.test_centroid() without return types