gths.append(gth) cvths.append(cvth) gcvths.append(gcvth) srmths.append(srmth) gthss.append(gths) cvthss.append(cvths) gcvthss.append(gcvths) srmthss.append(srmths) for i in range(len(thsmatrix)): for j in range(len(ods)): dwd = DWTP(ods[j]) coeffs = dwd.dwtdec(wtname='db4', delevel=4) ths = thsmatrix[i] ncoeffs = dwd.thprocess(coeffs, ths=thsmatrix[i][j], thf=thfname[4], thp=4) pd = dwd.dwtrec(ncoeffs, wtname='db4') pdsmatrix[i].append(pd) ssnrs = [] cvsnrs = [] gcvsnrs = [] srmsnrs = [] smses = [] cvmses = [] gcvmses = [] srmmses = [] tds = [s.createSin(50, 60, 0), s.createPulse(50, 60, 0), s.createSpikes(0)]
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 = [] thf1mses = [] thf2mses = []
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))