コード例 #1
0
    def test_bior2(self):
        s1 = self.s1
        x1 = self.x1
        x2 = self.x2
        ST = pyyawt.dwtmode("status", "nodisp")
        wnames = [
            'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
            'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
            'bior4.4', 'bior5.5', 'bior6.8'
        ]
        for N in np.arange(len(wnames)):
            wname = wnames[N]
            [Lo_D, Hi_D, Lo_R, Hi_R] = pyyawt.wfilters(wname)
            [c, l] = pyyawt.wavedec(s1, 3, wname)
            s0 = pyyawt.waverec(c, l, wname)
            [cA1, cD1] = pyyawt.dwt(s1, wname)
            [cA2, cD2] = pyyawt.dwt(cA1, wname)
            [cA3, cD3] = pyyawt.dwt(cA2, wname)
            ca2 = pyyawt.idwt(cA3, cD3, wname, np.size(cA2))
            ca1 = pyyawt.idwt(ca2, cD2, wname, np.size(cA1))
            a0 = pyyawt.idwt(ca1, cD1, wname, np.size(s1))
            np.testing.assert_almost_equal(a0, s0)

            Lo_D = np.random.randn(np.size(Lo_D))
            Hi_D = np.random.randn(np.size(Lo_D))
            ca2 = pyyawt.idwt(cA3, cD3, Lo_R, Hi_R, np.size(cA2))
            ca1 = pyyawt.idwt(ca2, cD2, Lo_R, Hi_R, np.size(cA1))
            a0 = pyyawt.idwt(ca1, cD1, Lo_R, Hi_R, np.size(s1))
            s0 = pyyawt.waverec(c, l, Lo_R, Hi_R)
            np.testing.assert_almost_equal(a0, s0)
コード例 #2
0
ファイル: test_waverec.py プロジェクト: holgern/pyyawt
    def test_bior2(self):
        s1 = self.s1
        x1 = self.x1
        x2 = self.x2
        ST = pyyawt.dwtmode("status","nodisp")
        wnames = ['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
                  'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
                  'bior4.4', 'bior5.5', 'bior6.8']
        for N in np.arange(len(wnames)):
            wname = wnames[N]
            [Lo_D,Hi_D,Lo_R,Hi_R] = pyyawt.wfilters(wname)
            [c,l] = pyyawt.wavedec(s1,3,wname)
            s0 = pyyawt.waverec(c,l,wname)
            [cA1,cD1] = pyyawt.dwt(s1,wname)
            [cA2,cD2] = pyyawt.dwt(cA1,wname)
            [cA3,cD3] = pyyawt.dwt(cA2,wname)
            ca2 = pyyawt.idwt(cA3,cD3,wname,np.size(cA2))
            ca1 = pyyawt.idwt(ca2,cD2,wname,np.size(cA1))
            a0 = pyyawt.idwt(ca1,cD1,wname,np.size(s1))
            np.testing.assert_almost_equal(a0, s0)

            Lo_D = np.random.randn(np.size(Lo_D))
            Hi_D = np.random.randn(np.size(Lo_D))
            ca2 = pyyawt.idwt(cA3,cD3,Lo_R,Hi_R,np.size(cA2))
            ca1 = pyyawt.idwt(ca2,cD2,Lo_R,Hi_R,np.size(cA1))
            a0 = pyyawt.idwt(ca1,cD1,Lo_R,Hi_R,np.size(s1))
            s0 = pyyawt.waverec(c,l,Lo_R,Hi_R)
            np.testing.assert_almost_equal(a0, s0)
コード例 #3
0
ファイル: test_waverec.py プロジェクト: holgern/pyyawt
 def test_haar(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     [c,l] = pyyawt.wavedec(s1,3,'haar')
     [cA1,cD1] = pyyawt.dwt(s1,'haar')
     [cA2,cD2] = pyyawt.dwt(cA1,'haar')
     [cA3,cD3] = pyyawt.dwt(cA2,'haar')
     ca2 = pyyawt.idwt(cA3,cD3,'haar',np.size(cA2))
     ca1 = pyyawt.idwt(ca2,cD2,'haar',np.size(cA1))
     a0 = pyyawt.idwt(ca1,cD1,'haar',np.size(s1))
     s0 = pyyawt.waverec(c,l,'haar')
     np.testing.assert_almost_equal(a0, s0)
コード例 #4
0
 def test_haar(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     [c, l] = pyyawt.wavedec(s1, 3, 'haar')
     [cA1, cD1] = pyyawt.dwt(s1, 'haar')
     [cA2, cD2] = pyyawt.dwt(cA1, 'haar')
     [cA3, cD3] = pyyawt.dwt(cA2, 'haar')
     ca2 = pyyawt.idwt(cA3, cD3, 'haar', np.size(cA2))
     ca1 = pyyawt.idwt(ca2, cD2, 'haar', np.size(cA1))
     a0 = pyyawt.idwt(ca1, cD1, 'haar', np.size(s1))
     s0 = pyyawt.waverec(c, l, 'haar')
     np.testing.assert_almost_equal(a0, s0)
コード例 #5
0
ファイル: test_waverec.py プロジェクト: holgern/pyyawt
 def test_sym(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     for N in np.arange(2,21):
         wname = "sym" + str(N)
         [c,l] = pyyawt.wavedec(s1,3,wname)
         [cA1,cD1] = pyyawt.dwt(s1,wname)
         [cA2,cD2] = pyyawt.dwt(cA1,wname)
         [cA3,cD3] = pyyawt.dwt(cA2,wname)
         ca2 = pyyawt.idwt(cA3,cD3,wname,np.size(cA2))
         ca1 = pyyawt.idwt(ca2,cD2,wname,np.size(cA1))
         a0 = pyyawt.idwt(ca1,cD1,wname,np.size(s1))
         s0 = pyyawt.waverec(c,l,wname)
         np.testing.assert_almost_equal(a0, s0)
コード例 #6
0
 def test_sym(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     for N in np.arange(2, 21):
         wname = "sym" + str(N)
         [c, l] = pyyawt.wavedec(s1, 3, wname)
         [cA1, cD1] = pyyawt.dwt(s1, wname)
         [cA2, cD2] = pyyawt.dwt(cA1, wname)
         [cA3, cD3] = pyyawt.dwt(cA2, wname)
         ca2 = pyyawt.idwt(cA3, cD3, wname, np.size(cA2))
         ca1 = pyyawt.idwt(ca2, cD2, wname, np.size(cA1))
         a0 = pyyawt.idwt(ca1, cD1, wname, np.size(s1))
         s0 = pyyawt.waverec(c, l, wname)
         np.testing.assert_almost_equal(a0, s0)
コード例 #7
0
 def test_bior3(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     ST = pyyawt.dwtmode("status", "nodisp")
     wnames = [
         'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
         'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
         'bior4.4', 'bior5.5', 'bior6.8'
     ]
     ST = pyyawt.dwtmode("status", "nodisp")
     for N in np.arange(len(wnames)):
         wname = wnames[N]
         [c, l] = pyyawt.wavedec(s1, 3, wname)
         pyyawt.dwtmode("symh")
         a0 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("symw")
         a1 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("asymh")
         a2 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("asymw")
         a3 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("zpd")
         a4 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("sp0")
         a5 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("sp1")
         a6 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("ppd")
         a7 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode("per")
         a8 = pyyawt.waverec(c, l, wname)
         pyyawt.dwtmode(ST)
         np.testing.assert_almost_equal(a0, a1)
         np.testing.assert_almost_equal(a0, a2)
         np.testing.assert_almost_equal(a0, a3)
         np.testing.assert_almost_equal(a0, a4)
         np.testing.assert_almost_equal(a0, a5)
         np.testing.assert_almost_equal(a0, a6)
         np.testing.assert_almost_equal(a0, a7)
         np.testing.assert_almost_equal(a0, a8)
コード例 #8
0
ファイル: test_waverec.py プロジェクト: holgern/pyyawt
 def test_bior3(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     ST = pyyawt.dwtmode("status","nodisp")
     wnames = ['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
               'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
               'bior4.4', 'bior5.5', 'bior6.8']
     ST = pyyawt.dwtmode("status","nodisp")
     for N in np.arange(len(wnames)):
         wname = wnames[N]
         [c,l] = pyyawt.wavedec(s1,3,wname)
         pyyawt.dwtmode("symh")
         a0 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("symw")
         a1 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("asymh")
         a2 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("asymw")
         a3 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("zpd")
         a4 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("sp0")
         a5 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("sp1")
         a6 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("ppd")
         a7 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode("per")
         a8 = pyyawt.waverec(c,l,wname)
         pyyawt.dwtmode(ST)
         np.testing.assert_almost_equal(a0, a1)
         np.testing.assert_almost_equal(a0, a2)
         np.testing.assert_almost_equal(a0, a3)
         np.testing.assert_almost_equal(a0, a4)
         np.testing.assert_almost_equal(a0, a5)
         np.testing.assert_almost_equal(a0, a6)
         np.testing.assert_almost_equal(a0, a7)
         np.testing.assert_almost_equal(a0, a8)
コード例 #9
0
ファイル: test_waverec.py プロジェクト: holgern/pyyawt
 def test_bior(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     wnames = ['bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
               'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
               'bior4.4', 'bior5.5', 'bior6.8']
     for N in np.arange(len(wnames)):
         wname = wnames[N]
         [c,l] = pyyawt.wavedec(s1,3,wname)
         [cA1,cD1] = pyyawt.dwt(s1,wname)
         [cA2,cD2] = pyyawt.dwt(cA1,wname)
         [cA3,cD3] = pyyawt.dwt(cA2,wname)
         ca2 = pyyawt.idwt(cA3,cD3,wname,np.size(cA2))
         ca1 = pyyawt.idwt(ca2,cD2,wname,np.size(cA1))
         a0 = pyyawt.idwt(ca1,cD1,wname,np.size(s1))
         s0 = pyyawt.waverec(c,l,wname)
         np.testing.assert_almost_equal(a0, s0)
コード例 #10
0
 def test_bior(self):
     s1 = self.s1
     x1 = self.x1
     x2 = self.x2
     wnames = [
         'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6',
         'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9',
         'bior4.4', 'bior5.5', 'bior6.8'
     ]
     for N in np.arange(len(wnames)):
         wname = wnames[N]
         [c, l] = pyyawt.wavedec(s1, 3, wname)
         [cA1, cD1] = pyyawt.dwt(s1, wname)
         [cA2, cD2] = pyyawt.dwt(cA1, wname)
         [cA3, cD3] = pyyawt.dwt(cA2, wname)
         ca2 = pyyawt.idwt(cA3, cD3, wname, np.size(cA2))
         ca1 = pyyawt.idwt(ca2, cD2, wname, np.size(cA1))
         a0 = pyyawt.idwt(ca1, cD1, wname, np.size(s1))
         s0 = pyyawt.waverec(c, l, wname)
         np.testing.assert_almost_equal(a0, s0)
コード例 #11
0
GR = log[:, 0]
NPHI = log[:, 1]
RHOB = log[:, 2]

GR = np.array(GR, dtype=float)
NPHI = np.array(NPHI, dtype=float)
RHOB = np.array(RHOB, dtype=float)

# # WAVELET DENOISING FILTER # #

# GR #
[CLog, LLog] = wavedec(GR, level, 'sym8')
[XDLog, CXDLog, LDXLog] = wden(CLog, LLog, 'heursure', 's', 'one', level,
                               'sym8')
deno_log_GR = waverec(CXDLog, LDXLog, 'sym8')  # Use this for GR Input
# print(np.shape(deno_log_GR))

spec_log = fft(GR)
spec_log = abs(spec_log)

spec_deno_log_GR = fft(deno_log_GR)
spec_deno_log_GR = abs(spec_deno_log_GR)

# VISUALIZING BEFORE AND AFTER DENOISING

# f, ax = plt.subplots(nrows=4,ncols=2, figsize=(20,10))
# ax[0,0].plot(spec_log)
# ax[0,0].grid()
# ax[0,0].set_xlabel("GR Spectrum Before Denoising")
# ax[0,1].plot(spec_deno_log_GR)