예제 #1
0
import matplotlib.pyplot as plt
from WtProcess import SWTP
from SpatialCorrelationThresholdALG import SpCoThALG
from ThSearchAlgorithm import ThSearchAlgorithm
from ThresholdSelect import ThSelect

if __name__ == '__main__':
    s = Signal(1024)
    od1 = s.createSin(50, 60, 4)
    od2 = s.createPulse(50, 60, 4)
    od3 = s.createSpikes(4)
    ods = [od1, od2, od3]
    dnames = ['Sine', 'Pulse', 'Spike']
    sfp1pds = []
    sfp2pds = []
    for od in ods:
        swt = SWTP(od)
        coeffs = swt.swtdec(delevel=4)
        spta2 = SpCoThALG(coeffs)
        sfp1gcvs = []
        sfp2gcvs = []
        P = spta2.spcoCors()
        spta2.BTHassitIndex(1, pk=0.1, pa=4, mode='srmse')
        for k in range(1, 100):
            sfp2gcv = spta2.BTHspcothfwp2(k/10)
            sfp2gcvs.append(sfp2gcv)
        x=[x/10 for x in range(1, 100)]
        plt.figure()
        plt.plot(x, sfp2gcvs)
    plt.show()
예제 #2
0
from DenoiseResult import DenoiseRsult

if __name__ == '__main__':
    s = Signal(1024)
    od1 = s.createSin(50, 60, 4)
    od2 = s.createPulse(50, 60, 4)
    od3 = s.createSpikes(4)
    ods = [od1, od2, od3]
    dnames = ['Sine', 'Pulse', 'Spike']
    sf1pds = []
    sf2pds = []
    sfp1pds = []
    sfp2pds = []

    for od in ods:
        swt = SWTP(od)
        coeffs = swt.swtdec(wtname='sym6', delevel=4)
        spta = SpCoThALG(coeffs)
        nce1s = spta.spcoThf1()
        nce2s = spta.spcoThf2()
        sf1pd = swt.swtrec(nce1s, wtname='sym6')
        sf2pd = swt.swtrec(nce2s, wtname='sym6')
        sf1pds.append(sf1pd)
        sf2pds.append(sf2pd)

    for od in ods:
        swt = SWTP(od)
        coeffs = swt.swtdec(wtname='sym6', delevel=4)
        spta2 = SpCoThALG(coeffs)
        sfp1ths = []
        sfp2ths = []
예제 #3
0
    od3 = s.createSpikes(4)
    ods = [od1, od2, od3]
    dnames = ['Sine', 'Pulse', 'Spike']
    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:
        swt = SWTP(od)
        dl = swt.maxdeclevel()
        coeffs = swt.swtdec(wtname='db4', delevel=4)
        for i in range(len(pdsmatrix)):
            ncoeffs = swt.thprocess(coeffs, thf=thfname[i], thp=thps[i])
            pd = swt.swtrec(ncoeffs, wtname='db4')
            pdsmatrix[i].append(pd)

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

    smses = []
예제 #4
0
from GetActualSignal import GetActualSignal
import math as mt
from BlockThMethod import BlockThMethod
from ThresholdSelect import ThSelect
from BestThEstimation import BestThEstimate
from ThSearchAlgorithm import ThSearchAlgorithm
from WtProcess import SWTP
from DenoiseResult import DenoiseRsult
from SpatialCorrelationThresholdALG import SpCoThALG

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od1 = ad.selectvalue(start=11000, end=12024)
    dl = 4
    swt = SWTP(od1)
    coeffs = swt.swtdec(wtname='db2', delevel=dl)
    n1coeffs = swt.thprocess(coeffs, thf='soft')
    n2coeffs = swt.thprocess(coeffs, thf='hard')
    n3coeffs = swt.thprocess(coeffs, thf='thsemisf')
    spd = swt.swtrec(n1coeffs, wtname='db2')
    hpd = swt.swtrec(n2coeffs, wtname='db2')
    thf1pd = swt.swtrec(n3coeffs, wtname='db2')

    ad.outputdata(startidex=0, ogdata=od1, pddata=hpd)

    ssm = DenoiseRsult([], spd).smooth(od1)
    hsm = DenoiseRsult([], hpd).smooth(od1)
    thf1sm = DenoiseRsult([], thf1pd).smooth(od1)

    slrepv = DenoiseRsult([], spd).lrepv(od1, 128)
from GetActualSignal import GetActualSignal
import math as mt
from BlockThMethod import BlockThMethod
from ThresholdSelect import ThSelect
from BestThEstimation import BestThEstimate
from ThSearchAlgorithm import ThSearchAlgorithm
from WtProcess import SWTP
from DenoiseResult import DenoiseRsult
from NoiseDetection import NoiseDetection

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od1 = ad.selectvalue(start=11000, end=12024)
    dl = 3
    swd = SWTP(od1)
    coeffs = swd.swtdec(wtname='db2', delevel=dl)
    gths = []
    gth2s = []
    bsths = []
    shes = NoiseDetection(od1, 'db2').Entropymethod1(4)
    for i in range(1, len(coeffs)):
        bthe = BestThEstimate(coeffs[i], thfunction='thf3', thp=2 + 2 * i)
        thsa = ThSearchAlgorithm()
        gth = ThSelect(coeffs[i]).DonohoThEx()
        if shes[i - 1] > 1.5:
            shes[i - 1] = 1.5
        elif shes[i - 1] < 0.8:
            shes[i - 1] = 0.8
        else:
            pass
예제 #6
0
from WtProcess import SWTP, DWTP
from DenoiseResult import DenoiseRsult
from NoiseDetection import NoiseDetection

if __name__ == '__main__':
    ad = GetActualSignal()
    ad.getwhvalue()
    od = ad.selectvalue(start=0)
    ln = len(od) // 1024
    spd = []
    hpd = []
    npd = []
    dl = 3
    for k in range(ln):
        od1 = od[k * 1024:k * 1024 + 1024]
        swt = SWTP(od1)
        dwt = DWTP(od1)
        coeffs = swt.swtdec(wtname='db2', delevel=dl)
        dcoeffs = dwt.dwtdec(wtname='db2', delevel=dl)
        n1coeffs = swt.thprocess(coeffs, thf='soft')
        n2coeffs = swt.thprocess(coeffs, thf='hard')
        spd1 = swt.swtrec(n1coeffs, wtname='db2')
        hpd1 = swt.swtrec(n2coeffs, wtname='db2')

        shes = NoiseDetection(od1, 'db2').Entropymethod1(4)
        gth2s = []
        gth3s = []
        for i in range(1, len(coeffs)):
            gth = ThSelect(coeffs[i]).DonohoThEx()
            gth3 = ThSelect(dcoeffs[i]).EntropyTh2()
            if shes[i - 1] > 1.5: