示例#1
0
 def check_definition(self):
     for n in [16,17,64,127]:
         x = arange(n)*2*pi/n
         y = ihilbert(sin(x))
         y1 = direct_ihilbert(sin(x))
         assert_array_almost_equal (y,y1)
         assert_array_almost_equal(ihilbert(sin(2*x)),
                                   direct_ihilbert(sin(2*x)))
示例#2
0
 def check_random_odd(self):
     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(ihilbert(hilbert(f)),f)
         assert_array_almost_equal(hilbert(ihilbert(f)),f)
示例#3
0
 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)
示例#4
0
 def check_random_even(self):
     for n in [32,64,56]:
         f=random ((n,))
         af=sum(f,axis=0)/n
         f=f-af
         # zeroing Nyquist mode:
         f = diff(diff(f,1),-1)
         assert_almost_equal(sum(f,axis=0),0.0)
         assert_array_almost_equal(direct_hilbert(direct_ihilbert(f)),f)
         assert_array_almost_equal(hilbert(ihilbert(f)),f)