Ejemplo n.º 1
0
 def test_fourier4_normal(self):
     """normal ft of exp(-b*t)*unit_step(t)==1/(1.j*w + b)"""
     func = fourier4
     func_ = fourier4_
     a = 2.3
     args = (a, )
     s = 1.5
     ft = FourierTransform(func, args=args, inv=False, func_is_real=True)
     assert_allclose(ft(s)[0], func_(s, *args), atol=0)
Ejemplo n.º 2
0
 def test_fourier2_normal(self):
     """normal ft of rect(t/tau)==tau * sinc(tau*W/(2*pi))"""
     #note that inverse of fourier2 will fail due to oscillations
     func = fourier2
     func_ = fourier2_
     a = 2.3
     args = (a, )
     s = 1.5
     ft = FourierTransform(func, args=args, inv=False, func_is_real=True)
     assert_allclose(ft(s)[0], func_(s, *args), atol=0)
Ejemplo n.º 3
0
 def test_fourier4_inverse(self):
     """inverse ft of 1/(1.j*w + b)==exp(-b*t)*unit_step(t)"""
     func_ = fourier4
     func = fourier4_
     a = 2.3
     args = (a, )
     s = 1.5
     ft = FourierTransform(
         func,
         args=args,
         inv=True,
     )
     assert_allclose(ft(s)[0], func_(s, *args), atol=0)
Ejemplo n.º 4
0
 def test_fourier1_inverse(self):
     """inverse ft of 2 * a / (a**2 + x**2)==exp(- a * abs(x))"""
     func_ = fourier1
     func = fourier1_
     a = 2.3
     args = (a, )
     s = 1.5
     ft = FourierTransform(func,
                           args=args,
                           inv=True,
                           func_is_real=True,
                           real_part_even=True)
     assert_allclose(ft(s)[0], func_(s, *args), atol=0)
Ejemplo n.º 5
0
 def test_fourier1_normal_at_zero(self):
     """normal ft of exp(- a * abs(x)) == 2 * a / (a**2 + x**2)"""
     func = fourier1
     func_ = fourier1_
     a = 2.3
     args = (a, )
     s = 0
     ft = FourierTransform(func,
                           args=args,
                           inv=False,
                           func_is_real=True,
                           real_part_even=True)
     assert_allclose(ft(s)[0], func_(s, *args), atol=0)
Ejemplo n.º 6
0
 def fourier_inverse(self, f, tvar, args, **opt):
     ft = FourierTransform(f, args, inv=True, **opt)
     val, err = ft(tvar)
     return val, err
Ejemplo n.º 7
0
 def fourier(self, f, tvar, args, **opt):
     ft = FourierTransform(f, args, **opt)
     val, err = ft(tvar)
     return val, err