def check_random_odd(self): for h in [0.1,0.5,1,5.5,10]: for n in [33,65,55]: f=random ((n,)) af=sum(f,axis=0)/n f=f-af assert_almost_equal(sum(f,axis=0),0.0) assert_array_almost_equal(itilbert(tilbert(f,h),h),f) assert_array_almost_equal(tilbert(itilbert(f,h),h),f)
def check_definition(self): for h in [0.1,0.5,1,5.5,10]: for n in [16,17,64,127]: x = arange(n)*2*pi/n y = itilbert(sin(x),h) y1 = direct_itilbert(sin(x),h) assert_array_almost_equal (y,y1) assert_array_almost_equal(itilbert(sin(x),h), direct_itilbert(sin(x),h)) assert_array_almost_equal(itilbert(sin(2*x),h), direct_itilbert(sin(2*x),h))
def check_itilbert_relation(self): for n in [16,17,64,127]: x = arange(n)*2*pi/n f = sin (x)+cos (2*x)*sin(x) y = ihilbert(f) y1 = direct_ihilbert(f) assert_array_almost_equal (y,y1) y2 = itilbert(f,h=10) assert_array_almost_equal (y,y2)