od3 = s.createSpikes(4)
    ods = [od1, od2, od3]
    spds = []
    hpds = []
    thsemispds = []
    thf1pds = []
    thf2pds = []
    thf3pds = []
    dnames = ['Sine', 'Pulse', 'Spike']
    thfname = ['soft', 'hard', 'thsemisf', 'thf1', 'thf2', 'thf3']
    pdsmatrix = [spds, hpds, thsemispds, thf1pds, thf2pds, thf3pds]
    thps = [None, None, None, 0.5, 2, 2]

    for od in ods:
        dwd = DWTP(od)
        coeffs = dwd.dwtdec(wtname='db4', delevel=2)
        for i in range(len(pdsmatrix)):
            ncoeffs = dwd.thprocess(coeffs, thf=thfname[i], thp=thps[i])
            pd = dwd.dwtrec(ncoeffs, wtname='db4')
            pdsmatrix[i].append(pd)

    ssnrs = []
    hsnrs = []
    thsemissnrs = []
    thf1snrs = []
    thf2snrs = []
    thf3snrs = []

    smses = []
    hmses = []
    thsemismses = []
Ejemplo n.º 2
0
from GetActualSignal import GetActualSignal
from LayerSelect import LayerSelect
from WtProcess import DWTP
from NoiseDetection import NoiseDetection

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od1 = ad.selectvalue(start=4000, end=5024)
    dwt = DWTP(od1)
    coeffs = dwt.dwtdec(wtname='db2')
    ps1 = NoiseDetection(od1, 'db2').WNrecgmethod()
    ps2 = NoiseDetection(od1, 'db2').Entropymethod1(4)
    print(ps1)
    print(ps2)
Ejemplo n.º 3
0
from GetActualSignal import GetActualSignal
from ThresholdSelect import ThSelect
from ThresholdFunction import ThFuction
import numpy as np
import pywt
import matplotlib.pyplot as plt
from DenoiseResult import DenoiseRsult
from WtProcess import DWTP
from AcSNR import AcSNR

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od1 = ad.selectvalue(start=0, end=23552)
    dwt = DWTP(od1)
    coeffs = dwt.dwtdec(wtname='db4', delevel=4)
    nscoeffs = dwt.thprocess(coeffs, thf='soft')
    nhcoeffs = dwt.thprocess(coeffs, thf='hard')
    spd = dwt.dwtrec(nscoeffs, wtname='db4')
    hpd = dwt.dwtrec(nhcoeffs, wtname='db4')
    ad.outputdata(startidex=0, ogdata=od1, pddata=spd)

    ssm = DenoiseRsult([], spd).smooth(od1)
    hsm = DenoiseRsult([], hpd).smooth(od1)
    slrepv = DenoiseRsult([], spd).lrepv(od1, 128)
    hlrepv = DenoiseRsult([], hpd).lrepv(od1, 128)

    print('ssm = {0}'.format(ssm))
    print('hsm = {0}'.format(hsm))
    print('slrepv = {0}'.format(slrepv))
    print('hlrepv = {0}'.format(hlrepv))
import math as mt
from BlockThMethod import BlockThMethod
from ThresholdSelect import ThSelect
from BestThEstimation import BestThEstimate
from ThSearchAlgorithm import ThSearchAlgorithm
from WtProcess import DWTP
from DenoiseResult import DenoiseRsult
from AcSNR import AcSNR

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od1 = ad.selectvalue(start=6000, end=7024)
    dl = 4
    dwd = DWTP(od1)
    coeffs = dwd.dwtdec(wtname='db2', delevel=dl)
    gths = []
    bsths = []
    for i in range(1, len(coeffs)):
        bthe = BestThEstimate(coeffs[i], thfunction='thf3', thp=2 + 2 * i)
        thsa = ThSearchAlgorithm()
        gth = ThSelect(coeffs[i]).DonohoThEx()
        bsth = thsa.FibonacciSearch(bthe.msesurefuction, [0, 1.5 * gth], 0.01)
        gths.append(gth)
        bsths.append(bsth)

    ncoeffs1 = dwd.thprocess2(coeffs,
                              ths=gths,
                              thf='thf3',
                              thps=[2 + 2 * k for k in range(dl)])
    ncoeffs2 = dwd.thprocess2(coeffs,
Ejemplo n.º 5
0
    gthss = []
    srmthss = []
    srmthss2 = []
    thsmatrix = [gthss, gthss, srmthss, srmthss2]
    thmname = ['sth', 'hth', 'srm', 'srm']
    thfname = ['soft', 'hard', 'thf3', 'thf3wp']
    spds = []
    hpds = []
    thf3pds = []
    thf3wppds = []
    pdsmatrix = [spds, hpds, thf3pds, thf3wppds]
    dl = 5

    for od in ods:
        dwd = DWTP(od)
        coeffs = dwd.dwtdec(wtname='sym6', delevel=dl)
        gths = []
        gcvths = []
        srmths = []
        srmths2 = []
        for i in range(1, len(coeffs)):
            bthe = BestThEstimate(coeffs[i], thfunction='thf3', thp=4)
            bthe2 = BestThEstimate(coeffs[i], thfunction='thf3', thp=2 + 2 * i)
            thsa = ThSearchAlgorithm()
            gth = ThSelect(coeffs[i]).DonohoThEx()
            srmth = thsa.FibonacciSearch(bthe.msesurefuction, [0, 1 * gth],
                                         0.01)
            srmth2 = thsa.FibonacciSearch(bthe.msesurefuction, [0, 1 * gth],
                                          0.01)
            gths.append(gth)
            srmths.append(srmth)