Esempio n. 1
0
 def test_cascade(self):
     for J in xrange(1, 7):
         for i in xrange(1, 5):
             lpcoef = wavelets.daub(i)
             k = len(lpcoef)
             x, phi, psi = wavelets.cascade(lpcoef, J)
             assert_(len(x) == len(phi) == len(psi))
             assert_equal(len(x), (k - 1) * 2 ** J)
Esempio n. 2
0
 def test_cascade(self):
     for J in xrange(1, 7):
         for i in xrange(1, 5):
             lpcoef = wavelets.daub(i)
             k = len(lpcoef)
             x, phi, psi = wavelets.cascade(lpcoef, J)
             assert_(len(x) == len(phi) == len(psi))
             assert_equal(len(x), (k - 1) * 2**J)
def plot_A3_scaling_function_and_wavelet(show=True):
    h = [0.332670552950083, 0.806891509311093, 0.459877502118492, -
         0.135011020010255, -0.0854412738820267, 0.0352262918857095]

    plt.figure(2)

    t, phi, psi = cascade(h)
    plt.subplot(1,2,1)
    plt.plot(t, phi)
    plt.xlabel('t')
    plt.ylabel('phi')
    plt.title('scaling function')

    plt.subplot(1,2,2)
    plt.plot(t, psi)
    plt.xlabel('t')
    plt.ylabel('psi')
    plt.title('mother wavelet')

    if show:
        plt.show()
h = [v.evalf() for v in solutions[0]]

# Compute Symbol
P = Wavelet.compute_symbol(h)
plt.figure(1)

# Plot Symbol
freq = np.linspace(0,1,200)
plt.plot(freq, [abs(P(v)) for v in freq])
plt.xlabel('f')
plt.ylabel('abs(P)')
plt.title('Symbol P(f)')

plt.figure(2)

# Compute Scaling Function and Wavelet Numerically
t, phi, psi = cascade(h)
plt.subplot(1,2,1)
plt.plot(t, phi)
plt.xlabel('t')
plt.ylabel('phi')
plt.title('scaling function')

plt.subplot(1,2,2)
plt.plot(t, psi)
plt.xlabel('t')
plt.ylabel('psi')
plt.title('mother wavelet')
plt.show()